fix(rawapp): schema for openai (#7364)

This commit is contained in:
centdix
2025-12-14 23:27:03 +01:00
committed by GitHub
parent 6e88a45625
commit cd66dff55b
2 changed files with 5 additions and 4 deletions

View File

@@ -237,7 +237,8 @@ const getSetBackendRunnableToolDef = memo(() =>
createToolDef(
getSetBackendRunnableSchema(),
'set_backend_runnable',
'Create or update a backend runnable. Use type "inline" for custom code, or reference existing workspace/hub scripts/flows. Returns lint diagnostics (errors and warnings).'
'Create or update a backend runnable. Use type "inline" for custom code, or reference existing workspace/hub scripts/flows. Returns lint diagnostics (errors and warnings).',
{ strict: false }
)
)
@@ -294,7 +295,6 @@ const getListWorkspaceRunnablesSchema = memo(() =>
query: z.string().describe('The search query to find workspace scripts and flows'),
type: z
.enum(['all', 'scripts', 'flows'])
.optional()
.describe(
'Filter by type: "scripts" for scripts only, "flows" for flows only, "all" for both. Defaults to "all".'
)

View File

@@ -506,7 +506,8 @@ export interface ToolCallbacks {
export function createToolDef(
zodSchema: z.ZodSchema,
name: string,
description: string
description: string,
{ strict = true }: { strict?: boolean } = {} // we sometimes have to set strict to false for open ai models to avoid issues with complex properties
): ChatCompletionFunctionTool {
// console.log('creating tool def for', name, zodSchema)
let parameters = z.toJSONSchema(zodSchema)
@@ -516,7 +517,7 @@ export function createToolDef(
return {
type: 'function',
function: {
strict: true,
strict,
name,
description,
parameters