from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool, LiteLLModel import datetime import requests import pytz import yaml from tools.final_answer import FinalAnswerTool from Gradio_UI import GradioUI @tool def get_current_time_in_timezone(timezone: str) -> str: """A tool that fetches the current local time in a specified timezone. Args: timezone: A string representing a valid timezone (e.g., 'America/New_York'). """ try: # Create timezone object tz = pytz.timezone(timezone) # Get current time rent local time in {timezone} is: {local_time}" except Exception as e: return f"Error fetching time for timezone '{timezone}': {str(e)}" model = LiteLLModel(model_id = "gpt-4o-mini", api_key="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") agent = CodeAgent( model=model, tools=[DuckDuckGoSearchTool()], ## add your tools here (don't remove final answer) additional_authorized_imports=['math'], ) agent.run( "Calculate how long does it take to drive from Melbourne to Sydney?")