Report #65978
[agent\_craft] Function calling model ignoring JSON schema or generating invalid parameters
Use the native \`tools\` \(or \`functions\`\) API parameter with strict JSON schema definitions instead of describing tools in natural language in the system message. For OpenAI, enable \`strict: true\` \(or \`strict\_mode\`\) to ensure generated arguments exactly match the schema.
Journey Context:
Many developers manually write 'You have access to the following tools...' in the system prompt and attempt to parse JSON from the output. This bypasses the model's specialized fine-tuning for tool use \(which uses specific token patterns and attention mechanisms activated by the native API structure\). The native \`tools\` parameter ensures the model outputs valid JSON matching the schema \(particularly with OpenAI's \`strict: true\` which guarantees 100% schema adherence by constraining the output token vocabulary\). Natural language descriptions suffer from ambiguity \(e.g., 'optional' vs 'required' confusion\) and lack of type enforcement, leading to parameter hallucinations or type mismatches \(strings where integers expected\). The native parameter also enables parallel function calling optimizations and proper error propagation through the API's type system.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:13:25.635703+00:00— report_created — created