CoralLeiCN
commited on
Commit
·
ba1bd1e
1
Parent(s):
eed2d7f
Add chess_move tool and update imports in agents and tools modules
Browse files- agent/agents.py +2 -0
- agent/tools.py +9 -1
agent/agents.py
CHANGED
@@ -15,6 +15,7 @@ from agent.tools import (
|
|
15 |
TranscribeYoutubeVideo,
|
16 |
UnderstandImageBytes,
|
17 |
WikipediaSearchTool,
|
|
|
18 |
)
|
19 |
from agent.utils import gemini_client, gemini_model_liteLLM
|
20 |
|
@@ -79,6 +80,7 @@ class BasicAgent:
|
|
79 |
understand_image_bytes,
|
80 |
code_execution_tool,
|
81 |
wiki_retriever,
|
|
|
82 |
],
|
83 |
model=model,
|
84 |
additional_authorized_imports=["pandas"],
|
|
|
15 |
TranscribeYoutubeVideo,
|
16 |
UnderstandImageBytes,
|
17 |
WikipediaSearchTool,
|
18 |
+
chess_move,
|
19 |
)
|
20 |
from agent.utils import gemini_client, gemini_model_liteLLM
|
21 |
|
|
|
80 |
understand_image_bytes,
|
81 |
code_execution_tool,
|
82 |
wiki_retriever,
|
83 |
+
chess_move,
|
84 |
],
|
85 |
model=model,
|
86 |
additional_authorized_imports=["pandas"],
|
agent/tools.py
CHANGED
@@ -8,6 +8,14 @@ from markdownify import markdownify as md
|
|
8 |
from PIL import Image
|
9 |
from smolagents import Tool
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
class WikipediaSearchTool(Tool):
|
13 |
name = "wikipedia_search"
|
@@ -107,7 +115,7 @@ class UnderstandImageBytes(Tool):
|
|
107 |
prompt = "Analyze this image and provide a description of its content."
|
108 |
|
109 |
response = client.models.generate_content(
|
110 |
-
model="gemini-2.5-
|
111 |
contents=[
|
112 |
f"{prompt} And answer the question accurately based on the visual information in the image. question: {question} ",
|
113 |
types.Part.from_bytes(
|
|
|
8 |
from PIL import Image
|
9 |
from smolagents import Tool
|
10 |
|
11 |
+
from smolagents import Tool
|
12 |
+
|
13 |
+
chess_move = Tool.from_space(
|
14 |
+
"Agents-MCP-Hackathon/chess-mcp-server",
|
15 |
+
name="chess_server",
|
16 |
+
description="Find the best move for chess",
|
17 |
+
api_name="/predict_2" # top moves
|
18 |
+
)
|
19 |
|
20 |
class WikipediaSearchTool(Tool):
|
21 |
name = "wikipedia_search"
|
|
|
115 |
prompt = "Analyze this image and provide a description of its content."
|
116 |
|
117 |
response = client.models.generate_content(
|
118 |
+
model="gemini-2.5-pro",
|
119 |
contents=[
|
120 |
f"{prompt} And answer the question accurately based on the visual information in the image. question: {question} ",
|
121 |
types.Part.from_bytes(
|