From 68a26cccb2713aeb8cd2cb963fd48ea9b43ceecc Mon Sep 17 00:00:00 2001 From: Muninn Date: Fri, 14 Feb 2025 02:34:08 +0800 Subject: [PATCH] fix: crypto compare skills bug --- skills/cryptocompare/base.py | 1 + skills/cryptocompare/fetch_news.py | 13 ++++++------- skills/cryptocompare/fetch_price.py | 13 ++++++------- skills/cryptocompare/fetch_top_exchanges.py | 13 ++++++------- skills/cryptocompare/fetch_top_market_cap.py | 13 ++++++------- skills/cryptocompare/fetch_top_volume.py | 13 ++++++------- skills/cryptocompare/fetch_trading_signals.py | 13 ++++++------- 7 files changed, 37 insertions(+), 42 deletions(-) diff --git a/skills/cryptocompare/base.py b/skills/cryptocompare/base.py index b132005..092d398 100644 --- a/skills/cryptocompare/base.py +++ b/skills/cryptocompare/base.py @@ -1,6 +1,7 @@ """Base class for all CryptoCompare tools.""" from datetime import datetime, timedelta, timezone +from typing import Type from pydantic import BaseModel, Field diff --git a/skills/cryptocompare/fetch_news.py b/skills/cryptocompare/fetch_news.py index 2094f20..80a0929 100644 --- a/skills/cryptocompare/fetch_news.py +++ b/skills/cryptocompare/fetch_news.py @@ -8,6 +8,12 @@ from skills.cryptocompare.api import FetchNewsInput, fetch_news from skills.cryptocompare.base import CryptoCompareBaseTool +FETCH_NEWS_PROMPT = """ +This tool fetches the latest cryptocurrency news articles for a specific token. +You can optionally specify a timestamp to get historical news, otherwise it uses the current time. +Returns articles in English with details like title, body, source, and publish time. +""" + class NewsArticle(BaseModel): """Model representing a news article.""" @@ -98,10 +104,3 @@ async def _arun(self, token: str) -> CryptoCompareFetchNewsOutput: except Exception as e: return CryptoCompareFetchNewsOutput(error=str(e)) - - -FETCH_NEWS_PROMPT = """ -This tool fetches the latest cryptocurrency news articles for a specific token. -You can optionally specify a timestamp to get historical news, otherwise it uses the current time. -Returns articles in English with details like title, body, source, and publish time. -""" diff --git a/skills/cryptocompare/fetch_price.py b/skills/cryptocompare/fetch_price.py index f7cf8d2..42ed2e5 100644 --- a/skills/cryptocompare/fetch_price.py +++ b/skills/cryptocompare/fetch_price.py @@ -7,6 +7,12 @@ from skills.cryptocompare.api import FetchPriceInput, fetch_price from skills.cryptocompare.base import CryptoCompareBaseTool +FETCH_PRICE_PROMPT = """ +This tool fetches real-time cryptocurrency price data with multi-currency support. +Provide a base currency (e.g., 'BTC', 'ETH') and a list of target currencies (e.g., ['USD', 'EUR', 'JPY']). +Returns current exchange rates for all requested currency pairs. +""" + class CryptoCompareFetchPriceOutput(BaseModel): result: Dict[str, Any] @@ -34,10 +40,3 @@ async def _arun( return CryptoCompareFetchPriceOutput(result=result) except Exception as e: return CryptoCompareFetchPriceOutput(result={}, error=str(e)) - - -FETCH_PRICE_PROMPT = """ -This tool fetches real-time cryptocurrency price data with multi-currency support. -Provide a base currency (e.g., 'BTC', 'ETH') and a list of target currencies (e.g., ['USD', 'EUR', 'JPY']). -Returns current exchange rates for all requested currency pairs. -""" diff --git a/skills/cryptocompare/fetch_top_exchanges.py b/skills/cryptocompare/fetch_top_exchanges.py index ff86a9b..9459d98 100644 --- a/skills/cryptocompare/fetch_top_exchanges.py +++ b/skills/cryptocompare/fetch_top_exchanges.py @@ -7,6 +7,12 @@ from skills.cryptocompare.api import FetchTopExchangesInput, fetch_top_exchanges from skills.cryptocompare.base import CryptoCompareBaseTool +FETCH_TOP_EXCHANGES_PROMPT = """ +This tool fetches the top cryptocurrency exchanges for a specific trading pair. +Specify base and quote currencies (e.g., 'BTC'/'USD') to get exchange rankings. +Returns key information such as 24h trading volume and market share. +""" + class CryptoCompareFetchTopExchangesOutput(BaseModel): result: Dict[str, Any] @@ -34,10 +40,3 @@ async def _arun( return CryptoCompareFetchTopExchangesOutput(result=result) except Exception as e: return CryptoCompareFetchTopExchangesOutput(result={}, error=str(e)) - - -FETCH_TOP_EXCHANGES_PROMPT = """ -This tool fetches the top cryptocurrency exchanges for a specific trading pair. -Specify base and quote currencies (e.g., 'BTC'/'USD') to get exchange rankings. -Returns key information such as 24h trading volume and market share. -""" diff --git a/skills/cryptocompare/fetch_top_market_cap.py b/skills/cryptocompare/fetch_top_market_cap.py index 2d5dcde..efd20e1 100644 --- a/skills/cryptocompare/fetch_top_market_cap.py +++ b/skills/cryptocompare/fetch_top_market_cap.py @@ -7,6 +7,12 @@ from skills.cryptocompare.api import FetchTopMarketCapInput, fetch_top_market_cap from skills.cryptocompare.base import CryptoCompareBaseTool +FETCH_TOP_MARKET_CAP_PROMPT = """ +This tool retrieves the top cryptocurrencies ranked by market capitalization. +Customize results with limit and quote currency parameters. +Returns detailed information including current price, market cap, 24h volume, and circulating supply. +""" + class CryptoCompareFetchTopMarketCapOutput(BaseModel): result: Dict[str, Any] @@ -31,10 +37,3 @@ async def _arun(self, to_symbol: str) -> CryptoCompareFetchTopMarketCapOutput: return CryptoCompareFetchTopMarketCapOutput(result=result) except Exception as e: return CryptoCompareFetchTopMarketCapOutput(result={}, error=str(e)) - - -FETCH_TOP_MARKET_CAP_PROMPT = """ -This tool retrieves the top cryptocurrencies ranked by market capitalization. -Customize results with limit and quote currency parameters. -Returns detailed information including current price, market cap, 24h volume, and circulating supply. -""" diff --git a/skills/cryptocompare/fetch_top_volume.py b/skills/cryptocompare/fetch_top_volume.py index 97d4dd6..4d022bf 100644 --- a/skills/cryptocompare/fetch_top_volume.py +++ b/skills/cryptocompare/fetch_top_volume.py @@ -7,6 +7,12 @@ from skills.cryptocompare.api import FetchTopVolumeInput, fetch_top_volume from skills.cryptocompare.base import CryptoCompareBaseTool +FETCH_TOP_VOLUME_PROMPT = """ +This tool retrieves cryptocurrencies ranked by their total trading volume. +Customize the view with limit and quote currency parameters. +Returns comprehensive volume data including 24h trading volume and volume distribution. +""" + class CryptoCompareFetchTopVolumeOutput(BaseModel): result: Dict[str, Any] @@ -31,10 +37,3 @@ async def _arun(self, to_symbol: str) -> CryptoCompareFetchTopVolumeOutput: return CryptoCompareFetchTopVolumeOutput(result=result) except Exception as e: return CryptoCompareFetchTopVolumeOutput(result={}, error=str(e)) - - -FETCH_TOP_VOLUME_PROMPT = """ -This tool retrieves cryptocurrencies ranked by their total trading volume. -Customize the view with limit and quote currency parameters. -Returns comprehensive volume data including 24h trading volume and volume distribution. -""" diff --git a/skills/cryptocompare/fetch_trading_signals.py b/skills/cryptocompare/fetch_trading_signals.py index 4cdf1cf..18c5e5c 100644 --- a/skills/cryptocompare/fetch_trading_signals.py +++ b/skills/cryptocompare/fetch_trading_signals.py @@ -7,6 +7,12 @@ from skills.cryptocompare.api import FetchTradingSignalsInput, fetch_trading_signals from skills.cryptocompare.base import CryptoCompareBaseTool +FETCH_TRADING_SIGNALS_PROMPT = """ +This tool retrieves advanced trading signals from IntoTheBlock analytics for a specific cryptocurrency. +Provide a cryptocurrency symbol (e.g., 'BTC') to get detailed market indicators. +Returns key metrics like network growth, large transaction patterns, holder composition, and market momentum. +""" + class CryptoCompareFetchTradingSignalsOutput(BaseModel): result: Dict[str, Any] @@ -30,10 +36,3 @@ async def _arun(self, from_symbol: str) -> CryptoCompareFetchTradingSignalsOutpu return CryptoCompareFetchTradingSignalsOutput(result=result) except Exception as e: return CryptoCompareFetchTradingSignalsOutput(result={}, error=str(e)) - - -FETCH_TRADING_SIGNALS_PROMPT = """ -This tool retrieves advanced trading signals from IntoTheBlock analytics for a specific cryptocurrency. -Provide a cryptocurrency symbol (e.g., 'BTC') to get detailed market indicators. -Returns key metrics like network growth, large transaction patterns, holder composition, and market momentum. -"""