-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathapp.py
More file actions
32 lines (22 loc) · 1007 Bytes
/
app.py
File metadata and controls
32 lines (22 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import asyncio
import os
from agent_framework.declarative import AgentFactory
from azure.identity import DefaultAzureCredential
from azure.appconfiguration.provider import load
async def main():
endpoint = os.environ["AZURE_APPCONFIGURATION_ENDPOINT"]
credential = DefaultAzureCredential()
config = load(endpoint=endpoint, credential=credential)
agent_spec = config["ChatAgent:Spec"]
agent = AgentFactory(client_kwargs={"credential": credential, "project_endpoint": config["ChatAgent:ProjectEndpoint"]}).create_agent_from_yaml(agent_spec)
while True:
print("How can I help? (type 'quit' to exit)")
user_input = input("User: ")
if user_input.lower() in ['quit', 'exit', 'bye']:
break
response = await agent.run(user_input)
print("Agent response: ", response.text)
input("Press enter to continue...")
print("Exiting... Goodbye...")
if __name__ == "__main__":
asyncio.run(main())