Spaces:
Sleeping
Sleeping
File size: 841 Bytes
9ca7ada e5ab152 7fca18f 9ca7ada 39c3b20 7fca18f 9ca7ada 7fca18f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import os
from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool, Tool, tool, InferenceClientModel
class QAgent(Tool):
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 = os.environ.get('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
|