Spaces:
Runtime error
Runtime error
Download agent.py from rdisipio/agents-course-final-assignment: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/spaces/rdisipio/agents-course-final-assignment/resolve/main/agent.py
- Command line
-
hf download hf://spaces/rdisipio/agents-course-final-assignment/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/rdisipio/agents-course-final-assignment/resolve/main/agent.py
1.14 kB
| 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, | |
| ) | |