Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -148,9 +148,9 @@ class BasicAgent:
|
|
| 148 |
|
| 149 |
# model
|
| 150 |
self.model = RetryOpenAIModel(
|
| 151 |
-
model_id="
|
| 152 |
-
api_base="https://
|
| 153 |
-
api_key=os.environ["
|
| 154 |
client_kwargs={
|
| 155 |
"timeout": 60.0,
|
| 156 |
"max_retries": 0
|
|
@@ -160,12 +160,11 @@ class BasicAgent:
|
|
| 160 |
|
| 161 |
# Tools
|
| 162 |
self.tools = [
|
| 163 |
-
WebSearchTool(),
|
| 164 |
-
VisitWebpageTool(),
|
| 165 |
PythonInterpreterTool(
|
| 166 |
authorized_imports=["math", "re", "datetime", "collections"]
|
| 167 |
-
)
|
| 168 |
-
WikipediaSearchTool()
|
| 169 |
]
|
| 170 |
|
| 171 |
# Changed from CodeAgent -> ToolCallingAgent
|
|
@@ -173,7 +172,7 @@ class BasicAgent:
|
|
| 173 |
model=self.model,
|
| 174 |
tools=self.tools,
|
| 175 |
max_steps=5,
|
| 176 |
-
verbosity_level=
|
| 177 |
instructions="""
|
| 178 |
You are an intelligent AI agent designed to solve GAIA benchmark questions accurately and efficiently.
|
| 179 |
|
|
@@ -190,7 +189,7 @@ class BasicAgent:
|
|
| 190 |
TOOL SELECTION:
|
| 191 |
- Before using a tool, determine what information is actually needed.
|
| 192 |
- Select the most appropriate tool for the question.
|
| 193 |
-
- For questions
|
| 194 |
- Use web_search when external information must be discovered.
|
| 195 |
- Do not use tools for simple questions that can be answered reliably without them.
|
| 196 |
- Avoid repeatedly switching between tools without a clear reason.
|
|
@@ -261,14 +260,14 @@ class BasicAgent:
|
|
| 261 |
for i, step in enumerate(result.steps):
|
| 262 |
print(f"STEP {i + 1}")
|
| 263 |
|
| 264 |
-
|
| 265 |
print("Tool calls:", step.get("tool_calls"))
|
| 266 |
print("Observation:", step.get("observations"))
|
| 267 |
print("Error:", step.get("error"))
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
|
| 273 |
# Structured output
|
| 274 |
tool_steps = result.steps
|
|
|
|
| 148 |
|
| 149 |
# model
|
| 150 |
self.model = RetryOpenAIModel(
|
| 151 |
+
model_id="openai/gpt-oss-20b",
|
| 152 |
+
api_base="https://api.groq.com/openai/v1",
|
| 153 |
+
api_key=os.environ["GROQ_API_KEY"],
|
| 154 |
client_kwargs={
|
| 155 |
"timeout": 60.0,
|
| 156 |
"max_retries": 0
|
|
|
|
| 160 |
|
| 161 |
# Tools
|
| 162 |
self.tools = [
|
| 163 |
+
WebSearchTool(max_results=5),
|
| 164 |
+
VisitWebpageTool(max_output_length=8000),
|
| 165 |
PythonInterpreterTool(
|
| 166 |
authorized_imports=["math", "re", "datetime", "collections"]
|
| 167 |
+
)
|
|
|
|
| 168 |
]
|
| 169 |
|
| 170 |
# Changed from CodeAgent -> ToolCallingAgent
|
|
|
|
| 172 |
model=self.model,
|
| 173 |
tools=self.tools,
|
| 174 |
max_steps=5,
|
| 175 |
+
verbosity_level=1,
|
| 176 |
instructions="""
|
| 177 |
You are an intelligent AI agent designed to solve GAIA benchmark questions accurately and efficiently.
|
| 178 |
|
|
|
|
| 189 |
TOOL SELECTION:
|
| 190 |
- Before using a tool, determine what information is actually needed.
|
| 191 |
- Select the most appropriate tool for the question.
|
| 192 |
+
- For questions referencing Wikipedia, use web_search to locate relevant Wikipedia pages, then visit_webpage if accessible.
|
| 193 |
- Use web_search when external information must be discovered.
|
| 194 |
- Do not use tools for simple questions that can be answered reliably without them.
|
| 195 |
- Avoid repeatedly switching between tools without a clear reason.
|
|
|
|
| 260 |
for i, step in enumerate(result.steps):
|
| 261 |
print(f"STEP {i + 1}")
|
| 262 |
|
| 263 |
+
if isinstance(step, dict):
|
| 264 |
print("Tool calls:", step.get("tool_calls"))
|
| 265 |
print("Observation:", step.get("observations"))
|
| 266 |
print("Error:", step.get("error"))
|
| 267 |
+
else:
|
| 268 |
+
print("Tool calls:", getattr(step, "tool_calls", None))
|
| 269 |
+
print("Observation:", getattr(step, "observations", None))
|
| 270 |
+
print("Error:", getattr(step, "error", None))
|
| 271 |
|
| 272 |
# Structured output
|
| 273 |
tool_steps = result.steps
|