Skip to content

Commit cc7d528

Browse files
authored
Howie/update agents 2 (#42262)
* Fix update_agents * update change log * Update test_agents_mock_overloads.py * Update CHANGELOG.md
1 parent 5e5aa84 commit cc7d528

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

sdk/ai/azure-ai-agents/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
### Bugs Fixed
88
- `AgentsResponseFormatOption`, `MessageInputContent`, `MessageAttachmentToolDefinition`, `AgentsToolChoiceOption` are now public.
9+
- Fixed `update_agents` to execute with body as a keyword parameter.
910

1011
### Sample updates
1112

sdk/ai/azure-ai-agents/azure/ai/agents/_patch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,8 +589,8 @@ def update_agent(
589589

590590
if body is not _Unset:
591591
if isinstance(body, io.IOBase):
592-
return super().update_agent(body=body, content_type=content_type, **kwargs)
593-
return super().update_agent(body=body, **kwargs)
592+
return super().update_agent(agent_id, body, content_type=content_type, **kwargs)
593+
return super().update_agent(agent_id, body, **kwargs)
594594

595595
if toolset is not None:
596596
tools = toolset.definitions

sdk/ai/azure-ai-agents/azure/ai/agents/aio/_patch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ async def update_agent(
587587

588588
if body is not _Unset:
589589
if isinstance(body, io.IOBase):
590-
return await super().update_agent(body=body, content_type=content_type, **kwargs)
591-
return await super().update_agent(body=body, **kwargs)
590+
return await super().update_agent(agent_id, body, content_type=content_type, **kwargs)
591+
return await super().update_agent(agent_id, body, **kwargs)
592592

593593
if toolset is not None:
594594
tools = toolset.definitions

sdk/ai/azure-ai-agents/tests/test_agents_mock_overloads.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,22 @@ async def test_create_stream(
137137
await async_agent.runs.stream(thread_id, body=dict_to_io_bytes(body))
138138

139139
assertion.same_http_requests_from(operation_count=6, api_per_operation_count=1)
140+
141+
@pytest.mark.asyncio
142+
@assert_same_http_requests
143+
async def test_update_agents(
144+
self, agent: AgentsClient, async_agent: AsyncAgentsClient, assertion: OverloadAssertion
145+
):
146+
model = "model"
147+
agent_id = "agent_id"
148+
body = {"model": model}
149+
150+
agent.update_agent(agent_id, model=model)
151+
agent.update_agent(agent_id, body=body)
152+
agent.update_agent(agent_id, body=dict_to_io_bytes(body))
153+
154+
await async_agent.update_agent(agent_id, model=model)
155+
await async_agent.update_agent(agent_id, body=body)
156+
await async_agent.update_agent(agent_id, body=dict_to_io_bytes(body))
157+
158+
assertion.same_http_requests_from(operation_count=6, api_per_operation_count=1)

0 commit comments

Comments
 (0)