11import asyncio
22import os
33from agent_framework .declarative import AgentFactory
4- from azure .identity .aio import DefaultAzureCredential as AsyncDefaultCredential
54from azure .identity import DefaultAzureCredential
65from azure .appconfiguration .provider import load
76
@@ -13,23 +12,22 @@ async def main():
1312
1413 yaml_str = config ["ChatAgent:Spec" ]
1514
16- async with (
17- AsyncDefaultCredential () as credential ,
18- AgentFactory (client_kwargs = {"async_credential" : credential , "project_endpoint" : config ["ChatAgent:ProjectEndpoint" ]}).create_agent_from_yaml (yaml_str ) as agent ,
19- ):
20- while True :
21- print ("How can I help? (type 'quit' to exit)" )
15+ agent = AgentFactory (client_kwargs = {"credential" : credential , "project_endpoint" : config ["ChatAgent:ProjectEndpoint" ]}).create_agent_from_yaml (yaml_str )
2216
23- user_input = input ("User: " )
24-
25- if user_input .lower () in ['quit' , 'exit' , 'bye' ]:
26- break
17+ while True :
18+ print ("How can I help? (type 'quit' to exit)" )
2719
28- response = await agent .run (user_input )
29- print ("Agent response: " , response .text )
30- input ("Press enter to continue..." )
20+ user_input = input ("User: " )
21+
22+ if user_input .lower () in ['quit' , 'exit' , 'bye' ]:
23+ break
24+
25+ response = await agent .run (user_input )
26+ print ("Agent response: " , response .text )
27+ input ("Press enter to continue..." )
28+
3129
3230 print ("Exiting... Goodbye..." )
3331
3432if __name__ == "__main__" :
35- asyncio .run (main ())
33+ asyncio .run (main ())
0 commit comments