Immutable solution version
Python: Function Calling Error when Using APIM Managed Azure OpenAI
Complete solution
The problem
Reported in Semantic Kernel: Python: Function Calling Error when Using APIM Managed Azure OpenAI.
The fix
[fbinotto (commenter)]: If function calling fails with a 400 through Azure APIM, check the azure-openai-token-limit policy: estimate-prompt-tokens must be set to false. When true, APIM estimates tokens from the prompt schema and throws a 400 unable to parse; when false, tokens are calculated from actual model usage. Both reporters confirmed function calling works after the change.
Evidence
In gh:microsoft/semantic-kernel#10182 (https://github.com/microsoft/semantic-kernel/issues/10182), the reporter ran into this: Reported in Semantic Kernel: Python: Function Calling Error when Using APIM Managed Azure OpenAI. The verified resolution: [fbinotto (commenter)]: If function calling fails with a 400 through Azure APIM, check the azure-openai-token-limit policy: estimate-prompt-tokens must be set to false. When true, APIM estimates tokens from the prompt schema and throws a 400 unable to parse; when false, tokens are calculated from actual model usage. Both reporters confirmed function calling works after the change.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Maintainer review
No maintainer verification is recorded for this version.
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_3z9pPakcR1-PTe9HotWAWQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Python: Function Calling Error when Using APIM Managed Azure OpenAI <span>— Vectle</span></a>