Spaces:
Sleeping
Sleeping
File size: 830 Bytes
af10fd2 b216a70 af10fd2 7626150 af10fd2 |
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 |
from smolagents import DuckDuckGoSearchTool, CodeAgent, HfApiModel
import os
import yaml
class BasicAgent:
def __init__(self):
print("BasicAgent initialized.")
def __call__(self, question: str) -> str:
print(f"Agent received question (first 50 chars): {question[:50]}...")
with open("prompts.yaml", 'r') as stream:
prompt_templates = yaml.safe_load(stream)
model = HfApiModel(model_id="Qwen/Qwen3-235B-A22B")
search_tool = DuckDuckGoSearchTool()
agent = CodeAgent(
tools=[search_tool],
model=model,
add_base_tools = True,
prompt_templates=prompt_templates
)
fixed_answer = agent.run(question)
print(f"Agent returning fixed answer: {fixed_answer}")
return fixed_answer
|