Spaces:
Sleeping
Sleeping
Update app.py
Browse filesADDED: chuck norris quote tool
8 unmodified lines91011121314151617181920212232 unmodified lines555657585960618 unmodified lines# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type#Keep this format for the description / args / args description but feel free to modify the tool"""A tool that does nothing yetArgs:arg1: the first argumentarg2: the second argument"""return "What magic will you build ?"@tooldef get_current_time_in_timezone(timezone: str) -> str:32 unmodified linesagent = CodeAgent(model=model,tools=[final_answer], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,8 unmodified lines9101112131415161718192021222324252627282930313233343536373832 unmodified lines717273747576778 unmodified lines# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef chuck_norris_quotes(category:str)-> str: #it's import to specify the return type#Keep this format for the description / args / args description but feel free to modify the tool"""A tool that fetches a random Chuck Norris quote belonging to a category provided as argument. If the category does not exist, a random quote is returned.Args:category: One of the categories provided by the API: "animal", "career", "celebrity", "dev", "explicit", "fashion", "food", "history", "money", "movie", "music", "political", "religion", "science", "sport", "travel""""cats = ["animal", "career", "celebrity", "dev", "explicit", "fashion", "food", "history", "money","movie", "music", "political", "religion", "science", "sport", "travel"]if category in cats:api_url = f"https://api.chucknorris.io/jokes/random?category={category}"else:api_url = f"https://api.chucknorris.io/jokes/random"response = requests.get(api_url)if response.status_code == 200:data = response.json()answer = data.get("value", "No quote is available.")else:answer "Error: Unable to fetch quote."return answer@tooldef get_current_time_in_timezone(timezone: str) -> str:32 unmodified linesagent = CodeAgent(model=model,tools=[final_answer, chuck_norris_quotes, image_generation_tool], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,
app.py+22-6