Spaces:
Sleeping
Sleeping
| from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool, tool, InferenceClientModel | |
| class QAgent: | |
| def __init__(self): | |
| print("BasicAgent initialized.") | |
| def __call__(self, question: str) -> str: | |
| print(f"Agent received question (first 50 chars): {question[:50]}...") | |
| # provider = "nebius" | |
| model = "Qwen/Qwen2.5-Coder-32B-Instruct" | |
| api_key = SP_HF_TOK | |
| agent = CodeAgent(tools=[DuckDuckGoSearchTool, VisitWebpageTool], | |
| model=InferenceClientModel( | |
| model=model, | |
| # provider=provider, | |
| api_key=api_key), | |
| add_base_tools=True) | |
| fixed_answer = agent.run(question) | |
| print(f"Agent returning fixed answer: {fixed_answer}") | |
| return fixed_answer | |