intentkit 0.6.9.dev1__py3-none-any.whl → 0.6.10.dev1__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/graph.py +17 -2
- intentkit/core/engine.py +29 -30
- intentkit/core/node.py +10 -20
- intentkit/models/agent.py +3 -0
- intentkit/models/chat.py +9 -1
- intentkit/skills/acolyt/ask.py +2 -5
- intentkit/skills/acolyt/base.py +16 -6
- intentkit/skills/aixbt/__init__.py +3 -7
- intentkit/skills/aixbt/projects.py +12 -36
- intentkit/skills/allora/base.py +16 -6
- intentkit/skills/allora/price.py +2 -4
- intentkit/skills/base.py +8 -1
- intentkit/skills/carv/base.py +12 -10
- intentkit/skills/carv/fetch_news.py +90 -92
- intentkit/skills/carv/onchain_query.py +162 -164
- intentkit/skills/carv/token_info_and_price.py +108 -110
- intentkit/skills/chainlist/chain_lookup.py +1 -2
- intentkit/skills/common/current_time.py +1 -2
- intentkit/skills/cookiefun/base.py +20 -12
- intentkit/skills/cookiefun/get_account_details.py +1 -3
- intentkit/skills/cookiefun/get_account_feed.py +1 -3
- intentkit/skills/cookiefun/get_account_smart_followers.py +1 -3
- intentkit/skills/cookiefun/get_sectors.py +2 -3
- intentkit/skills/cookiefun/search_accounts.py +1 -3
- intentkit/skills/cryptocompare/fetch_news.py +3 -4
- intentkit/skills/cryptocompare/fetch_price.py +3 -4
- intentkit/skills/cryptocompare/fetch_top_exchanges.py +3 -4
- intentkit/skills/cryptocompare/fetch_top_market_cap.py +3 -4
- intentkit/skills/cryptocompare/fetch_top_volume.py +3 -4
- intentkit/skills/cryptocompare/fetch_trading_signals.py +3 -4
- intentkit/skills/cryptopanic/base.py +13 -9
- intentkit/skills/cryptopanic/fetch_crypto_news.py +150 -153
- intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +133 -136
- intentkit/skills/dapplooker/base.py +16 -6
- intentkit/skills/dapplooker/dapplooker_token_data.py +2 -4
- intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +2 -3
- intentkit/skills/defillama/coins/fetch_block.py +2 -3
- intentkit/skills/defillama/coins/fetch_current_prices.py +2 -5
- intentkit/skills/defillama/coins/fetch_first_price.py +2 -5
- intentkit/skills/defillama/coins/fetch_historical_prices.py +2 -3
- intentkit/skills/defillama/coins/fetch_price_chart.py +2 -5
- intentkit/skills/defillama/coins/fetch_price_percentage.py +2 -5
- intentkit/skills/defillama/fees/fetch_fees_overview.py +2 -3
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +2 -3
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +2 -3
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +2 -3
- intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +2 -3
- intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +2 -5
- intentkit/skills/defillama/tvl/fetch_chains.py +2 -3
- intentkit/skills/defillama/tvl/fetch_historical_tvl.py +2 -3
- intentkit/skills/defillama/tvl/fetch_protocol.py +2 -5
- intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +2 -5
- intentkit/skills/defillama/tvl/fetch_protocols.py +2 -3
- intentkit/skills/defillama/volumes/fetch_dex_overview.py +2 -3
- intentkit/skills/defillama/volumes/fetch_dex_summary.py +2 -5
- intentkit/skills/defillama/volumes/fetch_options_overview.py +2 -3
- intentkit/skills/defillama/yields/fetch_pool_chart.py +2 -5
- intentkit/skills/defillama/yields/fetch_pools.py +2 -3
- intentkit/skills/dune_analytics/base.py +15 -9
- intentkit/skills/dune_analytics/fetch_kol_buys.py +125 -128
- intentkit/skills/dune_analytics/fetch_nation_metrics.py +234 -237
- intentkit/skills/elfa/base.py +16 -6
- intentkit/skills/elfa/mention.py +2 -7
- intentkit/skills/elfa/stats.py +2 -6
- intentkit/skills/elfa/tokens.py +1 -4
- intentkit/skills/enso/base.py +25 -13
- intentkit/skills/enso/best_yield.py +1 -4
- intentkit/skills/enso/networks.py +2 -5
- intentkit/skills/enso/prices.py +1 -5
- intentkit/skills/enso/route.py +2 -5
- intentkit/skills/enso/tokens.py +1 -4
- intentkit/skills/enso/wallet.py +3 -9
- intentkit/skills/firecrawl/base.py +16 -6
- intentkit/skills/firecrawl/clear.py +1 -3
- intentkit/skills/firecrawl/crawl.py +7 -8
- intentkit/skills/firecrawl/query.py +7 -9
- intentkit/skills/firecrawl/scrape.py +7 -8
- intentkit/skills/github/github_search.py +1 -3
- intentkit/skills/heurist/base.py +15 -0
- intentkit/skills/heurist/image_generation_animagine_xl.py +3 -4
- intentkit/skills/heurist/image_generation_arthemy_comics.py +3 -4
- intentkit/skills/heurist/image_generation_arthemy_real.py +3 -4
- intentkit/skills/heurist/image_generation_braindance.py +3 -4
- intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +3 -4
- intentkit/skills/heurist/image_generation_flux_1_dev.py +3 -4
- intentkit/skills/heurist/image_generation_sdxl.py +3 -4
- intentkit/skills/http/get.py +0 -2
- intentkit/skills/http/post.py +0 -2
- intentkit/skills/http/put.py +0 -2
- intentkit/skills/lifi/token_execute.py +1 -3
- intentkit/skills/lifi/token_quote.py +0 -2
- intentkit/skills/moralis/base.py +15 -1
- intentkit/skills/nation/nft_check.py +2 -5
- intentkit/skills/openai/base.py +14 -5
- intentkit/skills/openai/dalle_image_generation.py +6 -5
- intentkit/skills/openai/gpt_image_generation.py +6 -5
- intentkit/skills/openai/gpt_image_to_image.py +6 -5
- intentkit/skills/openai/image_to_text.py +6 -6
- intentkit/skills/portfolio/base.py +4 -3
- intentkit/skills/portfolio/token_balances.py +2 -4
- intentkit/skills/portfolio/wallet_approvals.py +2 -4
- intentkit/skills/portfolio/wallet_defi_positions.py +3 -4
- intentkit/skills/portfolio/wallet_history.py +2 -4
- intentkit/skills/portfolio/wallet_net_worth.py +2 -4
- intentkit/skills/portfolio/wallet_nfts.py +2 -4
- intentkit/skills/portfolio/wallet_profitability.py +2 -4
- intentkit/skills/portfolio/wallet_profitability_summary.py +2 -4
- intentkit/skills/portfolio/wallet_stats.py +2 -4
- intentkit/skills/portfolio/wallet_swaps.py +2 -4
- intentkit/skills/slack/base.py +18 -0
- intentkit/skills/slack/get_channel.py +3 -4
- intentkit/skills/slack/get_message.py +3 -4
- intentkit/skills/slack/schedule_message.py +3 -4
- intentkit/skills/slack/send_message.py +3 -4
- intentkit/skills/supabase/delete_data.py +3 -6
- intentkit/skills/supabase/fetch_data.py +3 -6
- intentkit/skills/supabase/insert_data.py +3 -6
- intentkit/skills/supabase/invoke_function.py +3 -6
- intentkit/skills/supabase/update_data.py +3 -6
- intentkit/skills/supabase/upsert_data.py +3 -6
- intentkit/skills/system/add_autonomous_task.py +1 -3
- intentkit/skills/system/delete_autonomous_task.py +1 -3
- intentkit/skills/system/edit_autonomous_task.py +1 -3
- intentkit/skills/system/list_autonomous_tasks.py +1 -3
- intentkit/skills/system/read_agent_api_key.py +2 -3
- intentkit/skills/system/regenerate_agent_api_key.py +2 -5
- intentkit/skills/tavily/base.py +14 -5
- intentkit/skills/tavily/tavily_extract.py +7 -8
- intentkit/skills/tavily/tavily_search.py +11 -9
- intentkit/skills/token/base.py +4 -6
- intentkit/skills/token/erc20_transfers.py +2 -4
- intentkit/skills/token/token_analytics.py +2 -4
- intentkit/skills/token/token_price.py +2 -4
- intentkit/skills/token/token_search.py +2 -4
- intentkit/skills/twitter/base.py +41 -0
- intentkit/skills/twitter/follow_user.py +4 -4
- intentkit/skills/twitter/get_mentions.py +4 -4
- intentkit/skills/twitter/get_timeline.py +4 -4
- intentkit/skills/twitter/get_user_by_username.py +4 -4
- intentkit/skills/twitter/get_user_tweets.py +4 -4
- intentkit/skills/twitter/like_tweet.py +4 -4
- intentkit/skills/twitter/post_tweet.py +3 -4
- intentkit/skills/twitter/reply_tweet.py +3 -4
- intentkit/skills/twitter/retweet.py +4 -4
- intentkit/skills/twitter/search_tweets.py +4 -4
- intentkit/skills/unrealspeech/base.py +16 -0
- intentkit/skills/unrealspeech/text_to_speech.py +4 -4
- intentkit/skills/venice_audio/base.py +11 -9
- intentkit/skills/venice_audio/venice_audio.py +238 -240
- intentkit/skills/venice_image/base.py +23 -19
- intentkit/skills/venice_image/image_enhance/image_enhance.py +78 -80
- intentkit/skills/venice_image/image_generation/image_generation_base.py +115 -117
- intentkit/skills/venice_image/image_upscale/image_upscale.py +88 -90
- intentkit/skills/venice_image/image_vision/image_vision.py +98 -100
- intentkit/skills/web_scraper/document_indexer.py +3 -5
- intentkit/skills/web_scraper/scrape_and_index.py +14 -17
- intentkit/skills/web_scraper/website_indexer.py +8 -10
- intentkit/skills/xmtp/README.md +110 -0
- intentkit/skills/xmtp/__init__.py +82 -0
- intentkit/skills/xmtp/base.py +13 -0
- intentkit/skills/xmtp/schema.json +41 -0
- intentkit/skills/xmtp/transfer.py +170 -0
- intentkit/skills/xmtp/xmtp.svg +26 -0
- {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/METADATA +3 -3
- {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/RECORD +168 -162
- {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/WHEEL +0 -0
- {intentkit-0.6.9.dev1.dist-info → intentkit-0.6.10.dev1.dist-info}/licenses/LICENSE +0 -0
|
@@ -3,7 +3,6 @@ from typing import Optional, Type
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from epyxid import XID
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
@@ -61,7 +60,6 @@ class ImageGenerationCyberRealisticXL(HeuristBaseTool):
|
|
|
61
60
|
neg_prompt: Optional[str] = "(worst quality: 1.4), bad quality, nsfw",
|
|
62
61
|
width: Optional[int] = 1024,
|
|
63
62
|
height: Optional[int] = 680,
|
|
64
|
-
config: RunnableConfig = None,
|
|
65
63
|
**kwargs,
|
|
66
64
|
) -> str:
|
|
67
65
|
"""Implementation of the tool to generate hyperrealistic cyberpunk images using Heurist AI's CyberRealisticXL model.
|
|
@@ -76,8 +74,9 @@ class ImageGenerationCyberRealisticXL(HeuristBaseTool):
|
|
|
76
74
|
Returns:
|
|
77
75
|
str: URL of the generated image.
|
|
78
76
|
"""
|
|
79
|
-
context = self.
|
|
80
|
-
skill_config = context.
|
|
77
|
+
context = self.get_context()
|
|
78
|
+
skill_config = context.agent.skill_config(self.category)
|
|
79
|
+
skill_config = skill_config
|
|
81
80
|
|
|
82
81
|
# Get the Heurist API key from the skill store
|
|
83
82
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
@@ -3,7 +3,6 @@ from typing import Optional, Type
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from epyxid import XID
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
@@ -61,7 +60,6 @@ class ImageGenerationFlux1Dev(HeuristBaseTool):
|
|
|
61
60
|
neg_prompt: Optional[str] = "",
|
|
62
61
|
width: Optional[int] = 1024,
|
|
63
62
|
height: Optional[int] = 680,
|
|
64
|
-
config: RunnableConfig = None,
|
|
65
63
|
**kwargs,
|
|
66
64
|
) -> str:
|
|
67
65
|
"""Implementation of the tool to generate images using Heurist AI's Flux.1-dev model.
|
|
@@ -76,8 +74,9 @@ class ImageGenerationFlux1Dev(HeuristBaseTool):
|
|
|
76
74
|
Returns:
|
|
77
75
|
str: URL of the generated image.
|
|
78
76
|
"""
|
|
79
|
-
context = self.
|
|
80
|
-
skill_config = context.
|
|
77
|
+
context = self.get_context()
|
|
78
|
+
skill_config = context.agent.skill_config(self.category)
|
|
79
|
+
skill_config = skill_config
|
|
81
80
|
|
|
82
81
|
# Get the Heurist API key from the skill store
|
|
83
82
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
@@ -3,7 +3,6 @@ from typing import Optional, Type
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from epyxid import XID
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
@@ -61,7 +60,6 @@ class ImageGenerationSDXL(HeuristBaseTool):
|
|
|
61
60
|
neg_prompt: Optional[str] = "(worst quality: 1.4), bad quality, nsfw",
|
|
62
61
|
width: Optional[int] = 1024,
|
|
63
62
|
height: Optional[int] = 680,
|
|
64
|
-
config: RunnableConfig = None,
|
|
65
63
|
**kwargs,
|
|
66
64
|
) -> str:
|
|
67
65
|
"""Implementation of the tool to generate images using Heurist AI's SDXL model.
|
|
@@ -76,8 +74,9 @@ class ImageGenerationSDXL(HeuristBaseTool):
|
|
|
76
74
|
Returns:
|
|
77
75
|
str: URL of the generated image.
|
|
78
76
|
"""
|
|
79
|
-
context = self.
|
|
80
|
-
skill_config = context.
|
|
77
|
+
context = self.get_context()
|
|
78
|
+
skill_config = context.agent.skill_config(self.category)
|
|
79
|
+
skill_config = skill_config
|
|
81
80
|
|
|
82
81
|
# Get the Heurist API key from the skill store
|
|
83
82
|
if "api_key" in skill_config and skill_config["api_key"]:
|
intentkit/skills/http/get.py
CHANGED
|
@@ -2,7 +2,6 @@ import logging
|
|
|
2
2
|
from typing import Any, Dict, Optional, Type
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
7
|
from intentkit.skills.http.base import HttpBaseTool
|
|
@@ -55,7 +54,6 @@ class HttpGet(HttpBaseTool):
|
|
|
55
54
|
headers: Optional[Dict[str, str]] = None,
|
|
56
55
|
params: Optional[Dict[str, Any]] = None,
|
|
57
56
|
timeout: float = 30.0,
|
|
58
|
-
config: RunnableConfig = None,
|
|
59
57
|
**kwargs,
|
|
60
58
|
) -> str:
|
|
61
59
|
"""Implementation of the HTTP GET request.
|
intentkit/skills/http/post.py
CHANGED
|
@@ -2,7 +2,6 @@ import logging
|
|
|
2
2
|
from typing import Any, Dict, Optional, Type, Union
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
7
|
from intentkit.skills.http.base import HttpBaseTool
|
|
@@ -61,7 +60,6 @@ class HttpPost(HttpBaseTool):
|
|
|
61
60
|
headers: Optional[Dict[str, str]] = None,
|
|
62
61
|
params: Optional[Dict[str, Any]] = None,
|
|
63
62
|
timeout: float = 30.0,
|
|
64
|
-
config: RunnableConfig = None,
|
|
65
63
|
**kwargs,
|
|
66
64
|
) -> str:
|
|
67
65
|
"""Implementation of the HTTP POST request.
|
intentkit/skills/http/put.py
CHANGED
|
@@ -2,7 +2,6 @@ import logging
|
|
|
2
2
|
from typing import Any, Dict, Optional, Type, Union
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
7
|
from intentkit.skills.http.base import HttpBaseTool
|
|
@@ -61,7 +60,6 @@ class HttpPut(HttpBaseTool):
|
|
|
61
60
|
headers: Optional[Dict[str, str]] = None,
|
|
62
61
|
params: Optional[Dict[str, Any]] = None,
|
|
63
62
|
timeout: float = 30.0,
|
|
64
|
-
config: RunnableConfig = None,
|
|
65
63
|
**kwargs,
|
|
66
64
|
) -> str:
|
|
67
65
|
"""Implementation of the HTTP PUT request.
|
|
@@ -2,7 +2,6 @@ import asyncio
|
|
|
2
2
|
from typing import Any, Dict, List, Optional, Type
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
from web3 import Web3
|
|
8
7
|
|
|
@@ -99,7 +98,6 @@ class TokenExecute(LiFiBaseTool):
|
|
|
99
98
|
|
|
100
99
|
async def _arun(
|
|
101
100
|
self,
|
|
102
|
-
config: RunnableConfig,
|
|
103
101
|
from_chain: str,
|
|
104
102
|
to_chain: str,
|
|
105
103
|
from_token: str,
|
|
@@ -128,7 +126,7 @@ class TokenExecute(LiFiBaseTool):
|
|
|
128
126
|
return validation_error
|
|
129
127
|
|
|
130
128
|
# Get agent context for CDP wallet
|
|
131
|
-
context = self.
|
|
129
|
+
context = self.get_context()
|
|
132
130
|
agent_id = context.agent_id
|
|
133
131
|
|
|
134
132
|
self.logger.info(
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
from typing import Any, Dict, List, Optional, Type
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
@@ -74,7 +73,6 @@ class TokenQuote(LiFiBaseTool):
|
|
|
74
73
|
|
|
75
74
|
async def _arun(
|
|
76
75
|
self,
|
|
77
|
-
config: RunnableConfig,
|
|
78
76
|
from_chain: str,
|
|
79
77
|
to_chain: str,
|
|
80
78
|
from_token: str,
|
intentkit/skills/moralis/base.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import List, Optional, Type
|
|
4
4
|
|
|
5
|
+
from langchain.tools.base import ToolException
|
|
5
6
|
from pydantic import BaseModel, Field
|
|
6
7
|
|
|
7
8
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
@@ -32,13 +33,26 @@ class WalletBaseTool(IntentKitSkill):
|
|
|
32
33
|
skill_store: SkillStoreABC = Field(
|
|
33
34
|
description="The skill store for persisting data"
|
|
34
35
|
)
|
|
35
|
-
api_key: str = Field(description="API key for Moralis")
|
|
36
36
|
|
|
37
37
|
# Optional fields for blockchain providers
|
|
38
38
|
solana_networks: Optional[List[str]] = Field(
|
|
39
39
|
default=SOLANA_NETWORKS, description="Supported Solana networks"
|
|
40
40
|
)
|
|
41
41
|
|
|
42
|
+
def get_api_key(self) -> str:
|
|
43
|
+
context = self.get_context()
|
|
44
|
+
skill_config = context.agent.skill_config(self.category)
|
|
45
|
+
api_key_provider = skill_config.get("api_key_provider")
|
|
46
|
+
if api_key_provider == "platform":
|
|
47
|
+
return self.skill_store.get_system_config("moralis_api_key")
|
|
48
|
+
# for backward compatibility, may only have api_key in skill_config
|
|
49
|
+
elif skill_config.get("api_key"):
|
|
50
|
+
return skill_config.get("api_key")
|
|
51
|
+
else:
|
|
52
|
+
raise ToolException(
|
|
53
|
+
f"Invalid API key provider: {api_key_provider}, or no api_key in config"
|
|
54
|
+
)
|
|
55
|
+
|
|
42
56
|
@property
|
|
43
57
|
def category(self) -> str:
|
|
44
58
|
return "moralis"
|
|
@@ -3,7 +3,6 @@ from typing import Optional, Type
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from eth_utils import is_address
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from .base import NationBaseTool
|
|
@@ -22,9 +21,7 @@ class NftCheck(NationBaseTool):
|
|
|
22
21
|
description: str = "Check user nation pass NFTs stats in nation, including usage status and linked agents.By default, it will use the user_id as the wallet address. If you want to check other wallet address, please pass the nation_wallet_address parameter."
|
|
23
22
|
args_schema: Type[BaseModel] = NftCheckInput
|
|
24
23
|
|
|
25
|
-
async def _arun(
|
|
26
|
-
self, nation_wallet_address: Optional[str] = None, config: RunnableConfig = None
|
|
27
|
-
) -> str:
|
|
24
|
+
async def _arun(self, nation_wallet_address: Optional[str] = None) -> str:
|
|
28
25
|
"""Implementation of the NFT Check tool.
|
|
29
26
|
|
|
30
27
|
Args:
|
|
@@ -35,7 +32,7 @@ class NftCheck(NationBaseTool):
|
|
|
35
32
|
str: Formatted NFT check results based on the nation wallet address.
|
|
36
33
|
"""
|
|
37
34
|
|
|
38
|
-
context = self.
|
|
35
|
+
context = self.get_context()
|
|
39
36
|
logger.debug(f"nft_check.py: Running NFT check with context {context}")
|
|
40
37
|
|
|
41
38
|
# Use the provided nation_wallet_address or fetch it from the context
|
intentkit/skills/openai/base.py
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
from typing import Type
|
|
4
4
|
|
|
5
|
+
from langchain.tools.base import ToolException
|
|
5
6
|
from pydantic import BaseModel, Field
|
|
6
7
|
|
|
7
8
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
|
-
from intentkit.skills.base import IntentKitSkill
|
|
9
|
+
from intentkit.skills.base import IntentKitSkill
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class OpenAIBaseTool(IntentKitSkill):
|
|
@@ -21,11 +22,19 @@ class OpenAIBaseTool(IntentKitSkill):
|
|
|
21
22
|
description="The skill store for persisting data"
|
|
22
23
|
)
|
|
23
24
|
|
|
24
|
-
def get_api_key(self
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
def get_api_key(self) -> str:
|
|
26
|
+
context = self.get_context()
|
|
27
|
+
skill_config = context.agent.skill_config(self.category)
|
|
28
|
+
api_key_provider = skill_config.get("api_key_provider")
|
|
29
|
+
if api_key_provider == "platform":
|
|
30
|
+
return self.skill_store.get_system_config("openai_api_key")
|
|
31
|
+
# for backward compatibility, may only have api_key in skill_config
|
|
32
|
+
elif skill_config.get("api_key"):
|
|
27
33
|
return skill_config.get("api_key")
|
|
28
|
-
|
|
34
|
+
else:
|
|
35
|
+
raise ToolException(
|
|
36
|
+
f"Invalid API key provider: {api_key_provider}, or no api_key in config"
|
|
37
|
+
)
|
|
29
38
|
|
|
30
39
|
@property
|
|
31
40
|
def category(self) -> str:
|
|
@@ -5,7 +5,6 @@ from typing import Type
|
|
|
5
5
|
|
|
6
6
|
import openai
|
|
7
7
|
from epyxid import XID
|
|
8
|
-
from langchain_core.runnables import RunnableConfig
|
|
9
8
|
from pydantic import BaseModel, Field
|
|
10
9
|
|
|
11
10
|
from intentkit.skills.openai.base import OpenAIBaseTool
|
|
@@ -62,7 +61,6 @@ class DALLEImageGeneration(OpenAIBaseTool):
|
|
|
62
61
|
size: str = "1024x1024",
|
|
63
62
|
quality: str = "hd",
|
|
64
63
|
style: str = "vivid",
|
|
65
|
-
config: RunnableConfig = None,
|
|
66
64
|
**kwargs,
|
|
67
65
|
) -> str:
|
|
68
66
|
"""Implementation of the tool to generate images using OpenAI's DALL-E 3 model.
|
|
@@ -72,7 +70,7 @@ class DALLEImageGeneration(OpenAIBaseTool):
|
|
|
72
70
|
size: Size of the generated image. Options: 1024x1024, 1024x1792, 1792x1024
|
|
73
71
|
quality: Quality of the generated image. Options: standard, hd
|
|
74
72
|
style: Style of the generated image. Options: vivid, natural
|
|
75
|
-
|
|
73
|
+
|
|
76
74
|
|
|
77
75
|
Returns:
|
|
78
76
|
str: URL of the generated image.
|
|
@@ -80,10 +78,13 @@ class DALLEImageGeneration(OpenAIBaseTool):
|
|
|
80
78
|
Raises:
|
|
81
79
|
Exception: If the image generation fails.
|
|
82
80
|
"""
|
|
83
|
-
context = self.
|
|
81
|
+
context = self.get_context()
|
|
82
|
+
skill_config = context.agent.skill_config(self.category)
|
|
84
83
|
|
|
85
84
|
# Get the OpenAI API key from the skill store
|
|
86
|
-
api_key = self.
|
|
85
|
+
api_key = skill_config.get("api_key") or self.skill_store.get_system_config(
|
|
86
|
+
"openai_api_key"
|
|
87
|
+
)
|
|
87
88
|
|
|
88
89
|
# Generate a unique job ID
|
|
89
90
|
job_id = str(XID())
|
|
@@ -6,7 +6,6 @@ from typing import Literal, Type
|
|
|
6
6
|
|
|
7
7
|
import openai
|
|
8
8
|
from epyxid import XID
|
|
9
|
-
from langchain_core.runnables import RunnableConfig
|
|
10
9
|
from pydantic import BaseModel, Field
|
|
11
10
|
|
|
12
11
|
from intentkit.skills.openai.base import OpenAIBaseTool
|
|
@@ -63,7 +62,6 @@ class GPTImageGeneration(OpenAIBaseTool):
|
|
|
63
62
|
size: Literal["1024x1024", "1536x1024", "1024x1536", "auto"] = "auto",
|
|
64
63
|
quality: Literal["high", "medium", "low", "auto"] = "auto",
|
|
65
64
|
background: Literal["transparent", "opaque", "auto"] = "auto",
|
|
66
|
-
config: RunnableConfig = None,
|
|
67
65
|
**kwargs,
|
|
68
66
|
) -> str:
|
|
69
67
|
"""Implementation of the tool to generate images using OpenAI's GPT-Image-1 model.
|
|
@@ -73,7 +71,7 @@ class GPTImageGeneration(OpenAIBaseTool):
|
|
|
73
71
|
size: Size of the generated image. Options: 1024x1024, 1536x1024, 1024x1536, auto
|
|
74
72
|
quality: Quality of the generated image. Options: high, medium, low, auto
|
|
75
73
|
background: Background transparency. Options: transparent, opaque, auto
|
|
76
|
-
|
|
74
|
+
|
|
77
75
|
|
|
78
76
|
Returns:
|
|
79
77
|
str: URL of the generated image.
|
|
@@ -81,10 +79,13 @@ class GPTImageGeneration(OpenAIBaseTool):
|
|
|
81
79
|
Raises:
|
|
82
80
|
Exception: If the image generation fails.
|
|
83
81
|
"""
|
|
84
|
-
context = self.
|
|
82
|
+
context = self.get_context()
|
|
83
|
+
skill_config = context.agent.skill_config(self.category)
|
|
85
84
|
|
|
86
85
|
# Get the OpenAI API key from the skill store
|
|
87
|
-
api_key = self.
|
|
86
|
+
api_key = skill_config.get("api_key") or self.skill_store.get_system_config(
|
|
87
|
+
"openai_api_key"
|
|
88
|
+
)
|
|
88
89
|
|
|
89
90
|
# Generate a unique job ID
|
|
90
91
|
job_id = str(XID())
|
|
@@ -8,7 +8,6 @@ from typing import Literal, Type
|
|
|
8
8
|
import httpx
|
|
9
9
|
import openai
|
|
10
10
|
from epyxid import XID
|
|
11
|
-
from langchain_core.runnables import RunnableConfig
|
|
12
11
|
from pydantic import BaseModel, Field
|
|
13
12
|
|
|
14
13
|
from intentkit.skills.openai.base import OpenAIBaseTool
|
|
@@ -64,7 +63,6 @@ class GPTImageToImage(OpenAIBaseTool):
|
|
|
64
63
|
prompt: str,
|
|
65
64
|
size: Literal["1024x1024", "1536x1024", "1024x1536", "auto"] = "auto",
|
|
66
65
|
quality: Literal["high", "medium", "low", "auto"] = "auto",
|
|
67
|
-
config: RunnableConfig = None,
|
|
68
66
|
**kwargs,
|
|
69
67
|
) -> str:
|
|
70
68
|
"""Implementation of the tool to edit images using OpenAI's GPT-Image-1 model.
|
|
@@ -74,7 +72,7 @@ class GPTImageToImage(OpenAIBaseTool):
|
|
|
74
72
|
prompt: Text prompt describing the desired edits to the image.
|
|
75
73
|
size: Size of the generated image. Options: 1024x1024, 1536x1024, 1024x1536, auto
|
|
76
74
|
quality: Quality of the generated image. Options: high, medium, low, auto
|
|
77
|
-
|
|
75
|
+
|
|
78
76
|
|
|
79
77
|
Returns:
|
|
80
78
|
str: URL of the edited image.
|
|
@@ -82,10 +80,13 @@ class GPTImageToImage(OpenAIBaseTool):
|
|
|
82
80
|
Raises:
|
|
83
81
|
Exception: If the image editing fails.
|
|
84
82
|
"""
|
|
85
|
-
context = self.
|
|
83
|
+
context = self.get_context()
|
|
84
|
+
skill_config = context.agent.skill_config(self.category)
|
|
86
85
|
|
|
87
86
|
# Get the OpenAI API key from the skill store
|
|
88
|
-
api_key = self.
|
|
87
|
+
api_key = skill_config.get("api_key") or self.skill_store.get_system_config(
|
|
88
|
+
"openai_api_key"
|
|
89
|
+
)
|
|
89
90
|
|
|
90
91
|
# Generate a unique job ID
|
|
91
92
|
job_id = str(XID())
|
|
@@ -4,7 +4,6 @@ from typing import Type
|
|
|
4
4
|
|
|
5
5
|
import aiohttp
|
|
6
6
|
import openai
|
|
7
|
-
from langchain_core.runnables import RunnableConfig
|
|
8
7
|
from PIL import Image
|
|
9
8
|
from pydantic import BaseModel, Field
|
|
10
9
|
|
|
@@ -49,9 +48,7 @@ class ImageToText(OpenAIBaseTool):
|
|
|
49
48
|
)
|
|
50
49
|
args_schema: Type[BaseModel] = ImageToTextInput
|
|
51
50
|
|
|
52
|
-
async def _arun(
|
|
53
|
-
self, image: str, config: RunnableConfig, **kwargs
|
|
54
|
-
) -> ImageToTextOutput:
|
|
51
|
+
async def _arun(self, image: str, **kwargs) -> ImageToTextOutput:
|
|
55
52
|
"""Implementation of the tool to convert images to text.
|
|
56
53
|
|
|
57
54
|
Args:
|
|
@@ -60,11 +57,14 @@ class ImageToText(OpenAIBaseTool):
|
|
|
60
57
|
Returns:
|
|
61
58
|
ImageToTextOutput: Object containing the text description and image dimensions.
|
|
62
59
|
"""
|
|
63
|
-
context = self.
|
|
60
|
+
context = self.get_context()
|
|
61
|
+
skill_config = context.agent.skill_config(self.category)
|
|
64
62
|
logger.debug(f"context: {context}")
|
|
65
63
|
|
|
66
64
|
# Get the OpenAI client from the skill store
|
|
67
|
-
api_key = self.
|
|
65
|
+
api_key = skill_config.get("api_key") or self.skill_store.get_system_config(
|
|
66
|
+
"openai_api_key"
|
|
67
|
+
)
|
|
68
68
|
client = openai.AsyncOpenAI(api_key=api_key)
|
|
69
69
|
|
|
70
70
|
try:
|
|
@@ -9,7 +9,7 @@ import aiohttp
|
|
|
9
9
|
from pydantic import BaseModel, Field
|
|
10
10
|
|
|
11
11
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
12
|
-
from intentkit.skills.base import IntentKitSkill
|
|
12
|
+
from intentkit.skills.base import IntentKitSkill
|
|
13
13
|
from intentkit.skills.portfolio.constants import MORALIS_API_BASE_URL
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
@@ -25,8 +25,9 @@ class PortfolioBaseTool(IntentKitSkill, ABC):
|
|
|
25
25
|
description="The skill store for persisting data"
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
def get_api_key(self
|
|
29
|
-
|
|
28
|
+
def get_api_key(self) -> str:
|
|
29
|
+
context = self.get_context()
|
|
30
|
+
skill_config = context.agent.skill_config(self.category)
|
|
30
31
|
if skill_config.get("api_key_provider") == "agent_owner":
|
|
31
32
|
return skill_config.get("api_key")
|
|
32
33
|
return self.skill_store.get_system_config("moralis_api_key")
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Dict, List, Optional, Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
@@ -86,7 +85,6 @@ class TokenBalances(PortfolioBaseTool):
|
|
|
86
85
|
exclude_native: Optional[bool] = None,
|
|
87
86
|
max_token_inactivity: Optional[int] = None,
|
|
88
87
|
min_pair_side_liquidity_usd: Optional[float] = None,
|
|
89
|
-
config: RunnableConfig = None,
|
|
90
88
|
**kwargs,
|
|
91
89
|
) -> Dict[str, Any]:
|
|
92
90
|
"""Fetch token balances from Moralis.
|
|
@@ -108,13 +106,13 @@ class TokenBalances(PortfolioBaseTool):
|
|
|
108
106
|
Returns:
|
|
109
107
|
Dict containing token balances data
|
|
110
108
|
"""
|
|
111
|
-
context = self.
|
|
109
|
+
context = self.get_context()
|
|
112
110
|
logger.debug(
|
|
113
111
|
f"token_balances.py: Fetching token balances with context {context}"
|
|
114
112
|
)
|
|
115
113
|
|
|
116
114
|
# Get the API key from the agent's configuration
|
|
117
|
-
api_key = self.get_api_key(
|
|
115
|
+
api_key = self.get_api_key()
|
|
118
116
|
if not api_key:
|
|
119
117
|
return {"error": "No Moralis API key provided in the configuration."}
|
|
120
118
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Dict, Optional, Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
@@ -51,7 +50,6 @@ class WalletApprovals(PortfolioBaseTool):
|
|
|
51
50
|
chain: str = DEFAULT_CHAIN,
|
|
52
51
|
cursor: Optional[str] = None,
|
|
53
52
|
limit: Optional[int] = DEFAULT_LIMIT,
|
|
54
|
-
config: RunnableConfig = None,
|
|
55
53
|
**kwargs,
|
|
56
54
|
) -> Dict[str, Any]:
|
|
57
55
|
"""Fetch wallet token approvals from Moralis.
|
|
@@ -66,13 +64,13 @@ class WalletApprovals(PortfolioBaseTool):
|
|
|
66
64
|
Returns:
|
|
67
65
|
Dict containing wallet approvals data
|
|
68
66
|
"""
|
|
69
|
-
context = self.
|
|
67
|
+
context = self.get_context()
|
|
70
68
|
logger.debug(
|
|
71
69
|
f"wallet_approvals.py: Fetching wallet approvals with context {context}"
|
|
72
70
|
)
|
|
73
71
|
|
|
74
72
|
# Get the API key from the agent's configuration
|
|
75
|
-
api_key = self.get_api_key(
|
|
73
|
+
api_key = self.get_api_key()
|
|
76
74
|
if not api_key:
|
|
77
75
|
return {"error": "No Moralis API key provided in the configuration."}
|
|
78
76
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Dict, Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
@@ -38,7 +37,6 @@ class WalletDefiPositions(PortfolioBaseTool):
|
|
|
38
37
|
self,
|
|
39
38
|
address: str,
|
|
40
39
|
chain: str = DEFAULT_CHAIN,
|
|
41
|
-
config: RunnableConfig = None,
|
|
42
40
|
**kwargs,
|
|
43
41
|
) -> Dict[str, Any]:
|
|
44
42
|
"""Fetch wallet DeFi positions from Moralis.
|
|
@@ -51,13 +49,14 @@ class WalletDefiPositions(PortfolioBaseTool):
|
|
|
51
49
|
Returns:
|
|
52
50
|
Dict containing DeFi positions data
|
|
53
51
|
"""
|
|
54
|
-
context = self.
|
|
52
|
+
context = self.get_context()
|
|
53
|
+
skill_config = context.agent.skill_config(self.category)
|
|
55
54
|
logger.debug(
|
|
56
55
|
f"wallet_defi_positions.py: Fetching wallet DeFi positions with context {context}"
|
|
57
56
|
)
|
|
58
57
|
|
|
59
58
|
# Get the API key from the agent's configuration
|
|
60
|
-
api_key =
|
|
59
|
+
api_key = skill_config.get("api_key")
|
|
61
60
|
if not api_key:
|
|
62
61
|
return {"error": "No Moralis API key provided in the configuration."}
|
|
63
62
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Dict, Optional, Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
@@ -89,7 +88,6 @@ class WalletHistory(PortfolioBaseTool):
|
|
|
89
88
|
include_internal_transactions: Optional[bool] = None,
|
|
90
89
|
nft_metadata: Optional[bool] = None,
|
|
91
90
|
order: Optional[str] = DEFAULT_ORDER,
|
|
92
|
-
config: RunnableConfig = None,
|
|
93
91
|
**kwargs,
|
|
94
92
|
) -> Dict[str, Any]:
|
|
95
93
|
"""Fetch wallet transaction history from Moralis.
|
|
@@ -111,13 +109,13 @@ class WalletHistory(PortfolioBaseTool):
|
|
|
111
109
|
Returns:
|
|
112
110
|
Dict containing transaction history data
|
|
113
111
|
"""
|
|
114
|
-
context = self.
|
|
112
|
+
context = self.get_context()
|
|
115
113
|
logger.debug(
|
|
116
114
|
f"wallet_history.py: Fetching wallet history with context {context}"
|
|
117
115
|
)
|
|
118
116
|
|
|
119
117
|
# Get the API key from the agent's configuration
|
|
120
|
-
api_key = self.get_api_key(
|
|
118
|
+
api_key = self.get_api_key()
|
|
121
119
|
if not api_key:
|
|
122
120
|
return {"error": "No Moralis API key provided in the configuration."}
|
|
123
121
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Dict, List, Optional, Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
@@ -57,7 +56,6 @@ class WalletNetWorth(PortfolioBaseTool):
|
|
|
57
56
|
exclude_unverified_contracts: Optional[bool] = True,
|
|
58
57
|
max_token_inactivity: Optional[int] = 1,
|
|
59
58
|
min_pair_side_liquidity_usd: Optional[float] = 1000,
|
|
60
|
-
config: RunnableConfig = None,
|
|
61
59
|
**kwargs,
|
|
62
60
|
) -> Dict[str, Any]:
|
|
63
61
|
"""Calculate wallet net worth from Moralis.
|
|
@@ -74,13 +72,13 @@ class WalletNetWorth(PortfolioBaseTool):
|
|
|
74
72
|
Returns:
|
|
75
73
|
Dict containing wallet net worth data
|
|
76
74
|
"""
|
|
77
|
-
context = self.
|
|
75
|
+
context = self.get_context()
|
|
78
76
|
logger.debug(
|
|
79
77
|
f"wallet_net_worth.py: Calculating wallet net worth with context {context}"
|
|
80
78
|
)
|
|
81
79
|
|
|
82
80
|
# Get the API key from the agent's configuration
|
|
83
|
-
api_key = self.get_api_key(
|
|
81
|
+
api_key = self.get_api_key()
|
|
84
82
|
if not api_key:
|
|
85
83
|
return {"error": "No Moralis API key provided in the configuration."}
|
|
86
84
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Any, Dict, List, Optional, Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.portfolio.base import PortfolioBaseTool
|
|
@@ -78,7 +77,6 @@ class WalletNFTs(PortfolioBaseTool):
|
|
|
78
77
|
normalize_metadata: Optional[bool] = True,
|
|
79
78
|
media_items: Optional[bool] = False,
|
|
80
79
|
include_prices: Optional[bool] = False,
|
|
81
|
-
config: RunnableConfig = None,
|
|
82
80
|
**kwargs,
|
|
83
81
|
) -> Dict[str, Any]:
|
|
84
82
|
"""Fetch NFTs owned by a wallet from Moralis.
|
|
@@ -99,11 +97,11 @@ class WalletNFTs(PortfolioBaseTool):
|
|
|
99
97
|
Returns:
|
|
100
98
|
Dict containing wallet NFTs data
|
|
101
99
|
"""
|
|
102
|
-
context = self.
|
|
100
|
+
context = self.get_context()
|
|
103
101
|
logger.debug(f"wallet_nfts.py: Fetching wallet NFTs with context {context}")
|
|
104
102
|
|
|
105
103
|
# Get the API key from the agent's configuration
|
|
106
|
-
api_key = self.get_api_key(
|
|
104
|
+
api_key = self.get_api_key()
|
|
107
105
|
if not api_key:
|
|
108
106
|
return {"error": "No Moralis API key provided in the configuration."}
|
|
109
107
|
|