|
4 | 4 | from random import randint |
5 | 5 | from typing import Annotated |
6 | 6 |
|
7 | | -from agent_framework import Agent, AgentSession, ChatOptions, tool |
| 7 | +from agent_framework import Agent, AgentSession, tool |
8 | 8 | from agent_framework.openai import OpenAIChatClient |
9 | 9 | from azure.identity import AzureCliCredential |
10 | 10 | from dotenv import load_dotenv |
@@ -76,19 +76,19 @@ async def example_with_session_persistence_in_memory() -> None: |
76 | 76 | # First conversation |
77 | 77 | query1 = "What's the weather like in Tokyo?" |
78 | 78 | print(f"User: {query1}") |
79 | | - result1 = await agent.run(query1, session=session, options=ChatOptions(store=False)) |
| 79 | + result1 = await agent.run(query1, session=session, options={"store": False}) |
80 | 80 | print(f"Agent: {result1.text}") |
81 | 81 |
|
82 | 82 | # Second conversation using the same session - maintains context |
83 | 83 | query2 = "How about London?" |
84 | 84 | print(f"\nUser: {query2}") |
85 | | - result2 = await agent.run(query2, session=session, options=ChatOptions(store=False)) |
| 85 | + result2 = await agent.run(query2, session=session, options={"store": False}) |
86 | 86 | print(f"Agent: {result2.text}") |
87 | 87 |
|
88 | 88 | # Third conversation - agent should remember both previous cities |
89 | 89 | query3 = "Which of the cities I asked about has better weather?" |
90 | 90 | print(f"\nUser: {query3}") |
91 | | - result3 = await agent.run(query3, session=session, options=ChatOptions(store=False)) |
| 91 | + result3 = await agent.run(query3, session=session, options={"store": False}) |
92 | 92 | print(f"Agent: {result3.text}") |
93 | 93 | print("Note: The agent remembers context from previous messages in the same session.\n") |
94 | 94 |
|
|
0 commit comments