intentkit 0.8.12.dev2__py3-none-any.whl → 0.8.12.dev3__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/skill.py +2 -59
- intentkit/clients/twitter.py +35 -28
- intentkit/core/agent.py +2 -279
- intentkit/core/engine.py +2 -3
- intentkit/models/agent.py +109 -89
- intentkit/models/agent_schema.json +4 -2
- intentkit/skills/acolyt/__init__.py +2 -9
- intentkit/skills/acolyt/base.py +2 -5
- intentkit/skills/aixbt/__init__.py +2 -13
- intentkit/skills/aixbt/base.py +0 -4
- intentkit/skills/aixbt/projects.py +1 -2
- intentkit/skills/allora/__init__.py +2 -9
- intentkit/skills/allora/base.py +2 -5
- intentkit/skills/base.py +101 -27
- intentkit/skills/basename/__init__.py +1 -3
- intentkit/skills/carv/__init__.py +116 -121
- intentkit/skills/carv/base.py +184 -185
- intentkit/skills/casino/__init__.py +4 -15
- intentkit/skills/casino/base.py +0 -4
- intentkit/skills/casino/deck_draw.py +1 -2
- intentkit/skills/casino/deck_shuffle.py +1 -2
- intentkit/skills/casino/dice_roll.py +1 -2
- intentkit/skills/cdp/__init__.py +0 -4
- intentkit/skills/cdp/base.py +0 -4
- intentkit/skills/chainlist/__init__.py +2 -7
- intentkit/skills/chainlist/base.py +0 -4
- intentkit/skills/common/__init__.py +2 -9
- intentkit/skills/common/base.py +0 -4
- intentkit/skills/cookiefun/__init__.py +6 -9
- intentkit/skills/cookiefun/base.py +0 -4
- intentkit/skills/cryptocompare/__init__.py +7 -24
- intentkit/skills/cryptocompare/base.py +0 -5
- intentkit/skills/cryptopanic/__init__.py +3 -6
- intentkit/skills/cryptopanic/base.py +53 -55
- intentkit/skills/cryptopanic/fetch_crypto_news.py +0 -2
- intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +1 -3
- intentkit/skills/dapplooker/__init__.py +2 -9
- intentkit/skills/dapplooker/base.py +2 -5
- intentkit/skills/defillama/__init__.py +24 -74
- intentkit/skills/defillama/base.py +0 -4
- intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +2 -2
- intentkit/skills/defillama/coins/fetch_block.py +2 -2
- intentkit/skills/defillama/coins/fetch_current_prices.py +2 -2
- intentkit/skills/defillama/coins/fetch_first_price.py +2 -2
- intentkit/skills/defillama/coins/fetch_historical_prices.py +2 -2
- intentkit/skills/defillama/coins/fetch_price_chart.py +2 -2
- intentkit/skills/defillama/coins/fetch_price_percentage.py +2 -2
- intentkit/skills/defillama/fees/fetch_fees_overview.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +2 -2
- intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +2 -2
- intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +2 -2
- intentkit/skills/defillama/tvl/fetch_chains.py +2 -2
- intentkit/skills/defillama/tvl/fetch_historical_tvl.py +2 -2
- intentkit/skills/defillama/tvl/fetch_protocol.py +2 -2
- intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +2 -2
- intentkit/skills/defillama/tvl/fetch_protocols.py +2 -2
- intentkit/skills/defillama/volumes/fetch_dex_overview.py +2 -2
- intentkit/skills/defillama/volumes/fetch_dex_summary.py +2 -2
- intentkit/skills/defillama/volumes/fetch_options_overview.py +2 -2
- intentkit/skills/defillama/yields/fetch_pool_chart.py +2 -2
- intentkit/skills/defillama/yields/fetch_pools.py +2 -2
- intentkit/skills/dexscreener/__init__.py +97 -102
- intentkit/skills/dexscreener/base.py +125 -130
- intentkit/skills/dexscreener/get_pair_info.py +2 -3
- intentkit/skills/dexscreener/get_token_pairs.py +2 -3
- intentkit/skills/dexscreener/get_tokens_info.py +2 -3
- intentkit/skills/dexscreener/search_token.py +2 -4
- intentkit/skills/dune_analytics/__init__.py +4 -6
- intentkit/skills/dune_analytics/base.py +50 -52
- intentkit/skills/dune_analytics/fetch_kol_buys.py +0 -2
- intentkit/skills/dune_analytics/fetch_nation_metrics.py +0 -2
- intentkit/skills/elfa/__init__.py +5 -18
- intentkit/skills/elfa/base.py +8 -10
- intentkit/skills/enso/__init__.py +9 -29
- intentkit/skills/enso/base.py +3 -6
- intentkit/skills/enso/route.py +1 -3
- intentkit/skills/erc20/__init__.py +1 -5
- intentkit/skills/erc721/__init__.py +1 -3
- intentkit/skills/firecrawl/__init__.py +5 -18
- intentkit/skills/firecrawl/base.py +2 -5
- intentkit/skills/firecrawl/crawl.py +10 -9
- intentkit/skills/firecrawl/query.py +3 -1
- intentkit/skills/firecrawl/scrape.py +8 -10
- intentkit/skills/firecrawl/utils.py +25 -26
- intentkit/skills/github/__init__.py +2 -7
- intentkit/skills/github/base.py +0 -4
- intentkit/skills/heurist/__init__.py +8 -27
- intentkit/skills/heurist/base.py +2 -5
- intentkit/skills/heurist/image_generation_animagine_xl.py +5 -5
- intentkit/skills/heurist/image_generation_arthemy_comics.py +5 -5
- intentkit/skills/heurist/image_generation_arthemy_real.py +5 -5
- intentkit/skills/heurist/image_generation_braindance.py +5 -5
- intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +5 -5
- intentkit/skills/heurist/image_generation_flux_1_dev.py +5 -5
- intentkit/skills/heurist/image_generation_sdxl.py +5 -5
- intentkit/skills/http/__init__.py +4 -15
- intentkit/skills/http/base.py +0 -4
- intentkit/skills/lifi/__init__.py +1 -6
- intentkit/skills/lifi/base.py +0 -4
- intentkit/skills/lifi/token_execute.py +1 -4
- intentkit/skills/lifi/token_quote.py +1 -3
- intentkit/skills/moralis/__init__.py +3 -7
- intentkit/skills/moralis/base.py +2 -5
- intentkit/skills/morpho/__init__.py +1 -3
- intentkit/skills/nation/__init__.py +2 -7
- intentkit/skills/nation/base.py +4 -7
- intentkit/skills/openai/__init__.py +5 -18
- intentkit/skills/openai/base.py +8 -10
- intentkit/skills/openai/dalle_image_generation.py +2 -5
- intentkit/skills/openai/gpt_image_generation.py +2 -5
- intentkit/skills/openai/gpt_image_to_image.py +2 -5
- intentkit/skills/openai/image_to_text.py +2 -5
- intentkit/skills/portfolio/__init__.py +11 -35
- intentkit/skills/portfolio/base.py +2 -5
- intentkit/skills/pyth/__init__.py +1 -5
- intentkit/skills/slack/__init__.py +5 -17
- intentkit/skills/slack/base.py +0 -4
- intentkit/skills/supabase/__init__.py +7 -23
- intentkit/skills/supabase/base.py +0 -4
- intentkit/skills/superfluid/__init__.py +1 -3
- intentkit/skills/system/__init__.py +7 -24
- intentkit/skills/system/add_autonomous_task.py +2 -2
- intentkit/skills/system/delete_autonomous_task.py +2 -2
- intentkit/skills/system/edit_autonomous_task.py +2 -4
- intentkit/skills/system/list_autonomous_tasks.py +2 -2
- 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 +2 -5
- intentkit/skills/tavily/tavily_extract.py +1 -2
- intentkit/skills/tavily/tavily_search.py +3 -3
- intentkit/skills/token/__init__.py +5 -10
- intentkit/skills/token/base.py +2 -6
- intentkit/skills/twitter/__init__.py +11 -35
- intentkit/skills/twitter/base.py +14 -16
- intentkit/skills/twitter/follow_user.py +0 -1
- intentkit/skills/twitter/get_mentions.py +0 -1
- intentkit/skills/twitter/get_timeline.py +0 -1
- intentkit/skills/twitter/get_user_by_username.py +0 -1
- intentkit/skills/twitter/get_user_tweets.py +0 -1
- intentkit/skills/twitter/like_tweet.py +0 -1
- intentkit/skills/twitter/post_tweet.py +2 -2
- intentkit/skills/twitter/reply_tweet.py +2 -2
- intentkit/skills/twitter/retweet.py +0 -1
- intentkit/skills/twitter/search_tweets.py +0 -1
- intentkit/skills/unrealspeech/__init__.py +2 -7
- intentkit/skills/unrealspeech/base.py +0 -4
- intentkit/skills/venice_audio/__init__.py +99 -106
- intentkit/skills/venice_audio/base.py +118 -121
- intentkit/skills/venice_audio/venice_audio.py +1 -5
- intentkit/skills/venice_image/__init__.py +147 -154
- intentkit/skills/venice_image/base.py +185 -192
- intentkit/skills/web_scraper/__init__.py +5 -18
- intentkit/skills/web_scraper/base.py +20 -4
- intentkit/skills/web_scraper/document_indexer.py +6 -4
- intentkit/skills/web_scraper/scrape_and_index.py +11 -8
- intentkit/skills/web_scraper/utils.py +31 -27
- intentkit/skills/web_scraper/website_indexer.py +7 -8
- intentkit/skills/weth/__init__.py +1 -5
- intentkit/skills/wow/__init__.py +1 -5
- intentkit/skills/xmtp/__init__.py +4 -15
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev3.dist-info}/METADATA +1 -1
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev3.dist-info}/RECORD +168 -168
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev3.dist-info}/WHEEL +0 -0
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev3.dist-info}/licenses/LICENSE +0 -0
|
@@ -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.clients import TwitterClientConfig
|
|
8
7
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
9
8
|
from intentkit.skills.twitter.base import TwitterBaseTool
|
|
@@ -46,7 +45,6 @@ class Config(SkillConfig, TwitterClientConfig):
|
|
|
46
45
|
async def get_skills(
|
|
47
46
|
config: "Config",
|
|
48
47
|
is_private: bool,
|
|
49
|
-
store: SkillStoreABC,
|
|
50
48
|
**_,
|
|
51
49
|
) -> list[TwitterBaseTool]:
|
|
52
50
|
"""Get all Twitter skills."""
|
|
@@ -62,7 +60,7 @@ async def get_skills(
|
|
|
62
60
|
# Get each skill using the cached getter
|
|
63
61
|
result = []
|
|
64
62
|
for name in available_skills:
|
|
65
|
-
skill = get_twitter_skill(name
|
|
63
|
+
skill = get_twitter_skill(name)
|
|
66
64
|
if skill:
|
|
67
65
|
result.append(skill)
|
|
68
66
|
return result
|
|
@@ -70,76 +68,54 @@ async def get_skills(
|
|
|
70
68
|
|
|
71
69
|
def get_twitter_skill(
|
|
72
70
|
name: str,
|
|
73
|
-
store: SkillStoreABC,
|
|
74
71
|
) -> TwitterBaseTool:
|
|
75
72
|
"""Get a Twitter skill by name.
|
|
76
73
|
|
|
77
74
|
Args:
|
|
78
75
|
name: The name of the skill to get
|
|
79
|
-
store: The skill store for persisting data
|
|
80
76
|
|
|
81
77
|
Returns:
|
|
82
78
|
The requested Twitter skill
|
|
83
79
|
"""
|
|
84
80
|
if name == "get_mentions":
|
|
85
81
|
if name not in _cache:
|
|
86
|
-
_cache[name] = TwitterGetMentions(
|
|
87
|
-
skill_store=store,
|
|
88
|
-
)
|
|
82
|
+
_cache[name] = TwitterGetMentions()
|
|
89
83
|
return _cache[name]
|
|
90
84
|
elif name == "post_tweet":
|
|
91
85
|
if name not in _cache:
|
|
92
|
-
_cache[name] = TwitterPostTweet(
|
|
93
|
-
skill_store=store,
|
|
94
|
-
)
|
|
86
|
+
_cache[name] = TwitterPostTweet()
|
|
95
87
|
return _cache[name]
|
|
96
88
|
elif name == "reply_tweet":
|
|
97
89
|
if name not in _cache:
|
|
98
|
-
_cache[name] = TwitterReplyTweet(
|
|
99
|
-
skill_store=store,
|
|
100
|
-
)
|
|
90
|
+
_cache[name] = TwitterReplyTweet()
|
|
101
91
|
return _cache[name]
|
|
102
92
|
elif name == "get_timeline":
|
|
103
93
|
if name not in _cache:
|
|
104
|
-
_cache[name] = TwitterGetTimeline(
|
|
105
|
-
skill_store=store,
|
|
106
|
-
)
|
|
94
|
+
_cache[name] = TwitterGetTimeline()
|
|
107
95
|
return _cache[name]
|
|
108
96
|
elif name == "follow_user":
|
|
109
97
|
if name not in _cache:
|
|
110
|
-
_cache[name] = TwitterFollowUser(
|
|
111
|
-
skill_store=store,
|
|
112
|
-
)
|
|
98
|
+
_cache[name] = TwitterFollowUser()
|
|
113
99
|
return _cache[name]
|
|
114
100
|
elif name == "like_tweet":
|
|
115
101
|
if name not in _cache:
|
|
116
|
-
_cache[name] = TwitterLikeTweet(
|
|
117
|
-
skill_store=store,
|
|
118
|
-
)
|
|
102
|
+
_cache[name] = TwitterLikeTweet()
|
|
119
103
|
return _cache[name]
|
|
120
104
|
elif name == "retweet":
|
|
121
105
|
if name not in _cache:
|
|
122
|
-
_cache[name] = TwitterRetweet(
|
|
123
|
-
skill_store=store,
|
|
124
|
-
)
|
|
106
|
+
_cache[name] = TwitterRetweet()
|
|
125
107
|
return _cache[name]
|
|
126
108
|
elif name == "search_tweets":
|
|
127
109
|
if name not in _cache:
|
|
128
|
-
_cache[name] = TwitterSearchTweets(
|
|
129
|
-
skill_store=store,
|
|
130
|
-
)
|
|
110
|
+
_cache[name] = TwitterSearchTweets()
|
|
131
111
|
return _cache[name]
|
|
132
112
|
elif name == "get_user_by_username":
|
|
133
113
|
if name not in _cache:
|
|
134
|
-
_cache[name] = TwitterGetUserByUsername(
|
|
135
|
-
skill_store=store,
|
|
136
|
-
)
|
|
114
|
+
_cache[name] = TwitterGetUserByUsername()
|
|
137
115
|
return _cache[name]
|
|
138
116
|
elif name == "get_user_tweets":
|
|
139
117
|
if name not in _cache:
|
|
140
|
-
_cache[name] = TwitterGetUserTweets(
|
|
141
|
-
skill_store=store,
|
|
142
|
-
)
|
|
118
|
+
_cache[name] = TwitterGetUserTweets()
|
|
143
119
|
return _cache[name]
|
|
144
120
|
else:
|
|
145
121
|
logger.warning(f"Unknown Twitter skill: {name}")
|
intentkit/skills/twitter/base.py
CHANGED
|
@@ -4,7 +4,7 @@ from typing import Type
|
|
|
4
4
|
from langchain_core.tools.base import ToolException
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
|
-
from intentkit.
|
|
7
|
+
from intentkit.config.config import config
|
|
8
8
|
from intentkit.skills.base import IntentKitSkill
|
|
9
9
|
from intentkit.utils.error import RateLimitExceeded
|
|
10
10
|
|
|
@@ -15,9 +15,6 @@ class TwitterBaseTool(IntentKitSkill):
|
|
|
15
15
|
name: str = Field(description="The name of the tool")
|
|
16
16
|
description: str = Field(description="A description of what the tool does")
|
|
17
17
|
args_schema: Type[BaseModel]
|
|
18
|
-
skill_store: SkillStoreABC = Field(
|
|
19
|
-
description="The skill store for persisting data"
|
|
20
|
-
)
|
|
21
18
|
|
|
22
19
|
def get_api_key(self) -> dict:
|
|
23
20
|
context = self.get_context()
|
|
@@ -25,20 +22,21 @@ class TwitterBaseTool(IntentKitSkill):
|
|
|
25
22
|
api_key_provider = skill_config.get("api_key_provider")
|
|
26
23
|
if api_key_provider == "platform":
|
|
27
24
|
# Return platform keys (these need to be added to config.py)
|
|
28
|
-
|
|
29
|
-
"consumer_key":
|
|
30
|
-
|
|
31
|
-
),
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
),
|
|
35
|
-
"access_token": self.skill_store.get_system_config(
|
|
36
|
-
"twitter_access_token"
|
|
37
|
-
),
|
|
38
|
-
"access_token_secret": self.skill_store.get_system_config(
|
|
39
|
-
"twitter_access_token_secret"
|
|
25
|
+
platform_keys = {
|
|
26
|
+
"consumer_key": getattr(config, "twitter_consumer_key", None),
|
|
27
|
+
"consumer_secret": getattr(config, "twitter_consumer_secret", None),
|
|
28
|
+
"access_token": getattr(config, "twitter_access_token", None),
|
|
29
|
+
"access_token_secret": getattr(
|
|
30
|
+
config, "twitter_access_token_secret", None
|
|
40
31
|
),
|
|
41
32
|
}
|
|
33
|
+
missing = [key for key, value in platform_keys.items() if not value]
|
|
34
|
+
if missing:
|
|
35
|
+
raise ToolException(
|
|
36
|
+
"Twitter platform API keys are not configured: "
|
|
37
|
+
+ ", ".join(missing)
|
|
38
|
+
)
|
|
39
|
+
return platform_keys
|
|
42
40
|
# for backward compatibility or agent_owner provider
|
|
43
41
|
elif api_key_provider == "agent_owner":
|
|
44
42
|
required_keys = [
|
|
@@ -42,7 +42,6 @@ class TwitterFollowUser(TwitterBaseTool):
|
|
|
42
42
|
skill_config = context.agent.skill_config(self.category)
|
|
43
43
|
twitter = get_twitter_client(
|
|
44
44
|
agent_id=context.agent_id,
|
|
45
|
-
skill_store=self.skill_store,
|
|
46
45
|
config=skill_config,
|
|
47
46
|
)
|
|
48
47
|
client = await twitter.get_client()
|
|
@@ -46,7 +46,6 @@ class TwitterGetMentions(TwitterBaseTool):
|
|
|
46
46
|
skill_config = context.agent.skill_config(self.category)
|
|
47
47
|
twitter = get_twitter_client(
|
|
48
48
|
agent_id=context.agent_id,
|
|
49
|
-
skill_store=self.skill_store,
|
|
50
49
|
config=skill_config,
|
|
51
50
|
)
|
|
52
51
|
client = await twitter.get_client()
|
|
@@ -45,7 +45,6 @@ class TwitterGetTimeline(TwitterBaseTool):
|
|
|
45
45
|
skill_config = context.agent.skill_config(self.category)
|
|
46
46
|
twitter = get_twitter_client(
|
|
47
47
|
agent_id=context.agent_id,
|
|
48
|
-
skill_store=self.skill_store,
|
|
49
48
|
config=skill_config,
|
|
50
49
|
)
|
|
51
50
|
client = await twitter.get_client()
|
|
@@ -43,7 +43,6 @@ class TwitterGetUserByUsername(TwitterBaseTool):
|
|
|
43
43
|
skill_config = context.agent.skill_config(self.category)
|
|
44
44
|
twitter = get_twitter_client(
|
|
45
45
|
agent_id=context.agent_id,
|
|
46
|
-
skill_store=self.skill_store,
|
|
47
46
|
config=skill_config,
|
|
48
47
|
)
|
|
49
48
|
client = await twitter.get_client()
|
|
@@ -59,7 +59,6 @@ class TwitterGetUserTweets(TwitterBaseTool):
|
|
|
59
59
|
skill_config = context.agent.skill_config(self.category)
|
|
60
60
|
twitter = get_twitter_client(
|
|
61
61
|
agent_id=context.agent_id,
|
|
62
|
-
skill_store=self.skill_store,
|
|
63
62
|
config=skill_config,
|
|
64
63
|
)
|
|
65
64
|
client = await twitter.get_client()
|
|
@@ -40,7 +40,6 @@ class TwitterLikeTweet(TwitterBaseTool):
|
|
|
40
40
|
skill_config = context.agent.skill_config(self.category)
|
|
41
41
|
twitter = get_twitter_client(
|
|
42
42
|
agent_id=context.agent_id,
|
|
43
|
-
skill_store=self.skill_store,
|
|
44
43
|
config=skill_config,
|
|
45
44
|
)
|
|
46
45
|
client = await twitter.get_client()
|
|
@@ -5,6 +5,7 @@ from langchain_core.tools import ToolException
|
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
7
|
from intentkit.clients import get_twitter_client
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.twitter.base import TwitterBaseTool
|
|
9
10
|
|
|
10
11
|
NAME = "twitter_post_tweet"
|
|
@@ -54,7 +55,6 @@ class TwitterPostTweet(TwitterBaseTool):
|
|
|
54
55
|
skill_config = context.agent.skill_config(self.category)
|
|
55
56
|
twitter = get_twitter_client(
|
|
56
57
|
agent_id=context.agent_id,
|
|
57
|
-
skill_store=self.skill_store,
|
|
58
58
|
config=skill_config,
|
|
59
59
|
)
|
|
60
60
|
client = await twitter.get_client()
|
|
@@ -69,7 +69,7 @@ class TwitterPostTweet(TwitterBaseTool):
|
|
|
69
69
|
# Handle image upload if provided
|
|
70
70
|
if image:
|
|
71
71
|
# Validate image URL - must be from system's S3 CDN
|
|
72
|
-
aws_s3_cdn_url =
|
|
72
|
+
aws_s3_cdn_url = config.aws_s3_cdn_url
|
|
73
73
|
if aws_s3_cdn_url and image.startswith(aws_s3_cdn_url):
|
|
74
74
|
# Use the TwitterClient method to upload the image
|
|
75
75
|
media_ids = await twitter.upload_media(context.agent_id, image)
|
|
@@ -5,6 +5,7 @@ from langchain_core.tools import ToolException
|
|
|
5
5
|
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
7
|
from intentkit.clients import get_twitter_client
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.twitter.base import TwitterBaseTool
|
|
9
10
|
|
|
10
11
|
NAME = "twitter_reply_tweet"
|
|
@@ -56,7 +57,6 @@ class TwitterReplyTweet(TwitterBaseTool):
|
|
|
56
57
|
skill_config = context.agent.skill_config(self.category)
|
|
57
58
|
twitter = get_twitter_client(
|
|
58
59
|
agent_id=context.agent_id,
|
|
59
|
-
skill_store=self.skill_store,
|
|
60
60
|
config=skill_config,
|
|
61
61
|
)
|
|
62
62
|
client = await twitter.get_client()
|
|
@@ -71,7 +71,7 @@ class TwitterReplyTweet(TwitterBaseTool):
|
|
|
71
71
|
# Handle image upload if provided
|
|
72
72
|
if image:
|
|
73
73
|
# Validate image URL - must be from system's S3 CDN
|
|
74
|
-
aws_s3_cdn_url =
|
|
74
|
+
aws_s3_cdn_url = config.aws_s3_cdn_url
|
|
75
75
|
if aws_s3_cdn_url and image.startswith(aws_s3_cdn_url):
|
|
76
76
|
# Use the TwitterClient method to upload the image
|
|
77
77
|
media_ids = await twitter.upload_media(context.agent_id, image)
|
|
@@ -40,7 +40,6 @@ class TwitterRetweet(TwitterBaseTool):
|
|
|
40
40
|
skill_config = context.agent.skill_config(self.category)
|
|
41
41
|
twitter = get_twitter_client(
|
|
42
42
|
agent_id=context.agent_id,
|
|
43
|
-
skill_store=self.skill_store,
|
|
44
43
|
config=skill_config,
|
|
45
44
|
)
|
|
46
45
|
client = await twitter.get_client()
|
|
@@ -42,7 +42,6 @@ class TwitterSearchTweets(TwitterBaseTool):
|
|
|
42
42
|
skill_config = context.agent.skill_config(self.category)
|
|
43
43
|
twitter = get_twitter_client(
|
|
44
44
|
agent_id=context.agent_id,
|
|
45
|
-
skill_store=self.skill_store,
|
|
46
45
|
config=skill_config,
|
|
47
46
|
)
|
|
48
47
|
client = await twitter.get_client()
|
|
@@ -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.unrealspeech.base import UnrealSpeechBaseTool
|
|
6
5
|
from intentkit.skills.unrealspeech.text_to_speech import TextToSpeech
|
|
@@ -23,7 +22,6 @@ class Config(SkillConfig):
|
|
|
23
22
|
async def get_skills(
|
|
24
23
|
config: "Config",
|
|
25
24
|
is_private: bool,
|
|
26
|
-
store: SkillStoreABC,
|
|
27
25
|
**_,
|
|
28
26
|
) -> list[UnrealSpeechBaseTool]:
|
|
29
27
|
"""Get all UnrealSpeech tools."""
|
|
@@ -37,19 +35,16 @@ async def get_skills(
|
|
|
37
35
|
available_skills.append(skill_name)
|
|
38
36
|
|
|
39
37
|
# Get each skill using the cached getter
|
|
40
|
-
return [get_unrealspeech_skill(name
|
|
38
|
+
return [get_unrealspeech_skill(name) for name in available_skills]
|
|
41
39
|
|
|
42
40
|
|
|
43
41
|
def get_unrealspeech_skill(
|
|
44
42
|
name: str,
|
|
45
|
-
store: SkillStoreABC,
|
|
46
43
|
) -> UnrealSpeechBaseTool:
|
|
47
44
|
"""Get an UnrealSpeech skill by name."""
|
|
48
45
|
if name == "text_to_speech":
|
|
49
46
|
if name not in _cache:
|
|
50
|
-
_cache[name] = TextToSpeech(
|
|
51
|
-
skill_store=store,
|
|
52
|
-
)
|
|
47
|
+
_cache[name] = TextToSpeech()
|
|
53
48
|
return _cache[name]
|
|
54
49
|
else:
|
|
55
50
|
raise ValueError(f"Unknown UnrealSpeech skill: {name}")
|
|
@@ -3,7 +3,6 @@ from typing import Type
|
|
|
3
3
|
from langchain_core.tools.base import ToolException
|
|
4
4
|
from pydantic import BaseModel, Field
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import IntentKitSkill
|
|
8
7
|
|
|
9
8
|
|
|
@@ -13,9 +12,6 @@ class UnrealSpeechBaseTool(IntentKitSkill):
|
|
|
13
12
|
name: str = Field(description="The name of the tool")
|
|
14
13
|
description: str = Field(description="A description of what the tool does")
|
|
15
14
|
args_schema: Type[BaseModel]
|
|
16
|
-
skill_store: SkillStoreABC = Field(
|
|
17
|
-
description="The skill store for persisting data"
|
|
18
|
-
)
|
|
19
15
|
|
|
20
16
|
def get_api_key(self) -> str:
|
|
21
17
|
context = self.get_context()
|
|
@@ -1,106 +1,99 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from typing import List, Literal, Optional, TypedDict
|
|
3
|
-
|
|
4
|
-
from intentkit.
|
|
5
|
-
from intentkit.skills.base import
|
|
6
|
-
from intentkit.skills.venice_audio.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
name
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return _cache[name]
|
|
101
|
-
|
|
102
|
-
# Cache and return the newly created instance
|
|
103
|
-
_cache[name] = VeniceAudioTool(
|
|
104
|
-
skill_store=store,
|
|
105
|
-
)
|
|
106
|
-
return _cache[name]
|
|
1
|
+
import logging
|
|
2
|
+
from typing import List, Literal, Optional, TypedDict
|
|
3
|
+
|
|
4
|
+
from intentkit.skills.base import SkillConfig, SkillState
|
|
5
|
+
from intentkit.skills.venice_audio.base import VeniceAudioBaseTool
|
|
6
|
+
from intentkit.skills.venice_audio.venice_audio import VeniceAudioTool
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
_cache: dict[str, VeniceAudioBaseTool] = {}
|
|
12
|
+
|
|
13
|
+
_SKILL_NAME_TO_CLASS_MAP = {
|
|
14
|
+
"text_to_speech": VeniceAudioTool,
|
|
15
|
+
# Add new mappings here: "skill_name": SkillClassName
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class SkillStates(TypedDict):
|
|
20
|
+
text_to_speech: SkillState
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Config(SkillConfig):
|
|
24
|
+
enabled: bool
|
|
25
|
+
voice_model: Literal["af_heart", "bm_lewis", "custom"]
|
|
26
|
+
states: SkillStates # type: ignore
|
|
27
|
+
api_key_provider: Optional[Literal["agent_owner"]]
|
|
28
|
+
|
|
29
|
+
# conditionally required
|
|
30
|
+
api_key: Optional[str]
|
|
31
|
+
voice_model_custom: Optional[list[str]]
|
|
32
|
+
|
|
33
|
+
# optional
|
|
34
|
+
rate_limit_number: Optional[int]
|
|
35
|
+
rate_limit_minutes: Optional[int]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
async def get_skills(
|
|
39
|
+
config: "Config",
|
|
40
|
+
is_private: bool,
|
|
41
|
+
**_, # Allow for extra arguments if the loader passes them
|
|
42
|
+
) -> list[VeniceAudioBaseTool]:
|
|
43
|
+
"""
|
|
44
|
+
Factory function to create and return Venice Audio skill tools.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
config: The configuration dictionary for the Venice Audio skill.
|
|
48
|
+
agent_id: The ID of the agent requesting the skills.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
A list of VeniceAudioBaseTool instances for the Venice Audio skill.
|
|
52
|
+
"""
|
|
53
|
+
# Check if the entire category is disabled first
|
|
54
|
+
if not config.get("enabled", False):
|
|
55
|
+
return []
|
|
56
|
+
|
|
57
|
+
available_skills: List[VeniceAudioBaseTool] = []
|
|
58
|
+
skill_states = config.get("states", {})
|
|
59
|
+
|
|
60
|
+
# Iterate through all known skills defined in the map
|
|
61
|
+
for skill_name in _SKILL_NAME_TO_CLASS_MAP:
|
|
62
|
+
state = skill_states.get(
|
|
63
|
+
skill_name, "disabled"
|
|
64
|
+
) # Default to disabled if not in config
|
|
65
|
+
|
|
66
|
+
if state == "disabled":
|
|
67
|
+
continue
|
|
68
|
+
elif state == "public" or (state == "private" and is_private):
|
|
69
|
+
# If enabled, get the skill instance using the factory function
|
|
70
|
+
skill_instance = get_venice_audio_skill(skill_name)
|
|
71
|
+
if skill_instance:
|
|
72
|
+
available_skills.append(skill_instance)
|
|
73
|
+
else:
|
|
74
|
+
# This case should ideally not happen if the map is correct
|
|
75
|
+
logger.warning(f"Could not instantiate known skill: {skill_name}")
|
|
76
|
+
|
|
77
|
+
return available_skills
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def get_venice_audio_skill(
|
|
81
|
+
name: str,
|
|
82
|
+
) -> Optional[VeniceAudioBaseTool]:
|
|
83
|
+
"""
|
|
84
|
+
Factory function to get a cached Venice Audio skill instance by name.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
name: The name of voice model.
|
|
88
|
+
|
|
89
|
+
Returns:
|
|
90
|
+
The requested Venice Audio skill instance, or None if the name is unknown.
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
# Return from cache immediately if already exists
|
|
94
|
+
if name in _cache:
|
|
95
|
+
return _cache[name]
|
|
96
|
+
|
|
97
|
+
# Cache and return the newly created instance
|
|
98
|
+
_cache[name] = VeniceAudioTool()
|
|
99
|
+
return _cache[name]
|