File size: 996 Bytes
e401df7
 
 
 
 
 
ec642b7
 
 
 
 
 
 
e401df7
 
 
 
 
 
 
 
 
 
 
ec642b7
e401df7
ec642b7
e401df7
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
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)