Skip to content

Python: Bug: extra_parameters should be passed as model_extras to the ChatCompletionsClient.complete() method, #13005

Closed

Description

Copied from: Azure/azure-sdk-for-python#42561

Package Name: azure-ai-inference
Package Version: 1.0.0b9
Operating System: macOS
Python Version: Python: 3.11.1
Describe the bug
When using AzureAIInferenceChatPromptExecutionSettings with extra_parameters to pass GPT-5 reasoning parameters (reasoning_effort, verbosity, enable_preamble), the SDK throws an error:
ClientSession._request() got an unexpected keyword argument 'extra_parameters'

To Reproduce
Steps to reproduce the behavior:

Create AzureAIInferenceChatPromptExecutionSettings with extra_parameters:
from semantic_kernel.connectors.ai.azure_ai_inference import AzureAIInferenceChatPromptExecutionSettings

settings = AzureAIInferenceChatPromptExecutionSettings(
temperature=0.5,
max_tokens=4000,
extra_parameters={
'reasoning_effort': 'medium',
'verbosity': 'medium',
'enable_preamble': True,
'reasoning_summary': 'auto'
}
)
Pass settings to ChatCompletionAgent via KernelArguments
Invoke agent with these settings
Error occurs when the SDK tries to make the API call
Expected behavior

The extra_parameters should be passed as model_extras to the ChatCompletionsClient.complete() method, allowing GPT-5 reasoning parameters to be used.

Actual Behavior

The SDK incorrectly passes extra_parameters as a keyword argument to the underlying HTTP client, causing the error.

Additional context

This bug prevents using GPT-5's new reasoning features (reasoning_effort, verbosity, preamble) through Azure AI Foundry with Semantic Kernel, blocking access to key GPT-5 capabilities announced in the recent GA release. This affects adoption of GPT-5 models as the reasoning visibility is a key differentiating feature.

Environment

Python: 3.11.1
azure-ai-inference: 1.0.0b9
semantic-kernel: 1.35.2
OS: macOS

Activity

  1. dargilco commented on Aug 25, 2025

    @dargilco
    MemberAuthor

    Per https://learn.microsoft.com/en-us/python/api/azure-ai-inference/azure.ai.inference.chatcompletionsclient?view=azure-python-preview , ChatCompletionsClient supports models_extra as a dict of additional parameters that gets passed to the model on the root of the request.

  2. dargilco commented on Aug 25, 2025

    @dargilco
    MemberAuthor

    Opening this issue on behalf of marvika

  3. moonbox3 commented on Aug 29, 2025

    @moonbox3
    Collaborator

    Devs can use AzureChatCompletion which supports the use of gpt-5 right now. What's specific to Azure AI Inference? Thanks. Marius (@marvika)

  4. dargilco commented on Aug 29, 2025

    @dargilco
    MemberAuthor

    Evan Mattson (@moonbox3) Marius (@marvika) If Semantic Kernel is calling any one of the clients implemented in azure-ai-inference package, and extra parameters are needed to pass in at the root of the request payload, they need to be set as the input dict model_extras when you create the azure-ai-inference client. For example, see the ChatCompletionsClient: https://learn.microsoft.com/en-us/python/api/azure-ai-inference/azure.ai.inference.chatcompletionsclient?view=azure-python-preview. Sounds like this is not being done at the moment - instead a parameter named extra_parameters is passed in, which is rejected by the service. You simply need to rename the parameter before you construct the azure-ai-inference client.

  5. moonbox3 commented on Sep 2, 2025

    @moonbox3
    Collaborator

    Tao Chen (@TaoChenOSU) can you help take a look at this, please?

  6. TaoChenOSU commented on Sep 3, 2025

    @TaoChenOSU
    Contributor

    Hey Darren Cohen (@dargilco),

    Could you confirm that these two parameters are supported?

    {
      'enable_preamble': True,
      'reasoning_summary': 'auto'
    }
    
  7. dargilco commented on Sep 3, 2025

    @dargilco
    MemberAuthor

    Tao Chen (@TaoChenOSU) what extra request parameters are supported depends on the selected AI model. The SDK does not know anything about those additional parameters. Try passing them in by adding model_extras = {"enable_preable": "true", "reasoning_summary": "auto"} to the chat completions call. You can turn on azure-ai-inference SDK logging to see the full request payload that was sent to the service, and verify that these two additional JSON elements were included. To turn on un-redacted logging, add this at the top of your code:

    import sys
    import logging
    logger = logging.getLogger("azure")
    logger.setLevel(logging.DEBUG)
    logger.addHandler(logging.StreamHandler(stream=sys.stdout))

    And add this additional input parameter to the ChatCompletions client constructor:

    logging_enable=True

  8. TaoChenOSU commented on Sep 4, 2025

    @TaoChenOSU
    Contributor

    Addressed by #13066

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ai connectorAnything related to AI connectorsbugSomething isn't workingpythonPull requests for the Python Semantic Kernel

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions