Spaces:
Runtime error
Runtime error
Update app.py
Browse files173 unmodified lines174175176177177178179180181182183184184185186187188187188189190191192193194189190191192193194195196197198199173 unmodified lines categories: str = "Any", lang: str = "en", blacklistFlags: str | None = None, safe_mode: bool = False, safe_mode: bool = True, type: str | None = None, contains: str | None = None, idRange: str | None = None, amount: int = 1): """ Fetches jokes from JokeAPI (https://sv443.net/jokeapi/v2/). Use this tool to get jokes for the user. Fetches jokes from JokeAPI. Use this tool when the user asks for a joke.
**IMPORTANT:** For simple requests like "tell me a joke", you do not need to specify any parameters. The function will automatically fetch a safe, general joke by default.
Args: categories (str): The category of the joke. It MUST be a string containing one or more of the following values, separated by commas: 'Any', 'Programming', 'Misc', 'Pun', 'Dark', 'Spooky', 'Christmas'. If the user asks for a category not in this list, you MUST default to 'Any'. Example: If the user asks for a 'spooky christmas joke', you should pass 'Spooky,Christmas'. lang (str): The language code for the joke. Defaults to 'en'. It MUST be an ISO 639-1 code. For example, use 'pt' for Portuguese, 'es' for Spanish, and 'de' for German. blacklistFlags (str | None): A comma-separated string of flags to exclude certain types of jokes. The valid flags are: 'nsfw', 'religious', 'political', 'racist', 'sexist', 'explicit'. For example, to exclude nsfw and religious jokes, you would pass 'nsfw,religious'. safe_mode (bool): A boolean to filter for only 'safe' jokes. Set to True to enable. This is a very restrictive filter. type (str | None): The type of joke. It can be either 'single' for a one-part joke, or 'twopart' for a joke with a setup and a delivery. contains (str | None): A case-insensitive string. The fetched joke(s) MUST contain this string in their body. idRange (str | None): A string representing a specific ID or a range of IDs for jokes. Example: '142' or '0-100'. amount (int): An integer representing the number of jokes to fetch. The value must be between 1 and 10. categories (str): The category of the joke. ONLY use this if the user explicitly asks for a specific category. It MUST be a string from: 'Any', 'Programming', 'Misc', 'Pun', 'Dark', 'Spooky', 'Christmas'. If the user's category isn't in this list, default to 'Any'. lang (str): The language code for the joke (e.g., 'pt' for Portuguese). Only use if the user requests a language other than English. blacklistFlags (str | None): A comma-separated string of flags to exclude certain joke types: 'nsfw', 'religious', 'political', 'racist', 'sexist', 'explicit'. Only use if the user makes a specific exclusion request. safe_mode (bool): Defaults to True. Set to False only if the user explicitly asks for potentially unsafe jokes. type (str | None): Can be 'single' or 'twopart'. Only use if the user specifies a preference for a one-liner or a setup/delivery joke. contains (str | None): A string that MUST be present in the joke. Only use if the user asks for a joke containing a specific word. idRange (str | None): A specific ID or a range of IDs for jokes. Do not use unless specifically requested. amount (int): The number of jokes to fetch (1-10). Only change this if the user asks for more than one joke. Returns: A list of jokes. Each joke is either a string (for single-part jokes) or a dictionary with "setup" and "delivery" keys (for two-part jokes). """app.py+12-10