Download agent.py from Schweig/Agents_Final_Assignment_Template: direct link, hf CLI and curl.
- Browser
- Download file 793 Bytes
-
https://huggingface.co/spaces/Schweig/Agents_Final_Assignment_Template/resolve/main/agent.py
- Command line
-
hf download hf://spaces/Schweig/Agents_Final_Assignment_Template/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/Schweig/Agents_Final_Assignment_Template/resolve/main/agent.py
793 Bytes
| from smolagents import CodeAgent, WebSearchTool, LiteLLMModel | |
| class BasicAgent: | |
| def __init__(self): | |
| print("BasicAgent initialized.") | |
| def __call__(self, question: str) -> str: | |
| print(f"Agent received question (first 50 chars): {question[:50]}...") | |
| fixed_answer = "This is a default answer." | |
| print(f"Agent returning fixed answer: {fixed_answer}") | |
| return fixed_answer | |
| class GAIAAgent(BasicAgent): | |
| def __init__(self): | |
| model = LiteLLMModel(model_id="openrouter/meta-llama/llama-3-8b-instruct:free", requests_per_minute=60) | |
| self.agent = CodeAgent(tools=[WebSearchTool()],model=model,planning_interval=3) | |
| print("GAIA Agent Initialized") | |
| def __call__(self, question): | |
| return self.agent.run(question) |