Spaces:
Runtime error
Runtime error
Add tell a joke tool
Browse files9 unmodified lines1011121313141516171815162017181920212223242526272834 unmodified lines63646561666768699 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 typedef tell_a_joke()-> str: #Keep this format for the description / args / args description but feel free to modify the tool """A tool that does nothing yet Args: arg1: the first argument arg2: the second argument """A tool that tells a joke. """ return "What magic will you build ?" 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 joke else: return "Failed to retrieve joke"
@tooldef get_current_time_in_timezone(timezone: str) -> str:34 unmodified lines agent = 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) 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