Skip to content

Commit 7a19ae3

Browse files
authored
Python: Update AzureAIAgent sample (#11175)
### Motivation and Context Following the latest updates for the Common Agent Invocation API feature, one AzureAIAgent sample was not configured properly. <!-- 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 Update the sample so the response doesn't show twice. Should print the agent name and then the response. <!-- 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 2c20c5e commit 7a19ae3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

python/samples/getting_started_with_agents/azure_ai_agent/step1_azure_ai_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async def main() -> None:
5757
print(f"# User: {user_input}")
5858
# 4. Invoke the agent with the specified message for response
5959
response = await agent.get_response(messages=user_input, thread=thread)
60-
print(f"# {response.content}: {response}")
60+
print(f"# {response.name}: {response}")
6161
thread = response.thread
6262
finally:
6363
# 6. Cleanup: Delete the thread and agent

python/samples/learn_resources/agent_docs/chat_agent.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ async def main():
7575
is_complete = True
7676
break
7777

78-
async for response in agent.invoke(messages=user_input, thread=thread):
78+
arguments = KernelArguments(now=datetime.now().strftime("%Y-%m-%d %H:%M"))
79+
80+
async for response in agent.invoke(messages=user_input, thread=thread, arguments=arguments):
7981
print(f"{response.content}")
8082
thread = response.thread
8183

0 commit comments

Comments
 (0)