-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_chat.py
More file actions
28 lines (22 loc) · 843 Bytes
/
Copy pathtest_chat.py
File metadata and controls
28 lines (22 loc) · 843 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
import asyncio
from ctiagent import CTIgor
async def main():
ctigor = CTIgor()
# Loop forever while the user has more input
while True:
try:
# Get input from the user, display a prompt to indicate waiting on user input
user_prompt = input('CTIgor> ')
# If user says 'quit' then exit
if user_prompt.lower() in ['quit', 'exit', 'bye']:
raise EOFError
# Send the user's prompt to the LLM and wait for the response
response = await ctigor.prompt(user_prompt)
# Display response on console
print(f"=======\n{response}\n=======")
except EOFError:
# On EOF, exit the program gracefully
print("Thank you, bye!")
break
if __name__ == "__main__":
asyncio.run(main())