Skip to content

Python: AzureOpenAIResponsesClient(model_id=...) resolves to True due to walrus precedence #4299

@moonbox3

Description

@moonbox3

Description

AzureOpenAIResponsesClient incorrectly handles model_id in constructor kwargs due to walrus operator precedence.

Current code:

if model_id := kwargs.pop("model_id", None) and not deployment_name:
    deployment_name = str(model_id)

When model_id is provided and deployment_name is not, model_id receives a boolean (True) instead of the model string.

Expected behavior:

  • model_id="gpt-4o" should set deployment/model id to "gpt-4o".

Code Sample

from agent_framework.azure import AzureOpenAIResponsesClient

c = AzureOpenAIResponsesClient(
    model_id="gpt-4o",
    endpoint="https://example.openai.azure.com",
    api_key="k",
)
print(c.model_id)  # observed: True

Error Messages / Stack Traces

No exception is raised; behavior is incorrect:

model_id True

Package Versions

  • agent-framework-core: 1.0.0rc2
  • Source commit tested: 02ba27493 (main)

Python Version

Python 3.13.5

Additional Context

Likely location:

  • packages/core/agent_framework/azure/_responses_client.py (constructor near line 183)

Metadata

Metadata

Assignees

Labels

agentsIssues related to single agentsbugSomething isn't workingpython

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions