forked from jpherrerap/llm-hackathon-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathback_client.py
More file actions
29 lines (24 loc) · 1.06 KB
/
Copy pathback_client.py
File metadata and controls
29 lines (24 loc) · 1.06 KB
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
from back.client import BackClient
def main():
"""
Main function to run the Swarm CLI demo.
This function initializes a BackClient, sets user data, and runs an interactive
loop for processing user queries until the user decides to exit.
"""
client = BackClient("db_knowledge.json", "db_tickets.json")
print("Starting Swarm CLI 🐝")
client.set_user_data(name="Sebastian", email="sebag@gmail.com", phone="1234567890")
message = client.start_conversation().messages[-1]
print(f"{message['role']}: {message['content']}")
while True:
user_input = input("\033[90mUsuario\033[0m: ")
if user_input.lower() == 'salir':
break
response = client.process_user_query(user_input)
message = response.messages[-1]
print(f"{message['role']}({response.agent.name}): {message['content']}")
print("\nHistorial de la conversación:")
for message in client.get_conversation_history():
print(f"{message['role'].capitalize()}: {message['content']}")
if __name__ == "__main__":
main()