Spaces:
Sleeping
Sleeping
Joachim M. Vis commited on
Upload graph.py
Browse files- agent/graph.py +12 -0
agent/graph.py
CHANGED
|
@@ -467,6 +467,18 @@ def execute_tool(state: AgentState) -> AgentState:
|
|
| 467 |
extractor = create_web_content_extractor()
|
| 468 |
result = extractor.extract_content(url)
|
| 469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
else:
|
| 471 |
# Fallback to simulated result for unknown tools
|
| 472 |
result = f"Simulated result for {tool_name} with input {tool_input}"
|
|
|
|
| 467 |
extractor = create_web_content_extractor()
|
| 468 |
result = extractor.extract_content(url)
|
| 469 |
|
| 470 |
+
elif tool_name == "youtube_video":
|
| 471 |
+
video_id_or_url = tool_input.get("video_id_or_url")
|
| 472 |
+
language = tool_input.get("language")
|
| 473 |
+
if not video_id_or_url:
|
| 474 |
+
raise ValueError("Video ID or URL is required for YouTube video analysis")
|
| 475 |
+
|
| 476 |
+
tool = registry.get_tool("youtube_video")
|
| 477 |
+
if not tool:
|
| 478 |
+
raise ValueError("YouTube tool not found")
|
| 479 |
+
|
| 480 |
+
result = registry.execute_tool("youtube_video", video_id_or_url=video_id_or_url, language=language)
|
| 481 |
+
|
| 482 |
else:
|
| 483 |
# Fallback to simulated result for unknown tools
|
| 484 |
result = f"Simulated result for {tool_name} with input {tool_input}"
|