Spaces:
Sleeping
Sleeping
added get_current_time_in_timezone tool
Browse files32 unmodified lines33343536373816 unmodified lines5556575859606132 unmodified linesexcept Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"final_answer = FinalAnswerTool()16 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,32 unmodified lines33343536373839404142434445464748495051525354555616 unmodified lines7374757677787932 unmodified linesexcept Exception as e:return f"Error fetching time for timezone '{timezone}': {str(e)}"@tooldef get_sunrise_sunset(lat: float, lon: float) -> str:"""Fetches the sunrise and sunset times for a given latitude and longitude.Args:lat: Latitude of the location.lon: Longitude of the location."""url = f"https://api.open-meteo.com/v1/forecast?latitude={lat}&longitude={lon}&daily=sunrise,sunset&timezone=auto"try:response = requests.get(url)data = response.json()sunrise = data["daily"]["sunrise"][0]sunset = data["daily"]["sunset"][0]return f"Sunrise: {sunrise}, Sunset: {sunset}"except Exception as e:return f"Error fetching sunrise/sunset data: {str(e)}"final_answer = FinalAnswerTool()16 unmodified linesagent = CodeAgent(model=model,tools=[final_answer, get_current_time_in_timezone], ## add your tools here (don't remove final answer)max_steps=6,verbosity_level=1,grammar=None,
app.py+19-1