Spaces:
Runtime error
Runtime error
Update app.py
Browse files6 unmodified lines78910111213141516171819202122236 unmodified linesfrom Gradio_UI import GradioUI# 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:"""A tool that fetches the current local time in a specified timezone.6 unmodified lines7891011121314151617181920212223242526272829303132333435363738394041424344454647484950516 unmodified linesfrom Gradio_UI import GradioUI@tooldef game_memory_tool(game: str,event_type: Literal["observation", "decision", "battle", "quest", "inventory", "strategy"],content: str,importance: int) -> str:"""A tool that stores important game memories for an autonomous game-playing agent.Args:game: The name of the game the agent is playing, e.g. "Pokemon Emerald".event_type: The type of memory being saved. Options: observation, decision, battle, quest, inventory, strategy.content: A clear description of what happened or what the agent decided.importance: A number from 1 to 10 showing how important this memory is."""try:if importance < 1 or importance > 10:return "Error: importance must be between 1 and 10."memory = {"game": game,"event_type": event_type,"content": content,"importance": importance,"timestamp": datetime.datetime.now().isoformat()}with open("game_agent_memory.jsonl", "a", encoding="utf-8") as file:file.write(json.dumps(memory, ensure_ascii=False) + "\n")return (f"Memory saved for {game}. "f"Type: {event_type}. "f"Importance: {importance}/10.")except Exception as e:return f"Error saving game memory: {str(e)}"@tooldef get_current_time_in_timezone(timezone: str) -> str:"""A tool that fetches the current local time in a specified timezone.
app.py+35-7