File size: 2,228 Bytes
46685d0
0dd2166
 
ad46931
 
0f3e559
06f7039
 
 
0f3e559
 
81ddd7a
0f3e559
 
46685d0
0f3e559
 
 
 
2e26d27
0f3e559
4b15d8b
0f3e559
 
 
e141c38
 
 
 
 
 
 
 
 
 
 
 
 
 
0f3e559
 
 
0dd2166
 
ad46931
 
06f7039
 
2e26d27
0dd2166
0f3e559
 
2e26d27
 
0f3e559
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from smolagents import CodeAgent, LiteLLMModel
from tools.mood_to_need import MoodToNeedTool, claude_mood_to_need_model
from tools.need_to_destination import NeedToDestinationTool, claude_need_to_destination_model
from tools.weather_tool import WeatherTool
from tools.find_flight import FlightsFinderTool
from tools.final_answer import FinalAnswerTool
from tools.country_info_tool import CountryInfoTool
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
from smolagents import MultiStepAgent, ActionStep, AgentText, AgentImage, AgentAudio, handle_agent_output_types
from Gradio_UI import GradioUI
import yaml
# from tools.mock_tools import MoodToNeedTool, NeedToDestinationTool, WeatherTool, FlightsFinderTool, FinalAnswerTool

# Initialize Claude model via Hugging Face
model = LiteLLMModel(
    model_id="claude-3-opus-20240229",
    temperature=0.7,
    max_tokens=2048
)

# Load prompt templates
with open("prompts.yaml", "r") as f:
    prompt_templates = yaml.safe_load(f)

# Define the agent with all tools
# agent = CodeAgent(
#     model=model,
#     tools=[
#         MoodToNeedTool(),          # Step 1: Mood β†’ Need
#         NeedToDestinationTool(),   # Step 2: Need β†’ Destination
#         WeatherTool(),             # Step 3: Weather for destination
#         FlightsFinderTool(),       # Step 4: Destination β†’ Flights           # Step 5: Claude wrap
#         FinalAnswerTool()       # Required final output
#     ],
#     max_steps=6,
#     verbosity_level=1,
#     prompt_templates=prompt_templates
# )

agent = CodeAgent(
    model=model,
    tools=[
        MoodToNeedTool(model=claude_mood_to_need_model),          # Step 1: Mood β†’ Need
        NeedToDestinationTool(model=claude_need_to_destination_model),   # Step 2: Need β†’ Destination
        WeatherTool(),             # Step 3: Weather for destination
        FlightsFinderTool(),       # Step 4: Destination β†’ Flights           # Step 5: Claude wrap
        FinalAnswerTool(),      # Required final output
        CountryInfoTool()           # Step 6: Country info
    ],
    max_steps=10,
    verbosity_level=1,
    prompt_templates=prompt_templates
)

# Launch the Gradio interface
GradioUI(agent).launch()