From 1be6459e1d58678800fb23229d54155ac1c202dc Mon Sep 17 00:00:00 2001 From: kmaclip Date: Fri, 27 Mar 2026 14:39:31 -0400 Subject: [PATCH] feat: enable strict JSON schema for OpenAI extract responses The OpenAI client passes json_schema to the API without setting strict: true, allowing the model to deviate from the provided schema. This causes Zod parse errors when the model returns fields that don't match the expected types. Setting strict: true in the json_schema response format instructs OpenAI to constrain output to exactly match the schema, which aligns with AI SDK v6 defaults and prevents schema mismatches. Closes #1682 --- packages/core/lib/v3/llm/OpenAIClient.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/lib/v3/llm/OpenAIClient.ts b/packages/core/lib/v3/llm/OpenAIClient.ts index d3391d8ca..226997586 100644 --- a/packages/core/lib/v3/llm/OpenAIClient.ts +++ b/packages/core/lib/v3/llm/OpenAIClient.ts @@ -191,6 +191,7 @@ export class OpenAIClient extends LLMClient { json_schema: { name: options.response_model.name, schema: toJsonSchema(options.response_model.schema), + strict: true, }, }; }