-
Notifications
You must be signed in to change notification settings - Fork 224
Description
Symptom
LISA's AI log analyzer fails when attempting to use Azure OpenAI chat clients due to an invalid API parameter being passed to the Azure OpenAI service.
Root Cause
The agent-framework library incorrectly translates the max_tokens parameter to max_output_tokens when calling the Azure OpenAI Chat Completions API. The parameter max_output_tokens is not supported by Azure OpenAI's AsyncCompletions.create() method, which expects either max_tokens or max_completion_tokens.
This is a known bug in the agent-framework library:
- GitHub Issue: microsoft/agent-framework#3025
- Status: Fix in progress via PR #3037
Error Message
[INFO] ala [Magentic] Attempt 1 failed: <class 'agent_framework.azure._chat_client.AzureOpenAIChatClient'> service failed to complete the prompt: AsyncCompletions.create() got an unexpected keyword argument 'max_output_tokens'
Affected Versions
- agent-framework-core:
1.0.0b251223 - agent-framework-azure-ai:
1.0.0b251223 - openai:
2.8.1
Workaround
Instead of passing max_tokens directly to ChatAgent, the issue comment suggests using:
additional_properties={"max_completion_tokens": 8000}to bypass the buggy translation in the framework and uses the correct Azure OpenAI API parameter.
Once agent-framework releases a fix, update to the fixed version and remove the workaround.