feat(llm): pass strict through tool definitions for Codex parity (#33392)
This commit is contained in:
@@ -146,6 +146,16 @@ export const prepare = Effect.fn("LLMRequestPrep.prepare")(function* (input: Pre
|
||||
)
|
||||
|
||||
const tools = resolveTools(input)
|
||||
// Codex parity: OpenAI Responses-family providers hardcode `strict: false`
|
||||
// on every function tool so MCP-sourced and dynamic schemas that don't
|
||||
// satisfy OpenAI's structured-outputs constraints still register.
|
||||
if (
|
||||
input.model.api.npm === "@ai-sdk/openai" ||
|
||||
input.model.api.npm === "@ai-sdk/azure" ||
|
||||
input.model.api.npm === "@ai-sdk/amazon-bedrock/mantle"
|
||||
) {
|
||||
for (const key of Object.keys(tools)) tools[key] = { ...tools[key], strict: false }
|
||||
}
|
||||
if (
|
||||
input.model.providerID.includes("github-copilot") &&
|
||||
Object.keys(tools).length === 0 &&
|
||||
|
||||
Reference in New Issue
Block a user