intentkit 0.8.6.dev2__py3-none-any.whl → 0.8.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intentkit might be problematic. Click here for more details.
- intentkit/__init__.py +1 -1
- intentkit/abstracts/agent.py +4 -5
- intentkit/abstracts/engine.py +5 -5
- intentkit/abstracts/graph.py +10 -5
- intentkit/abstracts/skill.py +6 -144
- intentkit/abstracts/twitter.py +4 -5
- intentkit/clients/__init__.py +3 -2
- intentkit/clients/cdp.py +53 -92
- intentkit/clients/twitter.py +56 -57
- intentkit/clients/web3.py +1 -3
- intentkit/config/config.py +5 -0
- intentkit/core/agent.py +16 -388
- intentkit/core/asset.py +64 -18
- intentkit/core/client.py +1 -1
- intentkit/core/credit.py +19 -20
- intentkit/core/engine.py +26 -11
- intentkit/core/node.py +2 -1
- intentkit/core/prompt.py +53 -15
- intentkit/core/scheduler.py +9 -9
- intentkit/core/statistics.py +6 -7
- intentkit/models/agent.py +256 -176
- intentkit/models/agent_data.py +62 -36
- intentkit/models/agent_schema.json +6 -9
- intentkit/models/app_setting.py +6 -6
- intentkit/models/chat.py +28 -24
- intentkit/models/conversation.py +8 -8
- intentkit/models/credit.py +62 -64
- intentkit/models/db.py +8 -7
- intentkit/models/db_mig.py +2 -2
- intentkit/models/llm.csv +15 -12
- intentkit/models/llm.py +18 -16
- intentkit/models/redis.py +2 -3
- intentkit/models/skill.py +62 -66
- intentkit/models/skills.csv +30 -26
- intentkit/models/user.py +46 -21
- intentkit/skills/acolyt/__init__.py +2 -9
- intentkit/skills/acolyt/ask.py +3 -4
- intentkit/skills/acolyt/base.py +4 -9
- intentkit/skills/aixbt/__init__.py +2 -13
- intentkit/skills/aixbt/base.py +1 -7
- intentkit/skills/aixbt/projects.py +14 -15
- intentkit/skills/allora/__init__.py +2 -9
- intentkit/skills/allora/base.py +4 -9
- intentkit/skills/allora/price.py +3 -4
- intentkit/skills/base.py +175 -52
- intentkit/skills/basename/__init__.py +4 -8
- intentkit/skills/carv/__init__.py +115 -121
- intentkit/skills/carv/base.py +184 -185
- intentkit/skills/carv/fetch_news.py +3 -3
- intentkit/skills/carv/onchain_query.py +4 -4
- intentkit/skills/carv/token_info_and_price.py +5 -5
- intentkit/skills/casino/__init__.py +4 -15
- intentkit/skills/casino/base.py +1 -7
- intentkit/skills/casino/deck_draw.py +5 -8
- intentkit/skills/casino/deck_shuffle.py +6 -6
- intentkit/skills/casino/dice_roll.py +2 -4
- intentkit/skills/cdp/__init__.py +3 -10
- intentkit/skills/cdp/base.py +1 -7
- intentkit/skills/cdp/schema.json +1 -17
- intentkit/skills/chainlist/__init__.py +2 -7
- intentkit/skills/chainlist/base.py +1 -7
- intentkit/skills/chainlist/chain_lookup.py +18 -18
- intentkit/skills/common/__init__.py +2 -9
- intentkit/skills/common/base.py +1 -7
- intentkit/skills/common/current_time.py +1 -2
- intentkit/skills/cookiefun/__init__.py +6 -9
- intentkit/skills/cookiefun/base.py +2 -7
- intentkit/skills/cookiefun/get_account_details.py +7 -7
- intentkit/skills/cookiefun/get_account_feed.py +19 -19
- intentkit/skills/cookiefun/get_account_smart_followers.py +7 -7
- intentkit/skills/cookiefun/get_sectors.py +3 -3
- intentkit/skills/cookiefun/search_accounts.py +9 -9
- intentkit/skills/cryptocompare/__init__.py +7 -24
- intentkit/skills/cryptocompare/api.py +2 -3
- intentkit/skills/cryptocompare/base.py +10 -24
- intentkit/skills/cryptocompare/fetch_news.py +4 -5
- intentkit/skills/cryptocompare/fetch_price.py +6 -7
- intentkit/skills/cryptocompare/fetch_top_exchanges.py +4 -5
- intentkit/skills/cryptocompare/fetch_top_market_cap.py +4 -5
- intentkit/skills/cryptocompare/fetch_top_volume.py +4 -5
- intentkit/skills/cryptocompare/fetch_trading_signals.py +5 -6
- intentkit/skills/cryptopanic/__init__.py +7 -10
- intentkit/skills/cryptopanic/base.py +51 -55
- intentkit/skills/cryptopanic/fetch_crypto_news.py +4 -8
- intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +5 -7
- intentkit/skills/dapplooker/__init__.py +2 -9
- intentkit/skills/dapplooker/base.py +4 -9
- intentkit/skills/dapplooker/dapplooker_token_data.py +7 -7
- intentkit/skills/defillama/__init__.py +24 -74
- intentkit/skills/defillama/api.py +6 -9
- intentkit/skills/defillama/base.py +8 -19
- intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +8 -10
- intentkit/skills/defillama/coins/fetch_block.py +6 -8
- intentkit/skills/defillama/coins/fetch_current_prices.py +8 -10
- intentkit/skills/defillama/coins/fetch_first_price.py +7 -9
- intentkit/skills/defillama/coins/fetch_historical_prices.py +9 -11
- intentkit/skills/defillama/coins/fetch_price_chart.py +9 -11
- intentkit/skills/defillama/coins/fetch_price_percentage.py +7 -9
- intentkit/skills/defillama/config/chains.py +1 -3
- intentkit/skills/defillama/fees/fetch_fees_overview.py +24 -26
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +16 -18
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +8 -10
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +5 -7
- intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +7 -9
- intentkit/skills/defillama/tests/api_integration.test.py +1 -1
- intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +4 -6
- intentkit/skills/defillama/tvl/fetch_chains.py +9 -11
- intentkit/skills/defillama/tvl/fetch_historical_tvl.py +4 -6
- intentkit/skills/defillama/tvl/fetch_protocol.py +32 -38
- intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +3 -5
- intentkit/skills/defillama/tvl/fetch_protocols.py +37 -45
- intentkit/skills/defillama/volumes/fetch_dex_overview.py +42 -48
- intentkit/skills/defillama/volumes/fetch_dex_summary.py +35 -37
- intentkit/skills/defillama/volumes/fetch_options_overview.py +24 -28
- intentkit/skills/defillama/yields/fetch_pool_chart.py +10 -12
- intentkit/skills/defillama/yields/fetch_pools.py +26 -30
- intentkit/skills/dexscreener/__init__.py +97 -102
- intentkit/skills/dexscreener/base.py +125 -130
- intentkit/skills/dexscreener/get_pair_info.py +4 -5
- intentkit/skills/dexscreener/get_token_pairs.py +4 -5
- intentkit/skills/dexscreener/get_tokens_info.py +7 -8
- intentkit/skills/dexscreener/model/search_token_response.py +80 -82
- intentkit/skills/dexscreener/search_token.py +182 -184
- intentkit/skills/dexscreener/utils.py +15 -14
- intentkit/skills/dune_analytics/__init__.py +7 -9
- intentkit/skills/dune_analytics/base.py +48 -52
- intentkit/skills/dune_analytics/fetch_kol_buys.py +5 -7
- intentkit/skills/dune_analytics/fetch_nation_metrics.py +6 -8
- intentkit/skills/elfa/__init__.py +5 -18
- intentkit/skills/elfa/base.py +10 -14
- intentkit/skills/elfa/mention.py +19 -21
- intentkit/skills/elfa/stats.py +4 -4
- intentkit/skills/elfa/tokens.py +12 -12
- intentkit/skills/elfa/utils.py +26 -28
- intentkit/skills/enso/__init__.py +11 -31
- intentkit/skills/enso/base.py +9 -15
- intentkit/skills/enso/best_yield.py +5 -7
- intentkit/skills/enso/networks.py +3 -9
- intentkit/skills/enso/prices.py +2 -4
- intentkit/skills/enso/route.py +6 -12
- intentkit/skills/enso/tokens.py +4 -16
- intentkit/skills/enso/wallet.py +6 -6
- intentkit/skills/erc20/__init__.py +5 -11
- intentkit/skills/erc721/__init__.py +5 -9
- intentkit/skills/firecrawl/__init__.py +5 -18
- intentkit/skills/firecrawl/base.py +4 -9
- intentkit/skills/firecrawl/clear.py +4 -8
- intentkit/skills/firecrawl/crawl.py +19 -19
- intentkit/skills/firecrawl/query.py +4 -3
- intentkit/skills/firecrawl/scrape.py +17 -22
- intentkit/skills/firecrawl/utils.py +50 -42
- intentkit/skills/github/__init__.py +2 -7
- intentkit/skills/github/base.py +1 -7
- intentkit/skills/github/github_search.py +1 -2
- intentkit/skills/heurist/__init__.py +8 -27
- intentkit/skills/heurist/base.py +4 -9
- intentkit/skills/heurist/image_generation_animagine_xl.py +12 -13
- intentkit/skills/heurist/image_generation_arthemy_comics.py +12 -13
- intentkit/skills/heurist/image_generation_arthemy_real.py +12 -13
- intentkit/skills/heurist/image_generation_braindance.py +12 -13
- intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +12 -13
- intentkit/skills/heurist/image_generation_flux_1_dev.py +12 -13
- intentkit/skills/heurist/image_generation_sdxl.py +12 -13
- intentkit/skills/http/__init__.py +4 -15
- intentkit/skills/http/base.py +1 -7
- intentkit/skills/http/get.py +21 -16
- intentkit/skills/http/post.py +23 -18
- intentkit/skills/http/put.py +23 -18
- intentkit/skills/lifi/__init__.py +5 -10
- intentkit/skills/lifi/base.py +1 -7
- intentkit/skills/lifi/token_execute.py +14 -17
- intentkit/skills/lifi/token_quote.py +7 -9
- intentkit/skills/lifi/utils.py +16 -16
- intentkit/skills/moralis/__init__.py +6 -10
- intentkit/skills/moralis/api.py +6 -7
- intentkit/skills/moralis/base.py +5 -10
- intentkit/skills/moralis/fetch_chain_portfolio.py +10 -11
- intentkit/skills/moralis/fetch_nft_portfolio.py +22 -22
- intentkit/skills/moralis/fetch_solana_portfolio.py +11 -12
- intentkit/skills/moralis/fetch_wallet_portfolio.py +8 -9
- intentkit/skills/morpho/__init__.py +5 -9
- intentkit/skills/nation/__init__.py +4 -9
- intentkit/skills/nation/base.py +5 -10
- intentkit/skills/nation/nft_check.py +3 -4
- intentkit/skills/onchain.py +23 -0
- intentkit/skills/openai/__init__.py +17 -18
- intentkit/skills/openai/base.py +10 -14
- intentkit/skills/openai/dalle_image_generation.py +3 -8
- intentkit/skills/openai/gpt_avatar_generator.py +102 -0
- intentkit/skills/openai/gpt_image_generation.py +4 -8
- intentkit/skills/openai/gpt_image_mini_generator.py +91 -0
- intentkit/skills/openai/gpt_image_to_image.py +4 -8
- intentkit/skills/openai/image_to_text.py +3 -7
- intentkit/skills/openai/schema.json +32 -0
- intentkit/skills/portfolio/__init__.py +11 -35
- intentkit/skills/portfolio/base.py +33 -19
- intentkit/skills/portfolio/token_balances.py +21 -21
- intentkit/skills/portfolio/wallet_approvals.py +17 -18
- intentkit/skills/portfolio/wallet_defi_positions.py +3 -3
- intentkit/skills/portfolio/wallet_history.py +31 -31
- intentkit/skills/portfolio/wallet_net_worth.py +13 -13
- intentkit/skills/portfolio/wallet_nfts.py +19 -19
- intentkit/skills/portfolio/wallet_profitability.py +18 -18
- intentkit/skills/portfolio/wallet_profitability_summary.py +5 -5
- intentkit/skills/portfolio/wallet_stats.py +3 -3
- intentkit/skills/portfolio/wallet_swaps.py +19 -19
- intentkit/skills/pyth/__init__.py +4 -10
- intentkit/skills/skills.toml +4 -0
- intentkit/skills/slack/__init__.py +5 -17
- intentkit/skills/slack/base.py +3 -9
- intentkit/skills/slack/get_channel.py +8 -8
- intentkit/skills/slack/get_message.py +9 -9
- intentkit/skills/slack/schedule_message.py +5 -5
- intentkit/skills/slack/send_message.py +3 -5
- intentkit/skills/supabase/__init__.py +7 -23
- intentkit/skills/supabase/base.py +1 -7
- intentkit/skills/supabase/delete_data.py +4 -4
- intentkit/skills/supabase/fetch_data.py +12 -12
- intentkit/skills/supabase/insert_data.py +4 -4
- intentkit/skills/supabase/invoke_function.py +6 -6
- intentkit/skills/supabase/update_data.py +6 -6
- intentkit/skills/supabase/upsert_data.py +4 -4
- intentkit/skills/superfluid/__init__.py +5 -9
- intentkit/skills/system/__init__.py +7 -24
- intentkit/skills/system/add_autonomous_task.py +10 -12
- intentkit/skills/system/delete_autonomous_task.py +2 -2
- intentkit/skills/system/edit_autonomous_task.py +14 -18
- intentkit/skills/system/list_autonomous_tasks.py +3 -5
- intentkit/skills/system/read_agent_api_key.py +6 -4
- intentkit/skills/system/regenerate_agent_api_key.py +6 -4
- intentkit/skills/tavily/__init__.py +3 -12
- intentkit/skills/tavily/base.py +4 -9
- intentkit/skills/tavily/tavily_extract.py +2 -4
- intentkit/skills/tavily/tavily_search.py +4 -6
- intentkit/skills/token/__init__.py +5 -10
- intentkit/skills/token/base.py +7 -11
- intentkit/skills/token/erc20_transfers.py +19 -19
- intentkit/skills/token/token_analytics.py +3 -3
- intentkit/skills/token/token_price.py +13 -13
- intentkit/skills/token/token_search.py +9 -9
- intentkit/skills/twitter/__init__.py +11 -35
- intentkit/skills/twitter/base.py +22 -34
- intentkit/skills/twitter/follow_user.py +2 -6
- intentkit/skills/twitter/get_mentions.py +5 -12
- intentkit/skills/twitter/get_timeline.py +4 -12
- intentkit/skills/twitter/get_user_by_username.py +2 -6
- intentkit/skills/twitter/get_user_tweets.py +5 -13
- intentkit/skills/twitter/like_tweet.py +2 -6
- intentkit/skills/twitter/post_tweet.py +6 -9
- intentkit/skills/twitter/reply_tweet.py +6 -9
- intentkit/skills/twitter/retweet.py +2 -6
- intentkit/skills/twitter/search_tweets.py +4 -12
- intentkit/skills/unrealspeech/__init__.py +2 -7
- intentkit/skills/unrealspeech/base.py +2 -8
- intentkit/skills/unrealspeech/text_to_speech.py +8 -8
- intentkit/skills/venice_audio/__init__.py +98 -106
- intentkit/skills/venice_audio/base.py +117 -121
- intentkit/skills/venice_audio/input.py +41 -41
- intentkit/skills/venice_audio/venice_audio.py +7 -11
- intentkit/skills/venice_image/__init__.py +147 -154
- intentkit/skills/venice_image/api.py +138 -138
- intentkit/skills/venice_image/base.py +185 -192
- intentkit/skills/venice_image/config.py +33 -35
- intentkit/skills/venice_image/image_enhance/image_enhance.py +2 -3
- intentkit/skills/venice_image/image_enhance/image_enhance_base.py +21 -23
- intentkit/skills/venice_image/image_enhance/image_enhance_input.py +38 -40
- intentkit/skills/venice_image/image_generation/image_generation_base.py +9 -9
- intentkit/skills/venice_image/image_generation/image_generation_fluently_xl.py +26 -26
- intentkit/skills/venice_image/image_generation/image_generation_flux_dev.py +27 -27
- intentkit/skills/venice_image/image_generation/image_generation_flux_dev_uncensored.py +26 -26
- intentkit/skills/venice_image/image_generation/image_generation_input.py +158 -158
- intentkit/skills/venice_image/image_generation/image_generation_lustify_sdxl.py +26 -26
- intentkit/skills/venice_image/image_generation/image_generation_pony_realism.py +26 -26
- intentkit/skills/venice_image/image_generation/image_generation_stable_diffusion_3_5.py +28 -28
- intentkit/skills/venice_image/image_generation/image_generation_venice_sd35.py +28 -28
- intentkit/skills/venice_image/image_upscale/image_upscale.py +3 -3
- intentkit/skills/venice_image/image_upscale/image_upscale_base.py +21 -23
- intentkit/skills/venice_image/image_upscale/image_upscale_input.py +22 -22
- intentkit/skills/venice_image/image_vision/image_vision.py +2 -2
- intentkit/skills/venice_image/image_vision/image_vision_base.py +17 -17
- intentkit/skills/venice_image/image_vision/image_vision_input.py +9 -9
- intentkit/skills/venice_image/utils.py +77 -78
- intentkit/skills/web_scraper/__init__.py +5 -18
- intentkit/skills/web_scraper/base.py +21 -7
- intentkit/skills/web_scraper/document_indexer.py +7 -6
- intentkit/skills/web_scraper/scrape_and_index.py +15 -15
- intentkit/skills/web_scraper/utils.py +62 -63
- intentkit/skills/web_scraper/website_indexer.py +17 -19
- intentkit/skills/weth/__init__.py +5 -11
- intentkit/skills/wow/__init__.py +5 -11
- intentkit/skills/x402/__init__.py +61 -0
- intentkit/skills/x402/ask_agent.py +98 -0
- intentkit/skills/x402/base.py +99 -0
- intentkit/skills/x402/http_request.py +117 -0
- intentkit/skills/x402/schema.json +45 -0
- intentkit/skills/x402/x402.webp +0 -0
- intentkit/skills/xmtp/__init__.py +4 -15
- intentkit/skills/xmtp/base.py +5 -5
- intentkit/skills/xmtp/price.py +6 -6
- intentkit/skills/xmtp/swap.py +6 -8
- intentkit/skills/xmtp/transfer.py +4 -6
- intentkit/utils/error.py +2 -2
- intentkit/utils/logging.py +2 -4
- intentkit/utils/s3.py +8 -9
- intentkit/utils/schema.py +100 -0
- intentkit/utils/slack_alert.py +7 -8
- {intentkit-0.8.6.dev2.dist-info → intentkit-0.8.17.dist-info}/METADATA +3 -4
- intentkit-0.8.17.dist-info/RECORD +466 -0
- intentkit/models/generator.py +0 -347
- intentkit-0.8.6.dev2.dist-info/RECORD +0 -457
- {intentkit-0.8.6.dev2.dist-info → intentkit-0.8.17.dist-info}/WHEEL +0 -0
- {intentkit-0.8.6.dev2.dist-info → intentkit-0.8.17.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from typing import TypedDict
|
|
2
2
|
|
|
3
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
4
3
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
5
4
|
from intentkit.skills.cookiefun.base import CookieFunBaseTool, logger
|
|
6
5
|
from intentkit.skills.cookiefun.get_account_details import GetAccountDetails
|
|
@@ -35,7 +34,6 @@ class Config(SkillConfig):
|
|
|
35
34
|
async def get_skills(
|
|
36
35
|
config: "Config",
|
|
37
36
|
is_private: bool,
|
|
38
|
-
store: SkillStoreABC,
|
|
39
37
|
**_,
|
|
40
38
|
) -> list[CookieFunBaseTool]:
|
|
41
39
|
"""Get all CookieFun skills."""
|
|
@@ -49,28 +47,27 @@ async def get_skills(
|
|
|
49
47
|
available_skills.append(skill_name)
|
|
50
48
|
|
|
51
49
|
# Get each skill using the cached getter
|
|
52
|
-
skills = [get_cookiefun_skill(name
|
|
50
|
+
skills = [get_cookiefun_skill(name) for name in available_skills]
|
|
53
51
|
logger.info("Returning %d CookieFun skills", len(skills))
|
|
54
52
|
return skills
|
|
55
53
|
|
|
56
54
|
|
|
57
55
|
def get_cookiefun_skill(
|
|
58
56
|
name: str,
|
|
59
|
-
store: SkillStoreABC,
|
|
60
57
|
) -> CookieFunBaseTool:
|
|
61
58
|
"""Get a CookieFun skill by name."""
|
|
62
59
|
|
|
63
60
|
if name not in _cache:
|
|
64
61
|
if name == "get_sectors":
|
|
65
|
-
_cache[name] = GetSectors(
|
|
62
|
+
_cache[name] = GetSectors()
|
|
66
63
|
elif name == "get_account_details":
|
|
67
|
-
_cache[name] = GetAccountDetails(
|
|
64
|
+
_cache[name] = GetAccountDetails()
|
|
68
65
|
elif name == "get_account_smart_followers":
|
|
69
|
-
_cache[name] = GetAccountSmartFollowers(
|
|
66
|
+
_cache[name] = GetAccountSmartFollowers()
|
|
70
67
|
elif name == "search_accounts":
|
|
71
|
-
_cache[name] = SearchAccounts(
|
|
68
|
+
_cache[name] = SearchAccounts()
|
|
72
69
|
elif name == "get_account_feed":
|
|
73
|
-
_cache[name] = GetAccountFeed(
|
|
70
|
+
_cache[name] = GetAccountFeed()
|
|
74
71
|
else:
|
|
75
72
|
logger.error("Unknown CookieFun skill: %s", name)
|
|
76
73
|
raise ValueError(f"Unknown CookieFun skill: {name}")
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Type
|
|
3
2
|
|
|
4
|
-
from
|
|
3
|
+
from langchain_core.tools.base import ToolException
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
6
|
from intentkit.skills.base import IntentKitSkill
|
|
9
7
|
|
|
10
8
|
logger = logging.getLogger(__name__)
|
|
@@ -15,10 +13,7 @@ class CookieFunBaseTool(IntentKitSkill):
|
|
|
15
13
|
|
|
16
14
|
name: str = Field(description="The name of the tool")
|
|
17
15
|
description: str = Field(description="A description of what the tool does")
|
|
18
|
-
args_schema:
|
|
19
|
-
skill_store: SkillStoreABC = Field(
|
|
20
|
-
description="The skill store for persisting data"
|
|
21
|
-
)
|
|
16
|
+
args_schema: type[BaseModel]
|
|
22
17
|
|
|
23
18
|
@property
|
|
24
19
|
def category(self) -> str:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
@@ -10,12 +10,12 @@ from intentkit.skills.cookiefun.constants import DEFAULT_HEADERS, ENDPOINTS
|
|
|
10
10
|
class GetAccountDetailsInput(BaseModel):
|
|
11
11
|
"""Input for GetAccountDetails tool."""
|
|
12
12
|
|
|
13
|
-
username:
|
|
13
|
+
username: str | None = Field(
|
|
14
14
|
default=None,
|
|
15
15
|
description="Twitter username (either username or userId is required)",
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
userId:
|
|
18
|
+
userId: str | None = Field(
|
|
19
19
|
default=None,
|
|
20
20
|
description="Twitter user ID (either username or userId is required)",
|
|
21
21
|
)
|
|
@@ -26,14 +26,14 @@ class GetAccountDetails(CookieFunBaseTool):
|
|
|
26
26
|
|
|
27
27
|
name: str = "cookiefun_get_account_details"
|
|
28
28
|
description: str = "Retrieves detailed information about a Twitter account including followers, following, posts, metrics, and engagement data."
|
|
29
|
-
args_schema:
|
|
29
|
+
args_schema: type[BaseModel] = GetAccountDetailsInput
|
|
30
30
|
|
|
31
31
|
async def _arun(
|
|
32
32
|
self,
|
|
33
|
-
username:
|
|
34
|
-
userId:
|
|
33
|
+
username: str | None = None,
|
|
34
|
+
userId: str | None = None,
|
|
35
35
|
**kwargs,
|
|
36
|
-
) ->
|
|
36
|
+
) -> dict[str, Any] | str:
|
|
37
37
|
"""
|
|
38
38
|
Get detailed information about a Twitter account.
|
|
39
39
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
@@ -33,42 +33,42 @@ class SortOrder(IntEnum):
|
|
|
33
33
|
class GetAccountFeedInput(BaseModel):
|
|
34
34
|
"""Input for GetAccountFeed tool."""
|
|
35
35
|
|
|
36
|
-
username:
|
|
36
|
+
username: str | None = Field(
|
|
37
37
|
default=None,
|
|
38
38
|
description="Twitter username (either username or userId is required)",
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
userId:
|
|
41
|
+
userId: str | None = Field(
|
|
42
42
|
default=None,
|
|
43
43
|
description="Twitter user ID (either username or userId is required)",
|
|
44
44
|
)
|
|
45
45
|
|
|
46
|
-
startDate:
|
|
46
|
+
startDate: str | None = Field(
|
|
47
47
|
default=None,
|
|
48
48
|
description="Start date for filtering in format dd/mm/yyyy (default: 30 days ago)",
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
endDate:
|
|
51
|
+
endDate: str | None = Field(
|
|
52
52
|
default=None,
|
|
53
53
|
description="End date for filtering in format dd/mm/yyyy (default: now)",
|
|
54
54
|
)
|
|
55
55
|
|
|
56
|
-
type:
|
|
56
|
+
type: int | None = Field(
|
|
57
57
|
default=None,
|
|
58
58
|
description="Type of tweets to filter: 0 for Original, 1 for Reply, 2 for Quote (leave empty for all types)",
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
-
hasMedia:
|
|
61
|
+
hasMedia: bool | None = Field(
|
|
62
62
|
default=None,
|
|
63
63
|
description="Filter to only include tweets with media if true",
|
|
64
64
|
)
|
|
65
65
|
|
|
66
|
-
sortBy:
|
|
66
|
+
sortBy: int | None = Field(
|
|
67
67
|
default=None,
|
|
68
68
|
description="Sort by: 0 for CreatedDate, 1 for Impressions",
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
sortOrder:
|
|
71
|
+
sortOrder: int | None = Field(
|
|
72
72
|
default=None,
|
|
73
73
|
description="Sort order: 0 for Ascending, 1 for Descending",
|
|
74
74
|
)
|
|
@@ -79,20 +79,20 @@ class GetAccountFeed(CookieFunBaseTool):
|
|
|
79
79
|
|
|
80
80
|
name: str = "cookiefun_get_account_feed"
|
|
81
81
|
description: str = "Retrieves a list of tweets for a specific Twitter account with various filtering options."
|
|
82
|
-
args_schema:
|
|
82
|
+
args_schema: type[BaseModel] = GetAccountFeedInput
|
|
83
83
|
|
|
84
84
|
async def _arun(
|
|
85
85
|
self,
|
|
86
|
-
username:
|
|
87
|
-
userId:
|
|
88
|
-
startDate:
|
|
89
|
-
endDate:
|
|
90
|
-
type:
|
|
91
|
-
hasMedia:
|
|
92
|
-
sortBy:
|
|
93
|
-
sortOrder:
|
|
86
|
+
username: str | None = None,
|
|
87
|
+
userId: str | None = None,
|
|
88
|
+
startDate: str | None = None,
|
|
89
|
+
endDate: str | None = None,
|
|
90
|
+
type: int | None = None,
|
|
91
|
+
hasMedia: bool | None = None,
|
|
92
|
+
sortBy: int | None = None,
|
|
93
|
+
sortOrder: int | None = None,
|
|
94
94
|
**kwargs,
|
|
95
|
-
) ->
|
|
95
|
+
) -> list[dict[str, Any]] | str:
|
|
96
96
|
"""
|
|
97
97
|
Get the feed (tweets) of a Twitter account.
|
|
98
98
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
@@ -10,12 +10,12 @@ from intentkit.skills.cookiefun.constants import DEFAULT_HEADERS, ENDPOINTS
|
|
|
10
10
|
class GetAccountSmartFollowersInput(BaseModel):
|
|
11
11
|
"""Input for GetAccountSmartFollowers tool."""
|
|
12
12
|
|
|
13
|
-
username:
|
|
13
|
+
username: str | None = Field(
|
|
14
14
|
default=None,
|
|
15
15
|
description="Twitter username (either username or userId is required)",
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
userId:
|
|
18
|
+
userId: str | None = Field(
|
|
19
19
|
default=None,
|
|
20
20
|
description="Twitter user ID (either username or userId is required)",
|
|
21
21
|
)
|
|
@@ -26,14 +26,14 @@ class GetAccountSmartFollowers(CookieFunBaseTool):
|
|
|
26
26
|
|
|
27
27
|
name: str = "cookiefun_get_account_smart_followers"
|
|
28
28
|
description: str = "Returns a list of top smart followers for a specific Twitter account, with detailed metrics about these followers."
|
|
29
|
-
args_schema:
|
|
29
|
+
args_schema: type[BaseModel] = GetAccountSmartFollowersInput
|
|
30
30
|
|
|
31
31
|
async def _arun(
|
|
32
32
|
self,
|
|
33
|
-
username:
|
|
34
|
-
userId:
|
|
33
|
+
username: str | None = None,
|
|
34
|
+
userId: str | None = None,
|
|
35
35
|
**kwargs,
|
|
36
|
-
) ->
|
|
36
|
+
) -> list[dict[str, Any]] | str:
|
|
37
37
|
"""
|
|
38
38
|
Get smart followers for a Twitter account.
|
|
39
39
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from pydantic import BaseModel
|
|
@@ -20,9 +20,9 @@ class GetSectors(CookieFunBaseTool):
|
|
|
20
20
|
description: str = (
|
|
21
21
|
"Returns a list of all available sectors in the CookieFun system."
|
|
22
22
|
)
|
|
23
|
-
args_schema:
|
|
23
|
+
args_schema: type[BaseModel] = GetSectorsInput
|
|
24
24
|
|
|
25
|
-
async def _arun(self, **kwargs) ->
|
|
25
|
+
async def _arun(self, **kwargs) -> list[dict[str, Any]]:
|
|
26
26
|
"""
|
|
27
27
|
Get all available sectors from the CookieFun API.
|
|
28
28
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from enum import IntEnum
|
|
2
|
-
from typing import Any
|
|
2
|
+
from typing import Any
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
@@ -38,17 +38,17 @@ class SearchAccountsInput(BaseModel):
|
|
|
38
38
|
description="Search query to find Twitter accounts that authored tweets matching the criteria"
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
type:
|
|
41
|
+
type: int | None = Field(
|
|
42
42
|
default=None,
|
|
43
43
|
description="Type of tweets to search for: 0 for Original, 1 for Reply, 2 for Quote (leave empty for all types)",
|
|
44
44
|
)
|
|
45
45
|
|
|
46
|
-
sortBy:
|
|
46
|
+
sortBy: int | None = Field(
|
|
47
47
|
default=None,
|
|
48
48
|
description="Sort by: 0 for SmartEngagementPoints, 1 for Impressions, 2 for MatchingTweetsCount",
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
sortOrder:
|
|
51
|
+
sortOrder: int | None = Field(
|
|
52
52
|
default=None,
|
|
53
53
|
description="Sort order: 0 for Ascending, 1 for Descending",
|
|
54
54
|
)
|
|
@@ -59,16 +59,16 @@ class SearchAccounts(CookieFunBaseTool):
|
|
|
59
59
|
|
|
60
60
|
name: str = "cookiefun_search_accounts"
|
|
61
61
|
description: str = "Searches for Twitter accounts that authored tweets matching specified search criteria."
|
|
62
|
-
args_schema:
|
|
62
|
+
args_schema: type[BaseModel] = SearchAccountsInput
|
|
63
63
|
|
|
64
64
|
async def _arun(
|
|
65
65
|
self,
|
|
66
66
|
searchQuery: str,
|
|
67
|
-
type:
|
|
68
|
-
sortBy:
|
|
69
|
-
sortOrder:
|
|
67
|
+
type: int | None = None,
|
|
68
|
+
sortBy: int | None = None,
|
|
69
|
+
sortOrder: int | None = None,
|
|
70
70
|
**kwargs,
|
|
71
|
-
) ->
|
|
71
|
+
) -> list[dict[str, Any]] | str:
|
|
72
72
|
"""
|
|
73
73
|
Search for Twitter accounts based on tweet content.
|
|
74
74
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
7
|
from intentkit.skills.cryptocompare.base import CryptoCompareBaseTool
|
|
9
8
|
from intentkit.skills.cryptocompare.fetch_news import CryptoCompareFetchNews
|
|
@@ -44,7 +43,6 @@ class Config(SkillConfig):
|
|
|
44
43
|
async def get_skills(
|
|
45
44
|
config: "Config",
|
|
46
45
|
is_private: bool,
|
|
47
|
-
store: SkillStoreABC,
|
|
48
46
|
**_,
|
|
49
47
|
) -> list[CryptoCompareBaseTool]:
|
|
50
48
|
"""Get all CryptoCompare skills.
|
|
@@ -52,7 +50,6 @@ async def get_skills(
|
|
|
52
50
|
Args:
|
|
53
51
|
config: The configuration for CryptoCompare skills.
|
|
54
52
|
is_private: Whether to include private skills.
|
|
55
|
-
store: The skill store for persisting data.
|
|
56
53
|
|
|
57
54
|
Returns:
|
|
58
55
|
A list of CryptoCompare skills.
|
|
@@ -69,7 +66,7 @@ async def get_skills(
|
|
|
69
66
|
# Get each skill using the cached getter
|
|
70
67
|
result = []
|
|
71
68
|
for name in available_skills:
|
|
72
|
-
skill = get_cryptocompare_skill(name
|
|
69
|
+
skill = get_cryptocompare_skill(name)
|
|
73
70
|
if skill:
|
|
74
71
|
result.append(skill)
|
|
75
72
|
return result
|
|
@@ -77,13 +74,11 @@ async def get_skills(
|
|
|
77
74
|
|
|
78
75
|
def get_cryptocompare_skill(
|
|
79
76
|
name: str,
|
|
80
|
-
store: SkillStoreABC,
|
|
81
77
|
) -> CryptoCompareBaseTool:
|
|
82
78
|
"""Get a CryptoCompare skill by name.
|
|
83
79
|
|
|
84
80
|
Args:
|
|
85
81
|
name: The name of the skill to get
|
|
86
|
-
store: The skill store for persisting data
|
|
87
82
|
|
|
88
83
|
Returns:
|
|
89
84
|
The requested CryptoCompare skill
|
|
@@ -91,39 +86,27 @@ def get_cryptocompare_skill(
|
|
|
91
86
|
|
|
92
87
|
if name == "fetch_news":
|
|
93
88
|
if name not in _cache:
|
|
94
|
-
_cache[name] = CryptoCompareFetchNews(
|
|
95
|
-
skill_store=store,
|
|
96
|
-
)
|
|
89
|
+
_cache[name] = CryptoCompareFetchNews()
|
|
97
90
|
return _cache[name]
|
|
98
91
|
elif name == "fetch_price":
|
|
99
92
|
if name not in _cache:
|
|
100
|
-
_cache[name] = CryptoCompareFetchPrice(
|
|
101
|
-
skill_store=store,
|
|
102
|
-
)
|
|
93
|
+
_cache[name] = CryptoCompareFetchPrice()
|
|
103
94
|
return _cache[name]
|
|
104
95
|
elif name == "fetch_trading_signals":
|
|
105
96
|
if name not in _cache:
|
|
106
|
-
_cache[name] = CryptoCompareFetchTradingSignals(
|
|
107
|
-
skill_store=store,
|
|
108
|
-
)
|
|
97
|
+
_cache[name] = CryptoCompareFetchTradingSignals()
|
|
109
98
|
return _cache[name]
|
|
110
99
|
elif name == "fetch_top_market_cap":
|
|
111
100
|
if name not in _cache:
|
|
112
|
-
_cache[name] = CryptoCompareFetchTopMarketCap(
|
|
113
|
-
skill_store=store,
|
|
114
|
-
)
|
|
101
|
+
_cache[name] = CryptoCompareFetchTopMarketCap()
|
|
115
102
|
return _cache[name]
|
|
116
103
|
elif name == "fetch_top_exchanges":
|
|
117
104
|
if name not in _cache:
|
|
118
|
-
_cache[name] = CryptoCompareFetchTopExchanges(
|
|
119
|
-
skill_store=store,
|
|
120
|
-
)
|
|
105
|
+
_cache[name] = CryptoCompareFetchTopExchanges()
|
|
121
106
|
return _cache[name]
|
|
122
107
|
elif name == "fetch_top_volume":
|
|
123
108
|
if name not in _cache:
|
|
124
|
-
_cache[name] = CryptoCompareFetchTopVolume(
|
|
125
|
-
skill_store=store,
|
|
126
|
-
)
|
|
109
|
+
_cache[name] = CryptoCompareFetchTopVolume()
|
|
127
110
|
return _cache[name]
|
|
128
111
|
else:
|
|
129
112
|
logger.warning(f"Unknown CryptoCompare skill: {name}")
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""CryptoCompare API implementation and shared schemas."""
|
|
2
2
|
|
|
3
3
|
import time
|
|
4
|
-
from typing import List
|
|
5
4
|
|
|
6
5
|
import httpx
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
@@ -25,7 +24,7 @@ class FetchPriceInput(BaseModel):
|
|
|
25
24
|
...,
|
|
26
25
|
description="Base cryptocurrency symbol to get prices for (e.g., 'BTC', 'ETH')",
|
|
27
26
|
)
|
|
28
|
-
to_symbols:
|
|
27
|
+
to_symbols: list[str] = Field(
|
|
29
28
|
...,
|
|
30
29
|
description="List of target currencies (fiat or crypto) (e.g., ['USD', 'EUR', 'JPY'])",
|
|
31
30
|
)
|
|
@@ -70,7 +69,7 @@ class FetchTopVolumeInput(BaseModel):
|
|
|
70
69
|
|
|
71
70
|
|
|
72
71
|
# API Functions
|
|
73
|
-
async def fetch_price(api_key: str, from_symbol: str, to_symbols:
|
|
72
|
+
async def fetch_price(api_key: str, from_symbol: str, to_symbols: list[str]) -> dict:
|
|
74
73
|
"""
|
|
75
74
|
Fetch current price for a cryptocurrency in multiple currencies.
|
|
76
75
|
"""
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"""Base class for all CryptoCompare tools."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from datetime import datetime, timedelta
|
|
5
|
-
from typing import Any
|
|
4
|
+
from datetime import UTC, datetime, timedelta
|
|
5
|
+
from typing import Any
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
from pydantic import BaseModel, Field
|
|
9
9
|
|
|
10
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
11
10
|
from intentkit.skills.base import IntentKitSkill
|
|
12
11
|
from intentkit.utils.error import RateLimitExceeded
|
|
13
12
|
|
|
@@ -22,38 +21,29 @@ class CryptoCompareBaseTool(IntentKitSkill):
|
|
|
22
21
|
This class provides common functionality for all CryptoCompare API tools:
|
|
23
22
|
- Rate limiting
|
|
24
23
|
- API client handling
|
|
25
|
-
- State management through skill_store
|
|
26
24
|
"""
|
|
27
25
|
|
|
28
26
|
name: str = Field(description="The name of the tool")
|
|
29
27
|
description: str = Field(description="A description of what the tool does")
|
|
30
|
-
args_schema:
|
|
31
|
-
skill_store: SkillStoreABC = Field(
|
|
32
|
-
description="The skill store for persisting data"
|
|
33
|
-
)
|
|
28
|
+
args_schema: type[BaseModel]
|
|
34
29
|
|
|
35
30
|
@property
|
|
36
31
|
def category(self) -> str:
|
|
37
32
|
return "cryptocompare"
|
|
38
33
|
|
|
39
|
-
async def check_rate_limit(
|
|
40
|
-
self, agent_id: str, max_requests: int = 1, interval: int = 15
|
|
41
|
-
) -> None:
|
|
34
|
+
async def check_rate_limit(self, max_requests: int = 1, interval: int = 15) -> None:
|
|
42
35
|
"""Check if the rate limit has been exceeded.
|
|
43
36
|
|
|
44
37
|
Args:
|
|
45
|
-
agent_id: The ID of the agent.
|
|
46
38
|
max_requests: Maximum number of requests allowed within the rate limit window.
|
|
47
39
|
interval: Time interval in minutes for the rate limit window.
|
|
48
40
|
|
|
49
41
|
Raises:
|
|
50
42
|
RateLimitExceeded: If the rate limit has been exceeded.
|
|
51
43
|
"""
|
|
52
|
-
rate_limit = await self.
|
|
53
|
-
agent_id, self.name, "rate_limit"
|
|
54
|
-
)
|
|
44
|
+
rate_limit = await self.get_agent_skill_data("rate_limit")
|
|
55
45
|
|
|
56
|
-
current_time = datetime.now(tz=
|
|
46
|
+
current_time = datetime.now(tz=UTC)
|
|
57
47
|
|
|
58
48
|
if (
|
|
59
49
|
rate_limit
|
|
@@ -65,9 +55,7 @@ class CryptoCompareBaseTool(IntentKitSkill):
|
|
|
65
55
|
raise RateLimitExceeded("Rate limit exceeded")
|
|
66
56
|
|
|
67
57
|
rate_limit["count"] += 1
|
|
68
|
-
await self.
|
|
69
|
-
agent_id, self.name, "rate_limit", rate_limit
|
|
70
|
-
)
|
|
58
|
+
await self.save_agent_skill_data("rate_limit", rate_limit)
|
|
71
59
|
|
|
72
60
|
return
|
|
73
61
|
|
|
@@ -76,13 +64,11 @@ class CryptoCompareBaseTool(IntentKitSkill):
|
|
|
76
64
|
"count": 1,
|
|
77
65
|
"reset_time": (current_time + timedelta(minutes=interval)).isoformat(),
|
|
78
66
|
}
|
|
79
|
-
await self.
|
|
80
|
-
agent_id, self.name, "rate_limit", new_rate_limit
|
|
81
|
-
)
|
|
67
|
+
await self.save_agent_skill_data("rate_limit", new_rate_limit)
|
|
82
68
|
return
|
|
83
69
|
|
|
84
70
|
async def fetch_price(
|
|
85
|
-
self, api_key: str, from_symbol: str, to_symbols:
|
|
71
|
+
self, api_key: str, from_symbol: str, to_symbols: list[str]
|
|
86
72
|
) -> dict:
|
|
87
73
|
"""Fetch current price for a cryptocurrency in multiple currencies.
|
|
88
74
|
|
|
@@ -277,7 +263,7 @@ class CryptoNews(BaseModel):
|
|
|
277
263
|
tags: str
|
|
278
264
|
categories: str
|
|
279
265
|
source: str
|
|
280
|
-
source_info:
|
|
266
|
+
source_info: dict[str, Any] = Field(default_factory=dict)
|
|
281
267
|
|
|
282
268
|
|
|
283
269
|
class CryptoExchange(BaseModel):
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""Tool for fetching cryptocurrency news via CryptoCompare API."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from typing import List, Type
|
|
5
4
|
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
@@ -32,13 +31,13 @@ class CryptoCompareFetchNews(CryptoCompareBaseTool):
|
|
|
32
31
|
|
|
33
32
|
name: str = "cryptocompare_fetch_news"
|
|
34
33
|
description: str = "Fetch the latest cryptocurrency news for a specific token"
|
|
35
|
-
args_schema:
|
|
34
|
+
args_schema: type[BaseModel] = CryptoCompareFetchNewsInput
|
|
36
35
|
|
|
37
36
|
async def _arun(
|
|
38
37
|
self,
|
|
39
38
|
token: str,
|
|
40
39
|
**kwargs,
|
|
41
|
-
) ->
|
|
40
|
+
) -> list[CryptoNews]:
|
|
42
41
|
"""Async implementation of the tool to fetch cryptocurrency news.
|
|
43
42
|
|
|
44
43
|
Args:
|
|
@@ -46,7 +45,7 @@ class CryptoCompareFetchNews(CryptoCompareBaseTool):
|
|
|
46
45
|
config: The configuration for the runnable, containing agent context.
|
|
47
46
|
|
|
48
47
|
Returns:
|
|
49
|
-
|
|
48
|
+
list[CryptoNews]: A list of cryptocurrency news articles.
|
|
50
49
|
|
|
51
50
|
Raises:
|
|
52
51
|
Exception: If there's an error accessing the CryptoCompare API.
|
|
@@ -56,7 +55,7 @@ class CryptoCompareFetchNews(CryptoCompareBaseTool):
|
|
|
56
55
|
skill_config = context.agent.skill_config(self.category)
|
|
57
56
|
|
|
58
57
|
# Check rate limit
|
|
59
|
-
await self.check_rate_limit(
|
|
58
|
+
await self.check_rate_limit(max_requests=5, interval=60)
|
|
60
59
|
|
|
61
60
|
# Get API key from context
|
|
62
61
|
api_key = skill_config.get("api_key")
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""Tool for fetching cryptocurrency prices via CryptoCompare API."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from typing import List, Type
|
|
5
4
|
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
@@ -17,7 +16,7 @@ class CryptoCompareFetchPriceInput(BaseModel):
|
|
|
17
16
|
...,
|
|
18
17
|
description="Base cryptocurrency symbol to get prices for (e.g., 'BTC', 'ETH')",
|
|
19
18
|
)
|
|
20
|
-
to_symbols:
|
|
19
|
+
to_symbols: list[str] = Field(
|
|
21
20
|
...,
|
|
22
21
|
description="List of target currencies (fiat or crypto) (e.g., ['USD', 'EUR', 'JPY'])",
|
|
23
22
|
)
|
|
@@ -40,14 +39,14 @@ class CryptoCompareFetchPrice(CryptoCompareBaseTool):
|
|
|
40
39
|
description: str = (
|
|
41
40
|
"Fetch real-time cryptocurrency price data with multi-currency support"
|
|
42
41
|
)
|
|
43
|
-
args_schema:
|
|
42
|
+
args_schema: type[BaseModel] = CryptoCompareFetchPriceInput
|
|
44
43
|
|
|
45
44
|
async def _arun(
|
|
46
45
|
self,
|
|
47
46
|
from_symbol: str,
|
|
48
|
-
to_symbols:
|
|
47
|
+
to_symbols: list[str],
|
|
49
48
|
**kwargs,
|
|
50
|
-
) ->
|
|
49
|
+
) -> list[CryptoPrice]:
|
|
51
50
|
"""Async implementation of the tool to fetch cryptocurrency prices.
|
|
52
51
|
|
|
53
52
|
Args:
|
|
@@ -56,7 +55,7 @@ class CryptoCompareFetchPrice(CryptoCompareBaseTool):
|
|
|
56
55
|
config: The configuration for the runnable, containing agent context.
|
|
57
56
|
|
|
58
57
|
Returns:
|
|
59
|
-
|
|
58
|
+
list[CryptoPrice]: A list of cryptocurrency prices for each target currency.
|
|
60
59
|
|
|
61
60
|
Raises:
|
|
62
61
|
Exception: If there's an error accessing the CryptoCompare API.
|
|
@@ -66,7 +65,7 @@ class CryptoCompareFetchPrice(CryptoCompareBaseTool):
|
|
|
66
65
|
skill_config = context.agent.skill_config(self.category)
|
|
67
66
|
|
|
68
67
|
# Check rate limit
|
|
69
|
-
await self.check_rate_limit(
|
|
68
|
+
await self.check_rate_limit(max_requests=10, interval=60)
|
|
70
69
|
|
|
71
70
|
# Get API key from context
|
|
72
71
|
api_key = skill_config.get("api_key")
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"""Tool for fetching top exchanges for a cryptocurrency pair via CryptoCompare API."""
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from typing import List, Type
|
|
5
4
|
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
@@ -44,7 +43,7 @@ class CryptoCompareFetchTopExchanges(CryptoCompareBaseTool):
|
|
|
44
43
|
description: str = (
|
|
45
44
|
"Fetch top exchanges for a cryptocurrency trading pair, ranked by volume"
|
|
46
45
|
)
|
|
47
|
-
args_schema:
|
|
46
|
+
args_schema: type[BaseModel] = CryptoCompareFetchTopExchangesInput
|
|
48
47
|
|
|
49
48
|
async def _arun(
|
|
50
49
|
self,
|
|
@@ -52,7 +51,7 @@ class CryptoCompareFetchTopExchanges(CryptoCompareBaseTool):
|
|
|
52
51
|
to_symbol: str = "USD",
|
|
53
52
|
limit: int = 10,
|
|
54
53
|
**kwargs,
|
|
55
|
-
) ->
|
|
54
|
+
) -> list[CryptoExchange]:
|
|
56
55
|
"""Async implementation of the tool to fetch top exchanges for a cryptocurrency pair.
|
|
57
56
|
|
|
58
57
|
Args:
|
|
@@ -62,7 +61,7 @@ class CryptoCompareFetchTopExchanges(CryptoCompareBaseTool):
|
|
|
62
61
|
config: The configuration for the runnable, containing agent context.
|
|
63
62
|
|
|
64
63
|
Returns:
|
|
65
|
-
|
|
64
|
+
list[CryptoExchange]: A list of top exchanges for the specified trading pair.
|
|
66
65
|
|
|
67
66
|
Raises:
|
|
68
67
|
Exception: If there's an error accessing the CryptoCompare API.
|
|
@@ -72,7 +71,7 @@ class CryptoCompareFetchTopExchanges(CryptoCompareBaseTool):
|
|
|
72
71
|
skill_config = context.agent.skill_config(self.category)
|
|
73
72
|
|
|
74
73
|
# Check rate limit
|
|
75
|
-
await self.check_rate_limit(
|
|
74
|
+
await self.check_rate_limit(max_requests=5, interval=60)
|
|
76
75
|
|
|
77
76
|
# Get API key from context
|
|
78
77
|
api_key = skill_config.get("api_key")
|