feat(llm): pass strict through tool definitions for Codex parity (#33392)

This commit is contained in:
Aiden Cline
2026-06-25 16:28:39 -05:00
committed by GitHub
parent 0568855cc6
commit 5f61d21487
10 changed files with 31 additions and 9 deletions
@@ -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 &&