Spaces:
Sleeping
Sleeping
Update app.py
Browse filesAdded 3 tools, one which is complete.
2 unmodified lines34567891011121314151617181935 unmodified lines555657585960612 unmodified linesimport requestsimport pytzimport yamlfrom tools.final_answer import FinalAnswerToolfrom 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 ?"35 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,2 unmodified lines345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656635 unmodified lines1021031041051061071082 unmodified linesimport requestsimport pytzimport yamlimport email, smtplib, ssl # For Text Messagingfrom tools.final_answer import FinalAnswerToolfrom Gradio_UI import GradioUI@tooldef get_weather(location: str)-> str:"""A tool that fetches the weather.Args:location: A string representing a valid location (e.g., 'San Diego, California', 'New York')"""places = {"New York": {"lon": 40.730610,"lat": -73.935242}"Richmond, Virginia": {"lon": 37.5407,"lat": 77.4360}"San Diego, California": {"lon": 32.7157,"lat": 117.1611}}lon = ""lat = ""for place in places:if place.lower() in location.lower():lon = place['lon']lat = place['lat']try:weather_status = requests.get(f'https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude=currently,minutely,hourly,alert&appid={6969cb0fa02ea908feee8820d3a22689}')return weather_status['daily'][0]['summary']except error:return f"Error fetching weather for {location} passed"@tooldef send_text_message(text: str, phone_number: 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 sends a text message to the intended receiver.Args:argument: the first argumentarg2: the second argument"""return "What magic will you build ?"def get_digital_asset_price(text: str, phone_number: 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 gets the current price of digital assets.Args:argument: the first argumentarg2: the second argument"""return "What magic will you build ?"35 unmodified linesagent = CodeAgent(model=model,tools=[get_current_time_in_timezone, get_weather, send_text_message, get_digital_asset_price, final_answer], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,
app.py+52-5