File size: 1,360 Bytes
ce38146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from smolagents import CodeAgent,Tool,InferenceClientModel
class SuperheroPartyThemeTool(Tool):
    name="Superhero_Party_Theme_generator"
    description="""
        This tool suggests creative superhero-themed party idea based on a category. 
        it returns a unique party theme idea.
    """
    inputs={
        "category":{
            "type":"string",
            'description':"The type of superhero party (e.g.,'classic heroes','villain masquerade','futuristic gotham')."
        }
    }
    output_type="string"
    def forward(self,category:str):
        themes = {
            "classic heroes": "Justice League Gala: Guests come dressed as their favorite DC heroes with themed cocktails like 'The Kryptonite Punch'.",
            "villain masquerade": "Gotham Rogues' Ball: A mysterious masquerade where guests dress as classic Batman villains.",
            "futuristic Gotham": "Neo-Gotham Night: A cyberpunk-style party inspired by Batman Beyond, with neon decorations and futuristic gadgets."
        }
        return themes.get(category.lower(),"Themed party idea not found .Try 'classic heroes','villain masquerade','futuristic gotham'")
    
tool=SuperheroPartyThemeTool()
agent=CodeAgent(tools=[tool],model=InferenceClientModel())
result=agent.run("What would be a good superhero party idea for a villain masquerade theme")
print(result)