Skip to content

Commit b99e8ca

Browse files
howieleungCopilot
andauthored
Fix update_agents (Azure#42261)
* Fix update_agents * Update sdk/ai/azure-ai-agents/tests/test_agents_mock_overloads.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update sdk/ai/azure-ai-agents/CHANGELOG.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a32a5f6 commit b99e8ca

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## 1.1.0b5 (Unreleased)
66

7+
### Bugs Fixed
8+
9+
- Fixed `update_agent` to execute with body as a keyword parameter.
10+
711
### Features Added
812

913
- Support `tool_resources` for run async operations.

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)