intentkit 0.6.9.dev2__py3-none-any.whl → 0.6.10.dev2__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 +49 -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 +15 -0
- intentkit/skills/xmtp/schema.json +41 -0
- intentkit/skills/xmtp/transfer.py +155 -0
- intentkit/skills/xmtp/xmtp.svg +26 -0
- {intentkit-0.6.9.dev2.dist-info → intentkit-0.6.10.dev2.dist-info}/METADATA +3 -3
- {intentkit-0.6.9.dev2.dist-info → intentkit-0.6.10.dev2.dist-info}/RECORD +168 -162
- {intentkit-0.6.9.dev2.dist-info → intentkit-0.6.10.dev2.dist-info}/WHEEL +0 -0
- {intentkit-0.6.9.dev2.dist-info → intentkit-0.6.10.dev2.dist-info}/licenses/LICENSE +0 -0
intentkit/skills/enso/base.py
CHANGED
|
@@ -2,11 +2,13 @@ from typing import Optional, Type
|
|
|
2
2
|
|
|
3
3
|
from cdp import EvmServerAccount
|
|
4
4
|
from coinbase_agentkit import CdpEvmServerWalletProvider
|
|
5
|
+
from langchain.tools.base import ToolException
|
|
5
6
|
from pydantic import BaseModel, Field
|
|
6
7
|
|
|
8
|
+
from intentkit.abstracts.graph import AgentContext
|
|
7
9
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
8
10
|
from intentkit.clients import CdpClient, get_cdp_client
|
|
9
|
-
from intentkit.skills.base import IntentKitSkill
|
|
11
|
+
from intentkit.skills.base import IntentKitSkill
|
|
10
12
|
from intentkit.utils.chain import ChainProvider, NetworkId
|
|
11
13
|
|
|
12
14
|
base_url = "https://api.enso.finance"
|
|
@@ -23,7 +25,7 @@ class EnsoBaseTool(IntentKitSkill):
|
|
|
23
25
|
description="The skill store for persisting data"
|
|
24
26
|
)
|
|
25
27
|
|
|
26
|
-
async def get_account(self, context:
|
|
28
|
+
async def get_account(self, context: AgentContext) -> Optional[EvmServerAccount]:
|
|
27
29
|
"""Get the account object from the CDP client.
|
|
28
30
|
|
|
29
31
|
Args:
|
|
@@ -32,11 +34,11 @@ class EnsoBaseTool(IntentKitSkill):
|
|
|
32
34
|
Returns:
|
|
33
35
|
Optional[EvmServerAccount]: The account object if available.
|
|
34
36
|
"""
|
|
35
|
-
client: CdpClient = await get_cdp_client(context.
|
|
37
|
+
client: CdpClient = await get_cdp_client(context.agent.id, self.skill_store)
|
|
36
38
|
return await client.get_account()
|
|
37
39
|
|
|
38
40
|
async def get_wallet_provider(
|
|
39
|
-
self, context:
|
|
41
|
+
self, context: AgentContext
|
|
40
42
|
) -> Optional[CdpEvmServerWalletProvider]:
|
|
41
43
|
"""Get the wallet provider from the CDP client.
|
|
42
44
|
|
|
@@ -46,21 +48,31 @@ class EnsoBaseTool(IntentKitSkill):
|
|
|
46
48
|
Returns:
|
|
47
49
|
Optional[CdpEvmServerWalletProvider]: The wallet provider if available.
|
|
48
50
|
"""
|
|
49
|
-
client: CdpClient = await get_cdp_client(context.
|
|
51
|
+
client: CdpClient = await get_cdp_client(context.agent.id, self.skill_store)
|
|
50
52
|
return await client.get_wallet_provider()
|
|
51
53
|
|
|
52
|
-
def get_chain_provider(self, context:
|
|
54
|
+
def get_chain_provider(self, context: AgentContext) -> Optional[ChainProvider]:
|
|
53
55
|
return self.skill_store.get_system_config("chain_provider")
|
|
54
56
|
|
|
55
|
-
def get_main_tokens(self, context:
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
def get_main_tokens(self, context: AgentContext) -> list[str]:
|
|
58
|
+
skill_config = context.agent.skill_config(self.category)
|
|
59
|
+
if "main_tokens" in skill_config and skill_config["main_tokens"]:
|
|
60
|
+
return skill_config["main_tokens"]
|
|
58
61
|
return []
|
|
59
62
|
|
|
60
|
-
def
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
def get_api_key(self) -> str:
|
|
64
|
+
context = self.get_context()
|
|
65
|
+
skill_config = context.agent.skill_config(self.category)
|
|
66
|
+
api_key_provider = skill_config.get("api_key_provider")
|
|
67
|
+
if api_key_provider == "platform":
|
|
68
|
+
return self.skill_store.get_system_config("enso_api_token")
|
|
69
|
+
# for backward compatibility, may only have api_token in skill_config
|
|
70
|
+
elif skill_config.get("api_token"):
|
|
71
|
+
return skill_config.get("api_token")
|
|
72
|
+
else:
|
|
73
|
+
raise ToolException(
|
|
74
|
+
f"Invalid API key provider: {api_key_provider}, or no api_token in config"
|
|
75
|
+
)
|
|
64
76
|
|
|
65
77
|
@property
|
|
66
78
|
def category(self) -> str:
|
|
@@ -2,10 +2,8 @@ from typing import List, Optional, Type
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from langchain.tools.base import ToolException
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
|
-
from intentkit.skills.base import SkillContext
|
|
9
7
|
from intentkit.skills.enso.base import (
|
|
10
8
|
EnsoBaseTool,
|
|
11
9
|
base_url,
|
|
@@ -81,7 +79,6 @@ class EnsoGetBestYield(EnsoBaseTool):
|
|
|
81
79
|
|
|
82
80
|
async def _arun(
|
|
83
81
|
self,
|
|
84
|
-
config: RunnableConfig,
|
|
85
82
|
token_symbol: str = "USDC",
|
|
86
83
|
chain_id: int = BASE_CHAIN_ID,
|
|
87
84
|
top_n: int = 5,
|
|
@@ -101,7 +98,7 @@ class EnsoGetBestYield(EnsoBaseTool):
|
|
|
101
98
|
Raises:
|
|
102
99
|
ToolException: If there's an error accessing the Enso API.
|
|
103
100
|
"""
|
|
104
|
-
context
|
|
101
|
+
context = self.get_context()
|
|
105
102
|
api_token = self.get_api_token(context)
|
|
106
103
|
|
|
107
104
|
if not api_token:
|
|
@@ -3,11 +3,8 @@ from typing import Type
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from langchain.tools.base import ToolException
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
|
-
from intentkit.skills.base import SkillContext
|
|
10
|
-
|
|
11
8
|
from .base import EnsoBaseTool, base_url
|
|
12
9
|
|
|
13
10
|
logger = logging.getLogger(__name__)
|
|
@@ -50,7 +47,7 @@ class EnsoGetNetworks(EnsoBaseTool):
|
|
|
50
47
|
description: str = "Retrieve networks supported by the Enso API"
|
|
51
48
|
args_schema: Type[BaseModel] = EnsoGetNetworksInput
|
|
52
49
|
|
|
53
|
-
async def _arun(self,
|
|
50
|
+
async def _arun(self, **kwargs) -> EnsoGetNetworksOutput:
|
|
54
51
|
"""
|
|
55
52
|
Function to request the list of supported networks and their chain id and name.
|
|
56
53
|
|
|
@@ -59,7 +56,7 @@ class EnsoGetNetworks(EnsoBaseTool):
|
|
|
59
56
|
"""
|
|
60
57
|
url = f"{base_url}/api/v1/networks"
|
|
61
58
|
|
|
62
|
-
context
|
|
59
|
+
context = self.get_context()
|
|
63
60
|
api_token = self.get_api_token(context)
|
|
64
61
|
logger.debug(f"api_token: {api_token}")
|
|
65
62
|
headers = {
|
intentkit/skills/enso/prices.py
CHANGED
|
@@ -2,11 +2,8 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from langchain.tools.base import ToolException
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
|
-
from intentkit.skills.base import SkillContext
|
|
9
|
-
|
|
10
7
|
from .base import EnsoBaseTool, base_url, default_chain_id
|
|
11
8
|
|
|
12
9
|
|
|
@@ -46,7 +43,6 @@ class EnsoGetPrices(EnsoBaseTool):
|
|
|
46
43
|
async def _arun(
|
|
47
44
|
self,
|
|
48
45
|
address: str,
|
|
49
|
-
config: RunnableConfig,
|
|
50
46
|
chainId: int = default_chain_id,
|
|
51
47
|
**kwargs,
|
|
52
48
|
) -> EnsoGetPricesOutput:
|
|
@@ -62,7 +58,7 @@ class EnsoGetPrices(EnsoBaseTool):
|
|
|
62
58
|
"""
|
|
63
59
|
url = f"{base_url}/api/v1/prices/{str(chainId)}/{address}"
|
|
64
60
|
|
|
65
|
-
context
|
|
61
|
+
context = self.get_context()
|
|
66
62
|
api_token = self.get_api_token(context)
|
|
67
63
|
|
|
68
64
|
headers = {
|
intentkit/skills/enso/route.py
CHANGED
|
@@ -2,10 +2,8 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from langchain.tools.base import ToolException
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
|
-
from intentkit.skills.base import SkillContext
|
|
9
7
|
from intentkit.skills.enso.networks import EnsoGetNetworks
|
|
10
8
|
|
|
11
9
|
from .base import EnsoBaseTool, base_url, default_chain_id
|
|
@@ -164,7 +162,6 @@ class EnsoRouteShortcut(EnsoBaseTool):
|
|
|
164
162
|
amountIn: list[int],
|
|
165
163
|
tokenIn: list[str],
|
|
166
164
|
tokenOut: list[str],
|
|
167
|
-
config: RunnableConfig,
|
|
168
165
|
chainId: int = default_chain_id,
|
|
169
166
|
broadcast_requested: bool = False,
|
|
170
167
|
**kwargs,
|
|
@@ -183,7 +180,7 @@ class EnsoRouteShortcut(EnsoBaseTool):
|
|
|
183
180
|
EnsoRouteShortcutOutput: The response containing route shortcut information.
|
|
184
181
|
"""
|
|
185
182
|
|
|
186
|
-
context
|
|
183
|
+
context = self.get_context()
|
|
187
184
|
agent_id = context.agent_id
|
|
188
185
|
api_token = self.get_api_token(context)
|
|
189
186
|
account = await self.get_account(context)
|
|
@@ -204,7 +201,7 @@ class EnsoRouteShortcut(EnsoBaseTool):
|
|
|
204
201
|
if network_name is None:
|
|
205
202
|
networks = await EnsoGetNetworks(
|
|
206
203
|
skill_store=self.skill_store,
|
|
207
|
-
).arun(
|
|
204
|
+
).arun()
|
|
208
205
|
|
|
209
206
|
for network in networks.res:
|
|
210
207
|
if network.id == chainId:
|
intentkit/skills/enso/tokens.py
CHANGED
|
@@ -2,10 +2,8 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from langchain.tools.base import ToolException
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
|
-
from intentkit.skills.base import SkillContext
|
|
9
7
|
from intentkit.skills.enso.base import (
|
|
10
8
|
EnsoBaseTool,
|
|
11
9
|
base_url,
|
|
@@ -140,7 +138,6 @@ class EnsoGetTokens(EnsoBaseTool):
|
|
|
140
138
|
|
|
141
139
|
async def _arun(
|
|
142
140
|
self,
|
|
143
|
-
config: RunnableConfig,
|
|
144
141
|
chainId: int = default_chain_id,
|
|
145
142
|
protocolSlug: str | None = None,
|
|
146
143
|
**kwargs,
|
|
@@ -157,7 +154,7 @@ class EnsoGetTokens(EnsoBaseTool):
|
|
|
157
154
|
"""
|
|
158
155
|
url = f"{base_url}/api/v1/tokens"
|
|
159
156
|
|
|
160
|
-
context
|
|
157
|
+
context = self.get_context()
|
|
161
158
|
agent_id = context.agent_id
|
|
162
159
|
api_token = self.get_api_token(context)
|
|
163
160
|
main_tokens = self.get_main_tokens(context)
|
intentkit/skills/enso/wallet.py
CHANGED
|
@@ -2,11 +2,8 @@ from typing import Literal, Tuple, Type
|
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
from langchain.tools.base import ToolException
|
|
5
|
-
from langchain_core.runnables import RunnableConfig
|
|
6
5
|
from pydantic import BaseModel, Field
|
|
7
6
|
|
|
8
|
-
from intentkit.skills.base import SkillContext
|
|
9
|
-
|
|
10
7
|
from .base import EnsoBaseTool, base_url, default_chain_id
|
|
11
8
|
|
|
12
9
|
|
|
@@ -62,7 +59,6 @@ class EnsoGetWalletBalances(EnsoBaseTool):
|
|
|
62
59
|
|
|
63
60
|
async def _arun(
|
|
64
61
|
self,
|
|
65
|
-
config: RunnableConfig,
|
|
66
62
|
chainId: int = default_chain_id,
|
|
67
63
|
**kwargs,
|
|
68
64
|
) -> EnsoGetBalancesOutput:
|
|
@@ -77,7 +73,7 @@ class EnsoGetWalletBalances(EnsoBaseTool):
|
|
|
77
73
|
"""
|
|
78
74
|
url = f"{base_url}/api/v1/wallet/balances"
|
|
79
75
|
|
|
80
|
-
context
|
|
76
|
+
context = self.get_context()
|
|
81
77
|
api_token = self.get_api_token(context)
|
|
82
78
|
account = await self.get_account(context)
|
|
83
79
|
headers = {
|
|
@@ -158,7 +154,6 @@ class EnsoGetWalletApprovals(EnsoBaseTool):
|
|
|
158
154
|
|
|
159
155
|
async def _arun(
|
|
160
156
|
self,
|
|
161
|
-
config: RunnableConfig,
|
|
162
157
|
chainId: int = default_chain_id,
|
|
163
158
|
**kwargs,
|
|
164
159
|
) -> EnsoGetApprovalsOutput:
|
|
@@ -174,7 +169,7 @@ class EnsoGetWalletApprovals(EnsoBaseTool):
|
|
|
174
169
|
"""
|
|
175
170
|
url = f"{base_url}/api/v1/wallet/approvals"
|
|
176
171
|
|
|
177
|
-
context
|
|
172
|
+
context = self.get_context()
|
|
178
173
|
api_token = self.get_api_token(context)
|
|
179
174
|
account = await self.get_account(context)
|
|
180
175
|
|
|
@@ -297,7 +292,6 @@ class EnsoWalletApprove(EnsoBaseTool):
|
|
|
297
292
|
self,
|
|
298
293
|
tokenAddress: str,
|
|
299
294
|
amount: int,
|
|
300
|
-
config: RunnableConfig,
|
|
301
295
|
chainId: int = default_chain_id,
|
|
302
296
|
**kwargs,
|
|
303
297
|
) -> Tuple[EnsoWalletApproveOutput, EnsoWalletApproveArtifact]:
|
|
@@ -314,7 +308,7 @@ class EnsoWalletApprove(EnsoBaseTool):
|
|
|
314
308
|
Tuple[EnsoBroadcastWalletApproveOutput, EnsoBroadcastWalletApproveArtifact]: The list of approve transaction output or an error message.
|
|
315
309
|
"""
|
|
316
310
|
url = f"{base_url}/api/v1/wallet/approve"
|
|
317
|
-
context
|
|
311
|
+
context = self.get_context()
|
|
318
312
|
api_token = self.get_api_token(context)
|
|
319
313
|
account = await self.get_account(context)
|
|
320
314
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
from typing import Type
|
|
2
2
|
|
|
3
|
+
from langchain.tools.base import ToolException
|
|
3
4
|
from pydantic import BaseModel, Field
|
|
4
5
|
|
|
5
6
|
from intentkit.abstracts.skill import SkillStoreABC
|
|
6
|
-
from intentkit.skills.base import IntentKitSkill
|
|
7
|
+
from intentkit.skills.base import IntentKitSkill
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class FirecrawlBaseTool(IntentKitSkill):
|
|
@@ -16,12 +17,21 @@ class FirecrawlBaseTool(IntentKitSkill):
|
|
|
16
17
|
description="The skill store for persisting data"
|
|
17
18
|
)
|
|
18
19
|
|
|
19
|
-
def get_api_key(self
|
|
20
|
+
def get_api_key(self) -> str:
|
|
20
21
|
"""Get the Firecrawl API key from configuration."""
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
context = self.get_context()
|
|
23
|
+
skill_config = context.agent.skill_config(self.category)
|
|
24
|
+
api_key_provider = skill_config.get("api_key_provider")
|
|
25
|
+
if api_key_provider == "agent_owner":
|
|
26
|
+
api_key = skill_config.get("api_key")
|
|
27
|
+
if api_key:
|
|
28
|
+
return api_key
|
|
29
|
+
else:
|
|
30
|
+
raise ToolException("No api_key found in agent_owner configuration")
|
|
31
|
+
else:
|
|
32
|
+
raise ToolException(
|
|
33
|
+
f"Invalid API key provider: {api_key_provider}. Only 'agent_owner' is supported for Firecrawl."
|
|
34
|
+
)
|
|
25
35
|
|
|
26
36
|
@property
|
|
27
37
|
def category(self) -> str:
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.firecrawl.base import FirecrawlBaseTool
|
|
@@ -36,7 +35,6 @@ class FirecrawlClearIndexedContent(FirecrawlBaseTool):
|
|
|
36
35
|
async def _arun(
|
|
37
36
|
self,
|
|
38
37
|
confirm: bool = False,
|
|
39
|
-
config: RunnableConfig = None,
|
|
40
38
|
**kwargs,
|
|
41
39
|
) -> str:
|
|
42
40
|
"""Clear all indexed Firecrawl content for the agent.
|
|
@@ -48,7 +46,7 @@ class FirecrawlClearIndexedContent(FirecrawlBaseTool):
|
|
|
48
46
|
Returns:
|
|
49
47
|
str: Confirmation message
|
|
50
48
|
"""
|
|
51
|
-
context = self.
|
|
49
|
+
context = self.get_context()
|
|
52
50
|
agent_id = context.agent_id
|
|
53
51
|
|
|
54
52
|
if not agent_id:
|
|
@@ -4,7 +4,6 @@ from typing import List, Optional, Type
|
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
from langchain_core.documents import Document
|
|
7
|
-
from langchain_core.runnables import RunnableConfig
|
|
8
7
|
from pydantic import BaseModel, Field
|
|
9
8
|
|
|
10
9
|
from intentkit.skills.firecrawl.base import FirecrawlBaseTool
|
|
@@ -109,7 +108,6 @@ class FirecrawlCrawl(FirecrawlBaseTool):
|
|
|
109
108
|
index_content: bool = True,
|
|
110
109
|
chunk_size: int = 1000,
|
|
111
110
|
chunk_overlap: int = 200,
|
|
112
|
-
config: RunnableConfig = None,
|
|
113
111
|
**kwargs,
|
|
114
112
|
) -> str:
|
|
115
113
|
"""Implementation of the Firecrawl crawl tool.
|
|
@@ -130,21 +128,22 @@ class FirecrawlCrawl(FirecrawlBaseTool):
|
|
|
130
128
|
Returns:
|
|
131
129
|
str: Formatted crawled content from all pages.
|
|
132
130
|
"""
|
|
133
|
-
context = self.
|
|
131
|
+
context = self.get_context()
|
|
132
|
+
skill_config = context.agent.skill_config(self.category)
|
|
134
133
|
logger.debug(f"firecrawl_crawl: Running crawl with context {context}")
|
|
135
134
|
|
|
136
|
-
if
|
|
137
|
-
if
|
|
135
|
+
if skill_config.get("api_key_provider") == "agent_owner":
|
|
136
|
+
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
138
137
|
"rate_limit_minutes"
|
|
139
138
|
):
|
|
140
139
|
await self.user_rate_limit_by_category(
|
|
141
140
|
context.user_id,
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
skill_config["rate_limit_number"],
|
|
142
|
+
skill_config["rate_limit_minutes"],
|
|
144
143
|
)
|
|
145
144
|
|
|
146
145
|
# Get the API key from the agent's configuration
|
|
147
|
-
api_key = self.get_api_key(
|
|
146
|
+
api_key = self.get_api_key()
|
|
148
147
|
if not api_key:
|
|
149
148
|
return "Error: No Firecrawl API key provided in the configuration."
|
|
150
149
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from typing import Type
|
|
3
3
|
|
|
4
|
-
from langchain_core.runnables import RunnableConfig
|
|
5
4
|
from pydantic import BaseModel, Field
|
|
6
5
|
|
|
7
6
|
from intentkit.skills.firecrawl.base import FirecrawlBaseTool
|
|
@@ -44,16 +43,15 @@ class FirecrawlQueryIndexedContent(FirecrawlBaseTool):
|
|
|
44
43
|
self,
|
|
45
44
|
query: str,
|
|
46
45
|
max_results: int = 4,
|
|
47
|
-
config: RunnableConfig = None,
|
|
48
46
|
**kwargs,
|
|
49
47
|
) -> str:
|
|
50
48
|
"""Query the indexed Firecrawl content."""
|
|
51
49
|
try:
|
|
52
50
|
# Get agent context - throw error if not available
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
# Configuration is always available in new runtime
|
|
52
|
+
pass
|
|
55
53
|
|
|
56
|
-
context = self.
|
|
54
|
+
context = self.get_context()
|
|
57
55
|
if not context or not context.agent_id:
|
|
58
56
|
raise ValueError("Agent ID is required but not found in configuration")
|
|
59
57
|
|
|
@@ -109,10 +107,10 @@ class FirecrawlQueryIndexedContent(FirecrawlBaseTool):
|
|
|
109
107
|
# Extract agent_id for error logging if possible
|
|
110
108
|
agent_id = "UNKNOWN"
|
|
111
109
|
try:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
# TODO: Fix config reference
|
|
111
|
+
context = self.get_context()
|
|
112
|
+
if context and context.agent_id:
|
|
113
|
+
agent_id = context.agent_id
|
|
116
114
|
except Exception:
|
|
117
115
|
pass
|
|
118
116
|
|
|
@@ -3,7 +3,6 @@ from typing import List, Optional, Type
|
|
|
3
3
|
|
|
4
4
|
import httpx
|
|
5
5
|
from langchain_core.documents import Document
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from intentkit.skills.firecrawl.base import FirecrawlBaseTool
|
|
@@ -95,7 +94,6 @@ class FirecrawlScrape(FirecrawlBaseTool):
|
|
|
95
94
|
index_content: bool = True,
|
|
96
95
|
chunk_size: int = 1000,
|
|
97
96
|
chunk_overlap: int = 200,
|
|
98
|
-
config: RunnableConfig = None,
|
|
99
97
|
**kwargs,
|
|
100
98
|
) -> str:
|
|
101
99
|
"""Implementation of the Firecrawl scrape tool.
|
|
@@ -116,21 +114,22 @@ class FirecrawlScrape(FirecrawlBaseTool):
|
|
|
116
114
|
Returns:
|
|
117
115
|
str: Formatted scraped content based on the requested formats.
|
|
118
116
|
"""
|
|
119
|
-
context = self.
|
|
117
|
+
context = self.get_context()
|
|
118
|
+
skill_config = context.agent.skill_config(self.category)
|
|
120
119
|
logger.debug(f"firecrawl_scrape: Running scrape with context {context}")
|
|
121
120
|
|
|
122
|
-
if
|
|
123
|
-
if
|
|
121
|
+
if skill_config.get("api_key_provider") == "agent_owner":
|
|
122
|
+
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
124
123
|
"rate_limit_minutes"
|
|
125
124
|
):
|
|
126
125
|
await self.user_rate_limit_by_category(
|
|
127
126
|
context.user_id,
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
skill_config["rate_limit_number"],
|
|
128
|
+
skill_config["rate_limit_minutes"],
|
|
130
129
|
)
|
|
131
130
|
|
|
132
131
|
# Get the API key from the agent's configuration
|
|
133
|
-
api_key = self.get_api_key(
|
|
132
|
+
api_key = self.get_api_key()
|
|
134
133
|
if not api_key:
|
|
135
134
|
return "Error: No Firecrawl API key provided in the configuration."
|
|
136
135
|
|
|
@@ -3,7 +3,6 @@ from enum import Enum
|
|
|
3
3
|
from typing import Type
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
|
-
from langchain_core.runnables import RunnableConfig
|
|
7
6
|
from pydantic import BaseModel, Field
|
|
8
7
|
|
|
9
8
|
from intentkit.skills.github.base import GitHubBaseTool
|
|
@@ -62,7 +61,6 @@ class GitHubSearch(GitHubBaseTool):
|
|
|
62
61
|
query: str,
|
|
63
62
|
search_type: SearchType = SearchType.REPOSITORIES,
|
|
64
63
|
max_results: int = 5,
|
|
65
|
-
config: RunnableConfig = None,
|
|
66
64
|
**kwargs,
|
|
67
65
|
) -> str:
|
|
68
66
|
"""Implementation of the GitHub search tool.
|
|
@@ -76,7 +74,7 @@ class GitHubSearch(GitHubBaseTool):
|
|
|
76
74
|
Returns:
|
|
77
75
|
str: Formatted search results based on the search type.
|
|
78
76
|
"""
|
|
79
|
-
context = self.
|
|
77
|
+
context = self.get_context()
|
|
80
78
|
logger.debug(f"github_search.py: Running GitHub search with context {context}")
|
|
81
79
|
|
|
82
80
|
# Limit max_results to a reasonable range
|
intentkit/skills/heurist/base.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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
|
|
@@ -21,6 +22,20 @@ class HeuristBaseTool(IntentKitSkill):
|
|
|
21
22
|
description="The skill store for persisting data"
|
|
22
23
|
)
|
|
23
24
|
|
|
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("heurist_api_key")
|
|
31
|
+
# for backward compatibility, may only have api_key in skill_config
|
|
32
|
+
elif skill_config.get("api_key"):
|
|
33
|
+
return skill_config.get("api_key")
|
|
34
|
+
else:
|
|
35
|
+
raise ToolException(
|
|
36
|
+
f"Invalid API key provider: {api_key_provider}, or no api_key in config"
|
|
37
|
+
)
|
|
38
|
+
|
|
24
39
|
@property
|
|
25
40
|
def category(self) -> str:
|
|
26
41
|
return "heurist"
|
|
@@ -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 ImageGenerationAnimagineXL(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 Japanese anime-style images using Heurist AI's AnimagineXL model.
|
|
@@ -77,8 +75,9 @@ class ImageGenerationAnimagineXL(HeuristBaseTool):
|
|
|
77
75
|
Returns:
|
|
78
76
|
str: URL of the generated image.
|
|
79
77
|
"""
|
|
80
|
-
context = self.
|
|
81
|
-
skill_config = context.
|
|
78
|
+
context = self.get_context()
|
|
79
|
+
skill_config = context.agent.skill_config(self.category)
|
|
80
|
+
skill_config = skill_config
|
|
82
81
|
|
|
83
82
|
# Get the Heurist API key from the skill store
|
|
84
83
|
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 ImageGenerationArthemyComics(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 comic-style images using Heurist AI's ArthemyComics model.
|
|
@@ -76,8 +74,9 @@ class ImageGenerationArthemyComics(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 ImageGenerationArthemyReal(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 realistic images using Heurist AI's ArthemyReal model.
|
|
@@ -76,8 +74,9 @@ class ImageGenerationArthemyReal(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 ImageGenerationBrainDance(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 artistic images using Heurist AI's BrainDance model.
|
|
@@ -76,8 +74,9 @@ class ImageGenerationBrainDance(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"]:
|