Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,10 +19,10 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
19 |
|
20 |
class MyAgent:
|
21 |
def __init__(self):
|
22 |
-
#
|
23 |
self.model = OpenAIServerModel(
|
24 |
model_id="gpt-4",
|
25 |
-
|
26 |
)
|
27 |
self.agent = CodeAgent(
|
28 |
tools=[DuckDuckGoSearchTool()],
|
@@ -30,8 +30,12 @@ class MyAgent:
|
|
30 |
)
|
31 |
|
32 |
def __call__(self, question: str) -> str:
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
35 |
|
36 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
37 |
"""
|
|
|
19 |
|
20 |
class MyAgent:
|
21 |
def __init__(self):
|
22 |
+
# Fix: use system_prompt instead of system_message
|
23 |
self.model = OpenAIServerModel(
|
24 |
model_id="gpt-4",
|
25 |
+
system_prompt=SYSTEM_PROMPT
|
26 |
)
|
27 |
self.agent = CodeAgent(
|
28 |
tools=[DuckDuckGoSearchTool()],
|
|
|
30 |
)
|
31 |
|
32 |
def __call__(self, question: str) -> str:
|
33 |
+
try:
|
34 |
+
return self.agent.run(question)
|
35 |
+
except Exception as e:
|
36 |
+
import traceback
|
37 |
+
traceback.print_exc()
|
38 |
+
return f"AGENT ERROR: {e}"
|
39 |
|
40 |
def run_and_submit_all(profile: gr.OAuthProfile | None):
|
41 |
"""
|