File size: 2,212 Bytes
140bc8d
 
7899abd
d50799a
 
6ae86e3
3c27da6
140bc8d
6ae86e3
3c27da6
 
 
 
 
 
 
 
6ae86e3
 
 
 
 
 
 
3c27da6
dd8d8c2
 
 
3c27da6
 
dd8d8c2
 
 
 
 
 
 
 
 
 
3c27da6
dd8d8c2
3c27da6
dd8d8c2
7899abd
dd8d8c2
3c27da6
dd8d8c2
3c27da6
 
 
 
dd8d8c2
3c27da6
 
 
 
7899abd
140bc8d
 
e9d68cc
dd8d8c2
3c27da6
 
140bc8d
4ffd51c
dd8d8c2
140bc8d
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from smolagents import (
    CodeAgent,
    ToolCallingAgent,
    #InferenceClientModel,
    #WebSearchTool,
    OpenAIServerModel,
    LiteLLMModel,
)
import os
import wikipedia
import time
import numpy
import pandas
import xlrd
import markdownify
import requests
from tools import python_wikipedia_tools, smolagents_code_tools, smolagents_web_tools, smolagents_speech_tools
#model = InferenceClientModel(
#            max_tokens=2096,
#            temperature=0.5,
#            model_id='Qwen/Qwen2.5-Coder-32B-Instruct',
#            custom_role_conversions=None,
#        )

#model = OpenAIServerModel(
#    model_id="gemini-2.0-flash",
#    api_base="https://generativelanguage.googleapis.com/v1beta/openai/",
#    api_key=os.getenv("GEMINI_API_KEY"),
#)

# to run locally
model_gemma = LiteLLMModel(
    model_id="ollama/gemma3:27b",
    api_base="http://localhost:11434",
)
model_devstral = LiteLLMModel(
    model_id="ollama/devstral:latest",
    api_base="http://localhost:11434",
)


web_search_agent = ToolCallingAgent(
    tools=smolagents_web_tools,
    model=model_gemma,
    max_steps=10,
    #additional_authorized_imports=["wikipedia", "markdownify", "requests"],
    name="web_search_agent",
    description="A tool calling agent which can perform web searches. It has available tools including GoogleSearchTool, VisitWebpageTool and WikipediaSearchTool",
)

code_agent = CodeAgent(
    tools=smolagents_code_tools + python_wikipedia_tools,
    model=model_gemma,
    max_steps=10,
    additional_authorized_imports=["time", "numpy", "pandas", "wikipedia", "xlrd", "markdownify", "requests"],
    name="code_agent",
    description="A code agent which can write and interpret code. It has available tools including PythonInterpreterTool, search_wikipedia_page, get_wikipedia_page and get_wikipedia_summary",
)

manager_agent = CodeAgent(
    tools=[],
    model=model_gemma,
    managed_agents=[web_search_agent, code_agent],
    max_steps=10,
    verbosity_level=1,
    name="manager_agent",
    description="Manages the web_search_agent and code_agent. Can perform web searches with the ToolCallingAgent called web_search_agent. Can use the CodeAgent called code_agent to run pythin code.",
)