Spaces:
Sleeping
Sleeping
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -1,34 +1,51 @@
|
|
| 1 |
-
from
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
import time
|
| 5 |
-
import datetime
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
tools=[
|
| 10 |
-
DuckDuckGoSearchTool(),
|
| 11 |
VisitWebpageTool(),
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
| 13 |
],
|
| 14 |
-
model=InferenceClientModel(),
|
| 15 |
-
name="web_agent",
|
| 16 |
-
description="Brows the web to find information",
|
| 17 |
max_steps=10,
|
| 18 |
-
verbosity_level=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
)
|
| 20 |
|
| 21 |
-
manager_agent = CodeAgent(
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
planning_intervals=5,
|
| 31 |
-
verbosity_level=2,
|
| 32 |
-
max_steps=15,
|
| 33 |
-
)
|
|
|
|
| 34 |
|
|
|
|
| 1 |
+
from smolagents import CodeAgent, HfApiModel
|
| 2 |
+
from smolagents import VisitWebpageTool, WebSearchTool, WikipediaSearchTool, FinalAnswerTool
|
| 3 |
+
from calculator_tool import CalculatorTool
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
|
| 6 |
+
model = HfApiModel(
|
| 7 |
+
max_token = 2096,
|
| 8 |
+
temperature = 0.5,
|
| 9 |
+
model_id = 'https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
|
| 10 |
+
custom_role_conversations=None
|
| 11 |
+
)
|
| 12 |
+
#or
|
| 13 |
+
#model=InferenceClientModel(model_id="Qwen/Qwen2.5-Coder-32B-Instruct", provider="together")
|
| 14 |
+
|
| 15 |
+
#with open("prompts.yaml", 'r') as stream:
|
| 16 |
+
# prompt_templates = yaml.safe_load(stream)
|
| 17 |
+
|
| 18 |
+
#Creating the agent
|
| 19 |
+
agent = CodeAgent(
|
| 20 |
+
model=model,
|
| 21 |
tools=[
|
|
|
|
| 22 |
VisitWebpageTool(),
|
| 23 |
+
WebSearchTool(),
|
| 24 |
+
WikipediaSearchTool(),
|
| 25 |
+
CalculatorTool(),
|
| 26 |
+
FinalAnswerTool(),
|
| 27 |
],
|
|
|
|
|
|
|
|
|
|
| 28 |
max_steps=10,
|
| 29 |
+
verbosity_level = 1, #or other parameter
|
| 30 |
+
grammar = None,
|
| 31 |
+
planning_interval=None,
|
| 32 |
+
#name="web_agent",
|
| 33 |
+
#description="Brows the web to find information",
|
| 34 |
+
#additional_autorized_imports = ["pandas"],
|
| 35 |
)
|
| 36 |
|
| 37 |
+
#manager_agent = CodeAgent(
|
| 38 |
+
# model=InferenceClientModel("deepseek-ai/DeepSeek-R1", provider="together", max_tokens=8096),
|
| 39 |
+
# managed_agent=[web_agent],
|
| 40 |
+
# additional_authorized_imports=[
|
| 41 |
+
# "datetime",
|
| 42 |
+
# "pandas",
|
| 43 |
+
# "numpy",
|
| 44 |
+
# "json"
|
| 45 |
+
# ],
|
| 46 |
+
#planning_intervals=5,
|
| 47 |
+
#verbosity_level=2,
|
| 48 |
+
#max_steps=15,
|
| 49 |
+
#)
|
| 50 |
+
|
| 51 |
|