Update app.py
Browse files
app.py
CHANGED
@@ -53,20 +53,23 @@ class WebSearchAgent:
|
|
53 |
tools=[duck_search, calculator],
|
54 |
model="gpt-3.5-turbo", # You can use gpt-4o if you have access
|
55 |
planning_interval=5,
|
56 |
-
system_prompt=(
|
57 |
-
"You're a helpful reasoning agent. Use the provided tools "
|
58 |
-
"to help answer the user's questions accurately."
|
59 |
-
),
|
60 |
)
|
61 |
print("β
Agent initialized.")
|
62 |
|
63 |
def __call__(self, question: str) -> str:
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
# --- Constants ---
|
72 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
53 |
tools=[duck_search, calculator],
|
54 |
model="gpt-3.5-turbo", # You can use gpt-4o if you have access
|
55 |
planning_interval=5,
|
|
|
|
|
|
|
|
|
56 |
)
|
57 |
print("β
Agent initialized.")
|
58 |
|
59 |
def __call__(self, question: str) -> str:
|
60 |
+
print(f"π Question: {question}")
|
61 |
+
try:
|
62 |
+
return self.agent.run(
|
63 |
+
question,
|
64 |
+
step_limit=5,
|
65 |
+
system_prompt=(
|
66 |
+
"You're a helpful reasoning agent. Use the tools available to search or compute as needed "
|
67 |
+
"to provide accurate and concise answers to the user's question."
|
68 |
+
)
|
69 |
+
)
|
70 |
+
except Exception as e:
|
71 |
+
print(f"β Agent error: {e}")
|
72 |
+
return f"Error: {e}"
|
73 |
|
74 |
# --- Constants ---
|
75 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|