Update app.py
Browse files
app.py
CHANGED
|
@@ -3,20 +3,37 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 11 |
@tool
|
| 12 |
-
def
|
| 13 |
-
|
| 14 |
-
|
|
|
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -55,7 +72,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
import pandas as pd
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
+
|
| 13 |
@tool
|
| 14 |
+
def search_latest_ai_models(topic: str) -> str:
|
| 15 |
+
"""
|
| 16 |
+
Uses DuckDuckGo to search for the latest AI/GenAI advancements and returns it in tabular format.
|
| 17 |
+
|
| 18 |
Args:
|
| 19 |
+
topic: The topic to search, e.g., "latest AI models June 2025"
|
| 20 |
+
|
| 21 |
+
Returns:
|
| 22 |
+
A markdown table of recent AI model announcements, their creators, purposes, and benefits.
|
| 23 |
"""
|
| 24 |
+
search_tool = DuckDuckGoSearchTool()
|
| 25 |
+
results = search_tool(topic)
|
| 26 |
+
|
| 27 |
+
# Example post-processing (this can be replaced by better parsing in real-time)
|
| 28 |
+
# Dummy entries for now (you can customize parsing later)
|
| 29 |
+
table_data = [
|
| 30 |
+
{"Model": "Qwen 2.5", "Company": "Alibaba", "Purpose": "Code generation", "Benefit": "Improved coding accuracy"},
|
| 31 |
+
{"Model": "Gemini 1.5", "Company": "Google DeepMind", "Purpose": "Multi-modal reasoning", "Benefit": "Handles longer context, integrates video"},
|
| 32 |
+
{"Model": "Veo 2", "Company": "Google", "Purpose": "Text-to-video", "Benefit": "High-fidelity, longer videos"},
|
| 33 |
+
]
|
| 34 |
+
|
| 35 |
+
df = pd.DataFrame(table_data)
|
| 36 |
+
return df.to_markdown(index=False)
|
| 37 |
|
| 38 |
@tool
|
| 39 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 72 |
|
| 73 |
agent = CodeAgent(
|
| 74 |
model=model,
|
| 75 |
+
tools=[final_answer, search_latest_ai_models], ## add your tools here (don't remove final answer)
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|