Update chat interface (#70)
* Update chat interface to fill height and width in Gradio blocks * Implement asynchronous streaming for Gradio responses and enhance pipeline event handling * Refactor tool event handling to provide user-friendly messages and add utility function for descriptive tool actions
This commit was merged in pull request #70.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from agno.tools import Toolkit
|
||||
|
||||
from app.agents.action_registry import friendly_action
|
||||
from app.api.tools.instructions import MARKET_TOOL_INSTRUCTIONS
|
||||
from app.api.wrapper_handler import WrapperHandler
|
||||
from app.api.core.markets import MarketWrapper, Price, ProductInfo
|
||||
@@ -40,6 +42,7 @@ class MarketAPIsTool(MarketWrapper, Toolkit):
|
||||
],
|
||||
)
|
||||
|
||||
@friendly_action("🔍 Recupero le informazioni sul prodotto richiesto...")
|
||||
def get_product(self, asset_id: str) -> ProductInfo:
|
||||
"""
|
||||
Gets product information for a *single* asset from the *first available* provider.
|
||||
@@ -56,6 +59,7 @@ class MarketAPIsTool(MarketWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call(lambda w: w.get_product(asset_id))
|
||||
|
||||
@friendly_action("📦 Recupero i dati su più asset...")
|
||||
def get_products(self, asset_ids: list[str]) -> list[ProductInfo]:
|
||||
"""
|
||||
Gets product information for a *list* of assets from the *first available* provider.
|
||||
@@ -72,6 +76,7 @@ class MarketAPIsTool(MarketWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call(lambda w: w.get_products(asset_ids))
|
||||
|
||||
@friendly_action("📊 Recupero i dati storici dei prezzi...")
|
||||
def get_historical_prices(self, asset_id: str, limit: int = 100) -> list[Price]:
|
||||
"""
|
||||
Gets historical price data for a *single* asset from the *first available* provider.
|
||||
@@ -89,6 +94,7 @@ class MarketAPIsTool(MarketWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call(lambda w: w.get_historical_prices(asset_id, limit))
|
||||
|
||||
@friendly_action("🧩 Aggrego le informazioni da più fonti...")
|
||||
def get_products_aggregated(self, asset_ids: list[str]) -> list[ProductInfo]:
|
||||
"""
|
||||
Gets product information for multiple assets from *all available providers* and *aggregates* the results.
|
||||
@@ -109,6 +115,7 @@ class MarketAPIsTool(MarketWrapper, Toolkit):
|
||||
all_products = self.handler.try_call_all(lambda w: w.get_products(asset_ids))
|
||||
return ProductInfo.aggregate(all_products)
|
||||
|
||||
@friendly_action("📈 Creo uno storico aggregato dei prezzi...")
|
||||
def get_historical_prices_aggregated(self, asset_id: str = "BTC", limit: int = 100) -> list[Price]:
|
||||
"""
|
||||
Gets historical price data for a single asset from *all available providers* and *aggregates* the results.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from agno.tools import Toolkit
|
||||
|
||||
from app.agents.action_registry import friendly_action
|
||||
from app.api.tools.instructions import NEWS_TOOL_INSTRUCTIONS
|
||||
from app.api.wrapper_handler import WrapperHandler
|
||||
from app.api.core.news import NewsWrapper, Article
|
||||
@@ -42,6 +44,7 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
|
||||
],
|
||||
)
|
||||
|
||||
@friendly_action("📰 Cerco le notizie principali...")
|
||||
def get_top_headlines(self, limit: int = 100) -> list[Article]:
|
||||
"""
|
||||
Retrieves top headlines from the *first available* news provider.
|
||||
@@ -58,6 +61,7 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call(lambda w: w.get_top_headlines(limit))
|
||||
|
||||
@friendly_action("🔎 Cerco notizie recenti sull'argomento...")
|
||||
def get_latest_news(self, query: str, limit: int = 100) -> list[Article]:
|
||||
"""
|
||||
Searches for the latest news on a specific topic from the *first available* provider.
|
||||
@@ -75,6 +79,7 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call(lambda w: w.get_latest_news(query, limit))
|
||||
|
||||
@friendly_action("🗞️ Raccolgo le notizie principali da tutte le fonti...")
|
||||
def get_top_headlines_aggregated(self, limit: int = 100) -> dict[str, list[Article]]:
|
||||
"""
|
||||
Retrieves top headlines from *all available providers* and aggregates the results.
|
||||
@@ -94,6 +99,7 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call_all(lambda w: w.get_top_headlines(limit))
|
||||
|
||||
@friendly_action("📚 Raccolgo notizie specifiche da tutte le fonti...")
|
||||
def get_latest_news_aggregated(self, query: str, limit: int = 100) -> dict[str, list[Article]]:
|
||||
"""
|
||||
Searches for news on a specific topic from *all available providers* and aggregates the results.
|
||||
|
||||
@@ -14,6 +14,7 @@ class PlanMemoryTool(Toolkit):
|
||||
|
||||
def __init__(self):
|
||||
self.tasks: list[Task] = []
|
||||
|
||||
Toolkit.__init__(self, # type: ignore[call-arg]
|
||||
name="Plan Memory Toolkit",
|
||||
instructions=PLAN_MEMORY_TOOL_INSTRUCTIONS,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
from agno.tools import Toolkit
|
||||
|
||||
from app.agents.action_registry import friendly_action
|
||||
from app.api.tools.instructions import SOCIAL_TOOL_INSTRUCTIONS
|
||||
from app.api.wrapper_handler import WrapperHandler
|
||||
from app.api.core.social import SocialPost, SocialWrapper
|
||||
@@ -41,6 +43,7 @@ class SocialAPIsTool(SocialWrapper, Toolkit):
|
||||
],
|
||||
)
|
||||
|
||||
@friendly_action("📱 Cerco i post più popolari sui social...")
|
||||
def get_top_crypto_posts(self, limit: int = 5) -> list[SocialPost]:
|
||||
"""
|
||||
Retrieves top cryptocurrency-related posts from the *first available* social media provider.
|
||||
@@ -57,6 +60,7 @@ class SocialAPIsTool(SocialWrapper, Toolkit):
|
||||
"""
|
||||
return self.handler.try_call(lambda w: w.get_top_crypto_posts(limit))
|
||||
|
||||
@friendly_action("🌐 Raccolgo i post da tutte le piattaforme social...")
|
||||
def get_top_crypto_posts_aggregated(self, limit_per_wrapper: int = 5) -> dict[str, list[SocialPost]]:
|
||||
"""
|
||||
Retrieves top cryptocurrency-related posts from *all available providers* and aggregates the results.
|
||||
|
||||
@@ -22,6 +22,7 @@ class CryptoSymbolsTools(Toolkit):
|
||||
def __init__(self, cache_file: str = 'resources/cryptos.csv'):
|
||||
self.cache_file = cache_file
|
||||
self.final_table = pd.read_csv(self.cache_file) if os.path.exists(self.cache_file) else pd.DataFrame() # type: ignore
|
||||
|
||||
Toolkit.__init__(self, # type: ignore
|
||||
name="Crypto Symbols Tool",
|
||||
instructions=SYMBOLS_TOOL_INSTRUCTIONS,
|
||||
|
||||
Reference in New Issue
Block a user