File size: 1,135 Bytes
32ca30b 4074e23 9e81a16 32ca30b 4074e23 853e1cc 4074e23 32ca30b c976d46 32ca30b c976d46 853e1cc 32ca30b 853e1cc 32ca30b 853e1cc 32ca30b 853e1cc c976d46 32ca30b c976d46 | 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 | 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,
)
|