Decouple friendly tool descriptions via registry

This commit is contained in:
trojanhorse47
2025-10-30 17:32:52 +01:00
parent 46fac8bbac
commit 765fc0ac72
5 changed files with 45 additions and 28 deletions

View File

@@ -1,4 +1,6 @@
from agno.tools import Toolkit
from app.agents.action_registry import register_friendly_actions
from app.api.wrapper_handler import WrapperHandler
from app.api.core.markets import MarketWrapper, Price, ProductInfo
from app.api.markets import BinanceWrapper, CoinBaseWrapper, CryptoCompareWrapper, YFinanceWrapper
@@ -127,3 +129,11 @@ class MarketAPIsTool(MarketWrapper, Toolkit):
"""
all_prices = self.handler.try_call_all(lambda w: w.get_historical_prices(asset_id, limit))
return Price.aggregate(all_prices)
register_friendly_actions({
"get_product": "🔍 Recupero le informazioni sul prodotto richiesto...",
"get_products": "📦 Recupero i dati su più asset...",
"get_historical_prices": "📊 Recupero i dati storici dei prezzi...",
"get_products_aggregated": "🧩 Aggrego le informazioni da più fonti...",
"get_historical_prices_aggregated": "📈 Creo uno storico aggregato dei prezzi...",
})

View File

@@ -1,4 +1,6 @@
from agno.tools import Toolkit
from app.agents.action_registry import register_friendly_actions
from app.api.wrapper_handler import WrapperHandler
from app.api.core.news import NewsWrapper, Article
from app.api.news import NewsApiWrapper, GoogleNewsWrapper, CryptoPanicWrapper, DuckDuckGoWrapper
@@ -111,3 +113,10 @@ class NewsAPIsTool(NewsWrapper, Toolkit):
Exception: If all providers fail to return results.
"""
return self.handler.try_call_all(lambda w: w.get_latest_news(query, limit))
register_friendly_actions({
"get_top_headlines": "📰 Cerco le notizie principali...",
"get_latest_news": "🔎 Cerco notizie recenti su un argomento...",
"get_top_headlines_aggregated": "🗞️ Raccolgo le notizie principali da tutte le fonti...",
"get_latest_news_aggregated": "📚 Raccolgo notizie specifiche da tutte le fonti...",
})

View File

@@ -1,4 +1,6 @@
from agno.tools import Toolkit
from app.agents.action_registry import register_friendly_actions
from app.api.wrapper_handler import WrapperHandler
from app.api.core.social import SocialPost, SocialWrapper
from app.api.social import *
@@ -73,3 +75,8 @@ class SocialAPIsTool(SocialWrapper, Toolkit):
Exception: If all providers fail to return results.
"""
return self.handler.try_call_all(lambda w: w.get_top_crypto_posts(limit_per_wrapper))
register_friendly_actions({
"get_top_crypto_posts": "📱 Cerco i post più popolari sui social...",
"get_top_crypto_posts_aggregated": "🌐 Raccolgo i post da tutte le piattaforme social...",
})