File size: 2,024 Bytes
066fbc2
9b5b26a
2bc2afe
2d2af9d
9b5b26a
 
066fbc2
 
 
9b5b26a
066fbc2
 
 
 
 
9b5b26a
066fbc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2bc2afe
066fbc2
 
 
 
 
 
 
 
 
 
 
 
 
 
2bc2afe
 
 
 
 
 
 
 
 
066fbc2
 
 
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
58
59
60
61
62
63
from smolagents import CodeAgent, DuckDuckGoSearchTool, LiteLLMModel, OpenAIServerModel, tool
import datetime
from superhero_party_theme_tool import SuperheroPartyThemeTool
from model import model

@tool
def suggest_menu(occasion: str) -> str:
    """
    Suggests a menu based on the occasion.
    Args:
        occasion: The type of occasion for the party. Allowed values are:
                  - "casual": Menu for casual party.
                  - "formal": Menu for formal party.
                  - "superhero": Menu for superhero party.
                  - "custom": Custom menu.
    """
    if occasion == "casual":
        return "Pizza, snacks, and drinks."
    elif occasion == "formal":
        return "3-course dinner with wine and dessert."
    elif occasion == "superhero":
        return "Buffet with high-energy and healthy food."
    else:
        return "Custom menu for the butler."


def main_v1() -> None:
    # Example 1: search the web for a party playlist
    music_agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
    music_agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")

    # Example 2: use the custom menu tool
    menu_agent = CodeAgent(tools=[suggest_menu], model=model)
    menu_agent.run("Prepare a formal menu for the party.")

def main_v2() -> None:
    agent = CodeAgent(tools=[], model=model, additional_authorized_imports=['datetime'])

    agent.run(
        """
        Alfred needs to prepare for the party. Here are the tasks:
        1. Prepare the drinks - 30 minutes
        2. Decorate the mansion - 60 minutes
        3. Set up the menu - 45 minutes
        4. Prepare the music and playlist - 45 minutes

        If we start right now, at what time will the party be ready?
        """
    )

def main() -> None:
    agent = CodeAgent(tools=[SuperheroPartyThemeTool()], model=model)

    agent.run(
        """
        whats the theme for classic heroes party
        """
    )


if __name__ == "__main__":
    main()