diff --git a/.changeset/sour-parks-trade.md b/.changeset/sour-parks-trade.md new file mode 100644 index 00000000000..5d58470ce54 --- /dev/null +++ b/.changeset/sour-parks-trade.md @@ -0,0 +1,5 @@ +--- +"@effect/ai-openai": patch +--- + +Previously, setting `strict: false` on `OpenAiLanguageModel` config caused a 400 "Unknown parameter: 'strict'" response from the OpenAI Responses API, because the flag was spread into the top-level request body instead of being consumed only by the tool and response_format schema builders. The `strict` flag is now stripped from the request body while still controlling `strict` on tool schemas (`prepareTools`) and json_schema response formats (`prepareResponseFormat`). diff --git a/packages/ai/openai/src/OpenAiLanguageModel.ts b/packages/ai/openai/src/OpenAiLanguageModel.ts index c4fef761467..287afa629fd 100644 --- a/packages/ai/openai/src/OpenAiLanguageModel.ts +++ b/packages/ai/openai/src/OpenAiLanguageModel.ts @@ -287,8 +287,9 @@ export const make = Effect.fnUntraced(function*(options: { const include = prepareInclude(providerOptions, config) const responseFormat = prepareResponseFormat(providerOptions) const verbosity = config.text?.verbosity + const { strict: _strict, ...requestConfig } = config const request: typeof Generated.CreateResponse.Encoded = { - ...config, + ...requestConfig, input: messages, include, text: { format: responseFormat, verbosity },