Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,20 +24,24 @@ except ImportError:
|
|
24 |
# --- Constants ---
|
25 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
26 |
|
27 |
-
CURRENT_PROMPT = """You are a helpful assistant that can
|
28 |
|
29 |
Question: {question}
|
30 |
|
31 |
To answer this question:
|
32 |
-
1. If you need current information or facts you're unsure about, use the search tool first
|
33 |
2. Write Python code to solve the problem
|
34 |
3. Make sure your final answer is clear and direct
|
35 |
|
36 |
Available tools:
|
37 |
-
- web_search(query
|
38 |
-
-
|
|
|
|
|
|
|
39 |
|
40 |
-
Please provide a complete solution that ends with the final answer.
|
|
|
41 |
|
42 |
# --- Basic Agent Definition ---
|
43 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
@@ -101,7 +105,7 @@ class BasicAgent:
|
|
101 |
self.agent = CodeAgent(
|
102 |
tools=[],
|
103 |
model=self.model,
|
104 |
-
max_steps=
|
105 |
additional_authorized_imports=[
|
106 |
'math', 'statistics', 're', # Basic computation
|
107 |
'requests', 'json', # Web requests and JSON
|
@@ -130,7 +134,7 @@ class BasicAgent:
|
|
130 |
"""Run question through smolagents CodeAgent with enhanced prompting."""
|
131 |
try:
|
132 |
# Use the global CURRENT_PROMPT variable
|
133 |
-
formatted_question =
|
134 |
|
135 |
print(f"π Processing question: {question}")
|
136 |
print(f"π§ Available tools: {[tool.__class__.__name__ for tool in self.agent.tools]}")
|
|
|
24 |
# --- Constants ---
|
25 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
26 |
|
27 |
+
CURRENT_PROMPT = """You are a helpful assistant that can use tools including web-search and writing Python code to answer questions.
|
28 |
|
29 |
Question: {question}
|
30 |
|
31 |
To answer this question:
|
32 |
+
1. If you need current information or facts you're unsure about, use the search tool or another available tool first
|
33 |
2. Write Python code to solve the problem
|
34 |
3. Make sure your final answer is clear and direct
|
35 |
|
36 |
Available tools:
|
37 |
+
- web_search(query: str) β str
|
38 |
+
- visit_webpage(url: str) β str
|
39 |
+
- speech_to_text(file_path: str) β str
|
40 |
+
- python(code: str) β Any
|
41 |
+
- final_answer(answer: str) β None
|
42 |
|
43 |
+
Please provide a complete solution that ends with the final answer.
|
44 |
+
Please confirm your final answer before using the final_answer tool."""
|
45 |
|
46 |
# --- Basic Agent Definition ---
|
47 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
|
|
105 |
self.agent = CodeAgent(
|
106 |
tools=[],
|
107 |
model=self.model,
|
108 |
+
max_steps=12,
|
109 |
additional_authorized_imports=[
|
110 |
'math', 'statistics', 're', # Basic computation
|
111 |
'requests', 'json', # Web requests and JSON
|
|
|
134 |
"""Run question through smolagents CodeAgent with enhanced prompting."""
|
135 |
try:
|
136 |
# Use the global CURRENT_PROMPT variable
|
137 |
+
formatted_question = CURRENT_PROMPT.format(question=question)
|
138 |
|
139 |
print(f"π Processing question: {question}")
|
140 |
print(f"π§ Available tools: {[tool.__class__.__name__ for tool in self.agent.tools]}")
|