Update app.py
#540
by mkmaurya - opened
15 unmodified lines1617181919202122232 unmodified lines26272828293030313221 unmodified lines5455565857585960616263646566676364686970717273747515 unmodified lines arg1: the first argument arg2: the second argument """ return "What magic will you build ?" 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 lines timezone: A string representing a valid timezone (e.g., 'America/New_York'). """ try: # Create timezone object tz = pytz.timezone(timezone) # Get current time in that 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 lines agent = CodeAgent( model=model, tools=[final_answer], ## add your tools here (don't remove final answer) 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=None, description=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