Skip to content

Fix(agent-init): replace max_tokens with max_completion_tokens for connection check of Azure OpenAI service#9405

Merged
yanzhudd merged 1 commit intoAzure:mainfrom
mainred:fix-unsupported_parameter
Nov 10, 2025
Merged

Fix(agent-init): replace max_tokens with max_completion_tokens for connection check of Azure OpenAI service#9405
yanzhudd merged 1 commit intoAzure:mainfrom
mainred:fix-unsupported_parameter

Conversation

@mainred
Copy link
Member

@mainred mainred commented Nov 8, 2025


Before this check, when validating gpt-5, it raises the following error, while it works for gpt-4.1 though.

Please re-run `az aks agent-init` to correct the input parameters. Client error: 400 Client Error: Bad Request for url: https://qinhao-ai.openai.azure.com/openai/deployments/gpt-5/chat/completions?api-version=2025-04-01-preview - {
  "error": {
    "message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",
    "type": "invalid_request_error",
    "param": "max_tokens",
    "code": "unsupported_parameter"
  }
}

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI review requested due to automatic review settings November 8, 2025 11:15
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Nov 8, 2025

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Nov 8, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@mainred
Copy link
Member Author

mainred commented Nov 8, 2025

cc @yanzhudd

@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the Azure OpenAI provider to use the newer max_completion_tokens parameter instead of the deprecated max_tokens parameter for connection validation, aligning with the API version 2025-04-01-preview. The version is bumped from 1.0.0b10 to 1.0.0b11.

  • Changed API parameter from max_tokens to max_completion_tokens in Azure OpenAI connection validation
  • Added TODO comment about leveraging litellm for connection checks
  • Updated version and release history

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/aks-agent/setup.py Bumps version from 1.0.0b10 to 1.0.0b11
src/aks-agent/azext_aks_agent/agent/llm_providers/base.py Adds TODO comment for future improvement to use litellm
src/aks-agent/azext_aks_agent/agent/llm_providers/azure_provider.py Updates connection validation to use max_completion_tokens instead of max_tokens
src/aks-agent/HISTORY.rst Documents the fix in release notes and fixes capitalization

@yanzhudd yanzhudd merged commit 4a42852 into Azure:main Nov 10, 2025
44 of 45 checks passed
@azclibot
Copy link
Collaborator

[Release] Update index.json for extension [ aks-agent-1.0.0b11 ] : https://dev.azure.com/msazure/One/_build/results?buildId=143173826&view=results

@mainred mainred deleted the fix-unsupported_parameter branch December 6, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants