-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathmain.py
More file actions
46 lines (38 loc) · 1.48 KB
/
Copy pathmain.py
File metadata and controls
46 lines (38 loc) · 1.48 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from agent import OpenRouterAgent
def main():
"""Main entry point for the OpenRouter agent"""
print("OpenRouter Agent with DuckDuckGo Search")
print("Type 'quit', 'exit', or 'bye' to exit")
print("-" * 50)
try:
agent = OpenRouterAgent()
print("Agent initialized successfully!")
print(f"Using model: {agent.config['openrouter']['model']}")
print("Note: Make sure to set your OpenRouter API key in config.yaml")
print("-" * 50)
except Exception as e:
print(f"Error initializing agent: {e}")
print("Make sure you have:")
print("1. Set your OpenRouter API key in config.yaml")
print("2. Installed all dependencies with: pip install -r requirements.txt")
return
while True:
try:
user_input = input("\nUser: ").strip()
if user_input.lower() in ['quit', 'exit', 'bye']:
print("Goodbye!")
break
if not user_input:
print("Please enter a question or command.")
continue
print("Agent: Thinking...")
response = agent.run(user_input)
print(f"Agent: {response}")
except KeyboardInterrupt:
print("\n\nExiting...")
break
except Exception as e:
print(f"Error: {e}")
print("Please try again or type 'quit' to exit.")
if __name__ == "__main__":
main()