| import os |
| from smolagents import ( |
| CodeAgent, InferenceClientModel, HfApiModel, |
| DuckDuckGoSearchTool, LiteLLMModel |
| ) |
| from tools import audio_transcription_tool, yt_video_transcription_tool, image_understanding_tool |
|
|
| class MyAgent(CodeAgent): |
| """ |
| Custom agent class that extends CodeAgent. |
| """ |
| |
| tools = [ |
| DuckDuckGoSearchTool(), |
| audio_transcription_tool, |
| yt_video_transcription_tool, |
| image_understanding_tool |
| ] |
| api_key = os.getenv("GROQ_API_KEY", "") |
| model = LiteLLMModel( |
| model_id="groq/llama-3.3-70b-versatile", |
| api_key=api_key |
| ) |
|
|
| def __init__(self, *args, **kwargs) -> None: |
| super().__init__( |
| tools=self.tools, |
| model=self.model, |
| additional_authorized_imports=[ |
| "markdownify", |
| "requests", |
| "pandas", |
| "io", |
| ], |
| name="MyAgent", |
| description = "A custom agent that can search the web and generate code.", |
| add_base_tools=True, |
| max_steps=30, |
| ) |
|
|
|
|