Skip to content

Commit 5cf8568

Browse files
authored
Python: Fix agent_id kwarg in AzureAIAgent retrieval sample (#11057)
### Motivation and Context The current AzureAIAgent retrieval sample uses the old `assistant_id` kwarg to retrieve the agent. We need to fix this to use the new `agent_id` kwarg in AzureAIAgent retrieval sample <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> ### Description Fix the kwarg to use `agent_id`. <!-- Describe your changes, the overall approach, the underlying design. These notes will help understanding how your code works. Thanks! --> ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄
1 parent 74714cb commit 5cf8568

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

python/samples/getting_started_with_agents/azure_ai_agent/step7_azure_ai_agent_retrieval.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ async def main() -> None:
2525
DefaultAzureCredential() as creds,
2626
AzureAIAgent.create_client(credential=creds) as client,
2727
):
28-
# 1. Retrieve the agent definition based on the `assistant_id`
29-
# Replace the "your-assistant-id" with the actual assistant ID
28+
# 1. Retrieve the agent definition based on the `agent_id`
29+
# Replace the "your-agent-id" with the actual agent ID
3030
# you want to use.
3131
agent_definition = await client.agents.get_agent(
32-
assistant_id="your-assistant-id",
32+
agent_id="your-agent-id",
3333
)
3434

3535
# 2. Create a Semantic Kernel agent for the Azure AI agent
@@ -52,7 +52,7 @@ async def main() -> None:
5252
finally:
5353
# 6. Cleanup: Delete the thread and agent
5454
await client.agents.delete_thread(thread.id)
55-
# Do not clean up the assistant so it can be used again
55+
# Do not clean up the agent so it can be used again
5656

5757
"""
5858
Sample Output:

python/tests/unit/agents/azure_ai_agent/test_agent_content_generation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_generate_message_content_text_and_image():
105105
)
106106

107107
thread_msg.content = [image, text]
108-
step = RunStep(id="step_id", run_id="run_id", thread_id="thread_id", agent_id="assistant_id")
108+
step = RunStep(id="step_id", run_id="run_id", thread_id="thread_id", agent_id="agent_id")
109109
out = generate_message_content("assistant", thread_msg, step)
110110
assert len(out.items) == 5
111111
assert isinstance(out.items[0], FileReferenceContent)

0 commit comments

Comments
 (0)