File size: 961 Bytes
fd74f5b
 
 
bc55585
fd74f5b
 
bc55585
fd74f5b
 
 
 
 
 
 
 
 
 
 
 
 
bc55585
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from smolagents import LiteLLMModel, CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool
import os
from smolagents import tool
from pathlib import Path

@tool
def audio_to_text(path: Path) -> str:
    """
    This tool returns the transcription of an audio file.
    Args:
        path: file path of audio file to transcribe.
    """
    import whisper
    whisper_model=whisper.load_model("turbo")
    transcription = whisper_model.transcribe(path)
    return transcription

gemini_api_key = os.environ["GOOGLE_API_KEY"]
model = LiteLLMModel(model_id = "gemini/gemini-2.0-flash", api_key=gemini_api_key) 
web_agent = CodeAgent(name="web_agent", description="Agent to search/browse the web", model=model, tools=[VisitWebpageTool(), DuckDuckGoSearchTool()], additional_authorized_imports=["beautifulsoup"])
agent = CodeAgent(model=model, tools=[audio_to_text], managed_agents=[web_agent], additional_authorized_imports=["pandas","PIL", "bs4"], planning_interval=5)