Spaces:
Runtime error
Runtime error
Add tell a joke tool
Browse files9 unmodified lines101112131415161718192021222334 unmodified lines585960616263649 unmodified lines# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_cutom_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:34 unmodified linesagent = CodeAgent(model=model,tools=[final_answer, image_generation_tool, web_search_tool, get_current_time_in_timezone], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,9 unmodified lines1011121314151617181920212223242526272834 unmodified lines636465666768699 unmodified lines# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef tell_a_joke()-> str:#Keep this format for the description / args / args description but feel free to modify the tool"""A tool that tells a joke."""url = "https://v2.jokeapi.dev/joke/Programming,Misc?format=json&blacklistFlags=nsfw,sexist,racist,explicit&type=single&lang=en&amount=1"response = requests.get(url)if response.status_code == 200:data = response.json()joke = data.get("joke", "No joke found")return jokeelse:return "Failed to retrieve joke"@tooldef get_current_time_in_timezone(timezone: str) -> str:34 unmodified linesagent = CodeAgent(model=model,tools=[final_answer, image_generation_tool, web_search_tool, get_current_time_in_timezone, tell_a_joke], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,
app.py+12-7