Spaces:
Sleeping
Sleeping
| import os | |
| from PIL import Image | |
| from smolagents import CodeAgent, HfApiModel, InferenceClientModel | |
| import tools.tools as tls | |
| # --- Basic Agent Definition --- | |
| # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------ | |
| class BasicAgent: | |
| def __init__(self): | |
| print("BasicAgent initialized.") | |
| def __call__(self, question: str) -> str: | |
| model = HfApiModel(model_id="https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud", provider="together", use_auth_token=True) | |
| agent = CodeAgent( | |
| tools=[tls.search_tool, tls.calculate_cargo_travel_time], | |
| model=InferenceClientModel(), | |
| additional_authorized_imports=["pandas"], | |
| max_steps=20, | |
| ) | |
| fixed_answer = agent.run(question) | |
| 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 str(fixed_answer) |