Spaces:
Sleeping
Sleeping
Fix: Add missing get_tools and create_tools_registry functions
Browse files
src/gaia/agent/tool_registry.py
CHANGED
|
@@ -256,6 +256,99 @@ def create_default_registry() -> ToolRegistry:
|
|
| 256 |
logger.info(f"Created default tool registry with {len(registry.list_tools())} tools")
|
| 257 |
return registry
|
| 258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
def resolve_question_type(question: str) -> str:
|
| 260 |
"""
|
| 261 |
Determine the type of question.
|
|
|
|
| 256 |
logger.info(f"Created default tool registry with {len(registry.list_tools())} tools")
|
| 257 |
return registry
|
| 258 |
|
| 259 |
+
# Create alias for create_default_registry to match import in agent_enhanced.py
|
| 260 |
+
create_tools_registry = create_default_registry
|
| 261 |
+
|
| 262 |
+
def get_tools() -> List[Dict[str, Any]]:
|
| 263 |
+
"""
|
| 264 |
+
Get a list of available tools with their metadata.
|
| 265 |
+
|
| 266 |
+
This function is used by the enhanced agent to determine which tools
|
| 267 |
+
are available for use.
|
| 268 |
+
|
| 269 |
+
Returns:
|
| 270 |
+
List of dictionaries containing tool metadata
|
| 271 |
+
"""
|
| 272 |
+
tools = []
|
| 273 |
+
|
| 274 |
+
# Web search tools
|
| 275 |
+
tools.append({
|
| 276 |
+
"name": "duckduckgo_search",
|
| 277 |
+
"description": "Search the web using DuckDuckGo",
|
| 278 |
+
"parameters": ["query"],
|
| 279 |
+
"category": "search"
|
| 280 |
+
})
|
| 281 |
+
|
| 282 |
+
tools.append({
|
| 283 |
+
"name": "serper_search",
|
| 284 |
+
"description": "Search the web using Google via Serper API",
|
| 285 |
+
"parameters": ["query"],
|
| 286 |
+
"category": "search",
|
| 287 |
+
"requires_api_key": True
|
| 288 |
+
})
|
| 289 |
+
|
| 290 |
+
tools.append({
|
| 291 |
+
"name": "wikipedia_search",
|
| 292 |
+
"description": "Search Wikipedia for information",
|
| 293 |
+
"parameters": ["query"],
|
| 294 |
+
"category": "search"
|
| 295 |
+
})
|
| 296 |
+
|
| 297 |
+
tools.append({
|
| 298 |
+
"name": "perplexity_search",
|
| 299 |
+
"description": "Search using Perplexity AI",
|
| 300 |
+
"parameters": ["query"],
|
| 301 |
+
"category": "search",
|
| 302 |
+
"requires_api_key": True
|
| 303 |
+
})
|
| 304 |
+
|
| 305 |
+
# Video tools
|
| 306 |
+
tools.append({
|
| 307 |
+
"name": "youtube_video",
|
| 308 |
+
"description": "Analyze YouTube videos and extract information",
|
| 309 |
+
"parameters": ["video_id_or_url", "language"],
|
| 310 |
+
"category": "multimedia"
|
| 311 |
+
})
|
| 312 |
+
|
| 313 |
+
# Research tools
|
| 314 |
+
tools.append({
|
| 315 |
+
"name": "arxiv_search",
|
| 316 |
+
"description": "Search arXiv for research papers",
|
| 317 |
+
"parameters": ["query", "max_results"],
|
| 318 |
+
"category": "research"
|
| 319 |
+
})
|
| 320 |
+
|
| 321 |
+
tools.append({
|
| 322 |
+
"name": "arxiv_get_paper",
|
| 323 |
+
"description": "Get a specific paper from arXiv by ID",
|
| 324 |
+
"parameters": ["paper_id"],
|
| 325 |
+
"category": "research"
|
| 326 |
+
})
|
| 327 |
+
|
| 328 |
+
# Meta tools
|
| 329 |
+
tools.append({
|
| 330 |
+
"name": "enhanced_web_search",
|
| 331 |
+
"description": "Enhanced web search that combines multiple search engines",
|
| 332 |
+
"parameters": ["query"],
|
| 333 |
+
"category": "meta"
|
| 334 |
+
})
|
| 335 |
+
|
| 336 |
+
tools.append({
|
| 337 |
+
"name": "library_search",
|
| 338 |
+
"description": "Search across multiple knowledge sources",
|
| 339 |
+
"parameters": ["query"],
|
| 340 |
+
"category": "meta"
|
| 341 |
+
})
|
| 342 |
+
|
| 343 |
+
tools.append({
|
| 344 |
+
"name": "api_search",
|
| 345 |
+
"description": "Search using available API-based tools",
|
| 346 |
+
"parameters": ["query"],
|
| 347 |
+
"category": "meta"
|
| 348 |
+
})
|
| 349 |
+
|
| 350 |
+
return tools
|
| 351 |
+
|
| 352 |
def resolve_question_type(question: str) -> str:
|
| 353 |
"""
|
| 354 |
Determine the type of question.
|