-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathsmol_multiagent.py
44 lines (36 loc) · 1.08 KB
/
smol_multiagent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import re
from smolagents import (
CodeAgent,
ToolCallingAgent,
HfApiModel,
ManagedAgent,
DuckDuckGoSearchTool,
LiteLLMModel,
tool
)
from smoltools.jinaai import scrape_page_with_jina_ai, search_facts_with_jina_ai
import os
from dotenv import load_dotenv
load_dotenv()
# model = HfApiModel()
model = LiteLLMModel(model_id="gpt-4o-mini")
# model = LiteLLMModel(model_id="gemini/gemini-2.0-flash-exp")
web_agent = ToolCallingAgent(
tools=[DuckDuckGoSearchTool(), scrape_page_with_jina_ai],
model=model,
max_steps=10,
)
managed_web_agent = ManagedAgent(
agent=web_agent,
name="search",
description="Runs web searches for you. Give it your query as an argument.",
)
manager_agent = CodeAgent(
tools=[],
model=model,
managed_agents=[managed_web_agent],
additional_authorized_imports=["time", "numpy", "pandas"],
)
# answer = manager_agent.run("What year was the movie 'Rebel Without a Cause' released and who was the star of it?")
answer = manager_agent.run("What movie was released in 1955 that stars James Dean and what is it's Rotten Tomatoes score?")
print(answer)