Spaces:
Runtime error
Runtime error
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool | |
import os | |
from dotenv import load_dotenv | |
load_dotenv() | |
model = InferenceClientModel( token=os.getenv("HF_TOKEN")) # You can choose to not pass any model_id to InferenceClientModel to use a default model | |
# you can also specify a particular provider e.g. provider="together" or provider="sambanova" | |
agent = CodeAgent(tools=[WebSearchTool()], model=model, add_base_tools=True) | |
agent.run( | |
"Could you give me the 118th number in the Fibonacci sequence?", | |
) | |
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 |