Update app.py
#540
by mkmaurya - opened
15 unmodified lines161718192021222 unmodified lines25262728293031323321 unmodified lines55565758596061626364656667686915 unmodified linesarg1: the first argumentarg2: the second argument"""return "What magic will you build ?"@tooldef get_current_time_in_timezone(timezone: str) -> str:2 unmodified linestimezone: A string representing a valid timezone (e.g., 'America/New_York')."""try:# Create timezone objecttz = pytz.timezone(timezone)# Get current time in that timezonelocal_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")return f"The current local time in {timezone} is: {local_time}"except Exception as e:21 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,planning_interval=None,name=None,description=None,prompt_templates=prompt_templates)GradioUI(agent).launch()15 unmodified lines16171819202122232 unmodified lines2627282930313221 unmodified lines5455565758596061626364656667686970717273747515 unmodified linesarg1: the first argumentarg2: the second argument"""return f"Custom tool received arg1='{arg1}' and arg2={arg2}. What magic will you build?"@tooldef get_current_time_in_timezone(timezone: str) -> str:2 unmodified linestimezone: A string representing a valid timezone (e.g., 'America/New_York')."""try:tz = pytz.timezone(timezone)local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")return f"The current local time in {timezone} is: {local_time}"except Exception as e:21 unmodified linesagent = CodeAgent(model=model,tools=[final_answer,my_custom_tool,get_current_time_in_timezone,image_generation_tool,DuckDuckGoSearchTool() # added useful web search tool],max_steps=6,verbosity_level=1,grammar=None,planning_interval=None,name="EnhancedCodeAgent",description="An agent capable of answering, searching, generating images, and fetching time info.",prompt_templates=prompt_templates)GradioUI(agent).launch()
app.py+12-6