intentkit 0.8.12.dev2__py3-none-any.whl → 0.8.12.dev4__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 +6 -4
- 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.dev4.dist-info}/METADATA +1 -1
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev4.dist-info}/RECORD +168 -168
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev4.dist-info}/WHEEL +0 -0
- {intentkit-0.8.12.dev2.dist-info → intentkit-0.8.12.dev4.dist-info}/licenses/LICENSE +0 -0
|
@@ -9,7 +9,7 @@ from langchain_community.vectorstores import FAISS
|
|
|
9
9
|
from langchain_core.documents import Document
|
|
10
10
|
from langchain_openai import OpenAIEmbeddings
|
|
11
11
|
|
|
12
|
-
from intentkit.
|
|
12
|
+
from intentkit.config.config import config
|
|
13
13
|
from intentkit.models.skill import AgentSkillData, AgentSkillDataCreate
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
@@ -63,15 +63,20 @@ class FirecrawlDocumentProcessor:
|
|
|
63
63
|
class FirecrawlVectorStoreManager:
|
|
64
64
|
"""Manages vector store operations for Firecrawl content."""
|
|
65
65
|
|
|
66
|
-
def __init__(self,
|
|
67
|
-
self.
|
|
66
|
+
def __init__(self, embedding_api_key: Optional[str] = None):
|
|
67
|
+
self._embedding_api_key = embedding_api_key
|
|
68
|
+
|
|
69
|
+
def _resolve_api_key(self) -> str:
|
|
70
|
+
"""Resolve the API key to use for embeddings."""
|
|
71
|
+
if self._embedding_api_key:
|
|
72
|
+
return self._embedding_api_key
|
|
73
|
+
if config.openai_api_key:
|
|
74
|
+
return config.openai_api_key
|
|
75
|
+
raise ValueError("OpenAI API key not found in system configuration")
|
|
68
76
|
|
|
69
77
|
def create_embeddings(self) -> OpenAIEmbeddings:
|
|
70
78
|
"""Create OpenAI embeddings instance."""
|
|
71
|
-
openai_api_key = self.
|
|
72
|
-
if not openai_api_key:
|
|
73
|
-
raise ValueError("OpenAI API key not found in system configuration")
|
|
74
|
-
|
|
79
|
+
openai_api_key = self._resolve_api_key()
|
|
75
80
|
return OpenAIEmbeddings(
|
|
76
81
|
openai_api_key=openai_api_key, model="text-embedding-3-small"
|
|
77
82
|
)
|
|
@@ -179,11 +184,9 @@ class FirecrawlVectorStoreManager:
|
|
|
179
184
|
class FirecrawlMetadataManager:
|
|
180
185
|
"""Manages metadata for Firecrawl indexed content."""
|
|
181
186
|
|
|
182
|
-
|
|
183
|
-
self.skill_store = skill_store
|
|
184
|
-
|
|
187
|
+
@staticmethod
|
|
185
188
|
def create_url_metadata(
|
|
186
|
-
|
|
189
|
+
urls: List[str], documents: List[Document], source_type: str
|
|
187
190
|
) -> Dict[str, Any]:
|
|
188
191
|
"""Create metadata for indexed URLs."""
|
|
189
192
|
return {
|
|
@@ -193,9 +196,9 @@ class FirecrawlMetadataManager:
|
|
|
193
196
|
"indexed_at": str(len(urls)), # Simple counter
|
|
194
197
|
}
|
|
195
198
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
) -> None:
|
|
199
|
+
@staticmethod
|
|
200
|
+
@staticmethod
|
|
201
|
+
async def update_metadata(agent_id: str, new_metadata: Dict[str, Any]) -> None:
|
|
199
202
|
"""Update metadata for an agent."""
|
|
200
203
|
try:
|
|
201
204
|
metadata_key = f"indexed_urls_{agent_id}"
|
|
@@ -214,7 +217,7 @@ class FirecrawlMetadataManager:
|
|
|
214
217
|
async def index_documents(
|
|
215
218
|
documents: List[Document],
|
|
216
219
|
agent_id: str,
|
|
217
|
-
|
|
220
|
+
vector_manager: FirecrawlVectorStoreManager,
|
|
218
221
|
chunk_size: int = 1000,
|
|
219
222
|
chunk_overlap: int = 200,
|
|
220
223
|
) -> Tuple[int, bool]:
|
|
@@ -224,7 +227,7 @@ async def index_documents(
|
|
|
224
227
|
Args:
|
|
225
228
|
documents: List of documents to index
|
|
226
229
|
agent_id: Agent ID for storage
|
|
227
|
-
|
|
230
|
+
vector_manager: Vector store manager
|
|
228
231
|
chunk_size: Size of text chunks
|
|
229
232
|
chunk_overlap: Overlap between chunks
|
|
230
233
|
|
|
@@ -233,8 +236,6 @@ async def index_documents(
|
|
|
233
236
|
"""
|
|
234
237
|
try:
|
|
235
238
|
# Initialize managers
|
|
236
|
-
vs_manager = FirecrawlVectorStoreManager(skill_store)
|
|
237
|
-
|
|
238
239
|
# Split documents into chunks
|
|
239
240
|
split_docs = FirecrawlDocumentProcessor.split_documents(
|
|
240
241
|
documents, chunk_size, chunk_overlap
|
|
@@ -245,10 +246,10 @@ async def index_documents(
|
|
|
245
246
|
return 0, False
|
|
246
247
|
|
|
247
248
|
# Create embeddings
|
|
248
|
-
embeddings =
|
|
249
|
+
embeddings = vector_manager.create_embeddings()
|
|
249
250
|
|
|
250
251
|
# Try to load existing vector store
|
|
251
|
-
existing_vector_store = await
|
|
252
|
+
existing_vector_store = await vector_manager.load_vector_store(agent_id)
|
|
252
253
|
|
|
253
254
|
if existing_vector_store:
|
|
254
255
|
# Add to existing vector store
|
|
@@ -261,7 +262,7 @@ async def index_documents(
|
|
|
261
262
|
was_merged = False
|
|
262
263
|
|
|
263
264
|
# Save the vector store
|
|
264
|
-
await
|
|
265
|
+
await vector_manager.save_vector_store(
|
|
265
266
|
agent_id, vector_store, chunk_size, chunk_overlap
|
|
266
267
|
)
|
|
267
268
|
|
|
@@ -278,7 +279,7 @@ async def index_documents(
|
|
|
278
279
|
async def query_indexed_content(
|
|
279
280
|
query: str,
|
|
280
281
|
agent_id: str,
|
|
281
|
-
|
|
282
|
+
vector_manager: FirecrawlVectorStoreManager,
|
|
282
283
|
max_results: int = 4,
|
|
283
284
|
) -> List[Document]:
|
|
284
285
|
"""
|
|
@@ -287,7 +288,7 @@ async def query_indexed_content(
|
|
|
287
288
|
Args:
|
|
288
289
|
query: Search query
|
|
289
290
|
agent_id: Agent ID
|
|
290
|
-
|
|
291
|
+
vector_manager: Manager for vector store persistence
|
|
291
292
|
max_results: Maximum number of results to return
|
|
292
293
|
|
|
293
294
|
Returns:
|
|
@@ -295,10 +296,8 @@ async def query_indexed_content(
|
|
|
295
296
|
"""
|
|
296
297
|
try:
|
|
297
298
|
# Initialize vector store manager
|
|
298
|
-
vs_manager = FirecrawlVectorStoreManager(skill_store)
|
|
299
|
-
|
|
300
299
|
# Load vector store
|
|
301
|
-
vector_store = await
|
|
300
|
+
vector_store = await vector_manager.load_vector_store(agent_id)
|
|
302
301
|
|
|
303
302
|
if not vector_store:
|
|
304
303
|
logger.warning(f"No vector store found for agent {agent_id}")
|
|
@@ -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.github.base import GitHubBaseTool
|
|
6
5
|
from intentkit.skills.github.github_search import GitHubSearch
|
|
@@ -22,7 +21,6 @@ class Config(SkillConfig):
|
|
|
22
21
|
async def get_skills(
|
|
23
22
|
config: "Config",
|
|
24
23
|
is_private: bool,
|
|
25
|
-
store: SkillStoreABC,
|
|
26
24
|
**_,
|
|
27
25
|
) -> list[GitHubBaseTool]:
|
|
28
26
|
"""Get all GitHub skills."""
|
|
@@ -36,19 +34,16 @@ async def get_skills(
|
|
|
36
34
|
available_skills.append(skill_name)
|
|
37
35
|
|
|
38
36
|
# Get each skill using the cached getter
|
|
39
|
-
return [get_github_skill(name
|
|
37
|
+
return [get_github_skill(name) for name in available_skills]
|
|
40
38
|
|
|
41
39
|
|
|
42
40
|
def get_github_skill(
|
|
43
41
|
name: str,
|
|
44
|
-
store: SkillStoreABC,
|
|
45
42
|
) -> GitHubBaseTool:
|
|
46
43
|
"""Get a GitHub skill by name."""
|
|
47
44
|
if name == "github_search":
|
|
48
45
|
if name not in _cache:
|
|
49
|
-
_cache[name] = GitHubSearch(
|
|
50
|
-
skill_store=store,
|
|
51
|
-
)
|
|
46
|
+
_cache[name] = GitHubSearch()
|
|
52
47
|
return _cache[name]
|
|
53
48
|
else:
|
|
54
49
|
raise ValueError(f"Unknown GitHub skill: {name}")
|
intentkit/skills/github/base.py
CHANGED
|
@@ -2,7 +2,6 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
6
5
|
from intentkit.skills.base import IntentKitSkill
|
|
7
6
|
|
|
8
7
|
|
|
@@ -12,9 +11,6 @@ class GitHubBaseTool(IntentKitSkill):
|
|
|
12
11
|
name: str = Field(description="The name of the tool")
|
|
13
12
|
description: str = Field(description="A description of what the tool does")
|
|
14
13
|
args_schema: Type[BaseModel]
|
|
15
|
-
skill_store: SkillStoreABC = Field(
|
|
16
|
-
description="The skill store for persisting data"
|
|
17
|
-
)
|
|
18
14
|
|
|
19
15
|
@property
|
|
20
16
|
def category(self) -> str:
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import NotRequired, TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
7
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
8
|
from intentkit.skills.heurist.image_generation_animagine_xl import (
|
|
@@ -52,7 +51,6 @@ class Config(SkillConfig):
|
|
|
52
51
|
async def get_skills(
|
|
53
52
|
config: "Config",
|
|
54
53
|
is_private: bool,
|
|
55
|
-
store: SkillStoreABC,
|
|
56
54
|
**_,
|
|
57
55
|
) -> list[HeuristBaseTool]:
|
|
58
56
|
"""Get all Heurist AI skills.
|
|
@@ -60,7 +58,6 @@ async def get_skills(
|
|
|
60
58
|
Args:
|
|
61
59
|
config: The configuration for Heurist AI skills.
|
|
62
60
|
is_private: Whether to include private skills.
|
|
63
|
-
store: The skill store for persisting data.
|
|
64
61
|
|
|
65
62
|
Returns:
|
|
66
63
|
A list of Heurist AI skills.
|
|
@@ -77,7 +74,7 @@ async def get_skills(
|
|
|
77
74
|
# Get each skill using the cached getter
|
|
78
75
|
result = []
|
|
79
76
|
for name in available_skills:
|
|
80
|
-
skill = get_heurist_skill(name
|
|
77
|
+
skill = get_heurist_skill(name)
|
|
81
78
|
if skill:
|
|
82
79
|
result.append(skill)
|
|
83
80
|
return result
|
|
@@ -85,58 +82,42 @@ async def get_skills(
|
|
|
85
82
|
|
|
86
83
|
def get_heurist_skill(
|
|
87
84
|
name: str,
|
|
88
|
-
store: SkillStoreABC,
|
|
89
85
|
) -> HeuristBaseTool:
|
|
90
86
|
"""Get a Heurist AI skill by name.
|
|
91
87
|
|
|
92
88
|
Args:
|
|
93
89
|
name: The name of the skill to get
|
|
94
|
-
store: The skill store for persisting data
|
|
95
90
|
|
|
96
91
|
Returns:
|
|
97
92
|
The requested Heurist AI skill
|
|
98
93
|
"""
|
|
99
94
|
if name == "image_generation_animagine_xl":
|
|
100
95
|
if name not in _cache:
|
|
101
|
-
_cache[name] = ImageGenerationAnimagineXL(
|
|
102
|
-
skill_store=store,
|
|
103
|
-
)
|
|
96
|
+
_cache[name] = ImageGenerationAnimagineXL()
|
|
104
97
|
return _cache[name]
|
|
105
98
|
elif name == "image_generation_arthemy_comics":
|
|
106
99
|
if name not in _cache:
|
|
107
|
-
_cache[name] = ImageGenerationArthemyComics(
|
|
108
|
-
skill_store=store,
|
|
109
|
-
)
|
|
100
|
+
_cache[name] = ImageGenerationArthemyComics()
|
|
110
101
|
return _cache[name]
|
|
111
102
|
elif name == "image_generation_arthemy_real":
|
|
112
103
|
if name not in _cache:
|
|
113
|
-
_cache[name] = ImageGenerationArthemyReal(
|
|
114
|
-
skill_store=store,
|
|
115
|
-
)
|
|
104
|
+
_cache[name] = ImageGenerationArthemyReal()
|
|
116
105
|
return _cache[name]
|
|
117
106
|
elif name == "image_generation_braindance":
|
|
118
107
|
if name not in _cache:
|
|
119
|
-
_cache[name] = ImageGenerationBrainDance(
|
|
120
|
-
skill_store=store,
|
|
121
|
-
)
|
|
108
|
+
_cache[name] = ImageGenerationBrainDance()
|
|
122
109
|
return _cache[name]
|
|
123
110
|
elif name == "image_generation_cyber_realistic_xl":
|
|
124
111
|
if name not in _cache:
|
|
125
|
-
_cache[name] = ImageGenerationCyberRealisticXL(
|
|
126
|
-
skill_store=store,
|
|
127
|
-
)
|
|
112
|
+
_cache[name] = ImageGenerationCyberRealisticXL()
|
|
128
113
|
return _cache[name]
|
|
129
114
|
elif name == "image_generation_flux_1_dev":
|
|
130
115
|
if name not in _cache:
|
|
131
|
-
_cache[name] = ImageGenerationFlux1Dev(
|
|
132
|
-
skill_store=store,
|
|
133
|
-
)
|
|
116
|
+
_cache[name] = ImageGenerationFlux1Dev()
|
|
134
117
|
return _cache[name]
|
|
135
118
|
elif name == "image_generation_sdxl":
|
|
136
119
|
if name not in _cache:
|
|
137
|
-
_cache[name] = ImageGenerationSDXL(
|
|
138
|
-
skill_store=store,
|
|
139
|
-
)
|
|
120
|
+
_cache[name] = ImageGenerationSDXL()
|
|
140
121
|
return _cache[name]
|
|
141
122
|
else:
|
|
142
123
|
logger.warning(f"Unknown Heurist skill: {name}")
|
intentkit/skills/heurist/base.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import Type
|
|
|
5
5
|
from langchain_core.tools.base import ToolException
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
-
from intentkit.
|
|
8
|
+
from intentkit.config.config import config
|
|
9
9
|
from intentkit.skills.base import IntentKitSkill
|
|
10
10
|
|
|
11
11
|
|
|
@@ -18,16 +18,13 @@ class HeuristBaseTool(IntentKitSkill):
|
|
|
18
18
|
name: str = Field(description="The name of the tool")
|
|
19
19
|
description: str = Field(description="A description of what the tool does")
|
|
20
20
|
args_schema: Type[BaseModel]
|
|
21
|
-
skill_store: SkillStoreABC = Field(
|
|
22
|
-
description="The skill store for persisting data"
|
|
23
|
-
)
|
|
24
21
|
|
|
25
22
|
def get_api_key(self) -> str:
|
|
26
23
|
context = self.get_context()
|
|
27
24
|
skill_config = context.agent.skill_config(self.category)
|
|
28
25
|
api_key_provider = skill_config.get("api_key_provider")
|
|
29
26
|
if api_key_provider == "platform":
|
|
30
|
-
return
|
|
27
|
+
return config.heurist_api_key
|
|
31
28
|
# for backward compatibility, may only have api_key in skill_config
|
|
32
29
|
elif skill_config.get("api_key"):
|
|
33
30
|
return skill_config.get("api_key")
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -79,20 +80,19 @@ class ImageGenerationAnimagineXL(HeuristBaseTool):
|
|
|
79
80
|
skill_config = context.agent.skill_config(self.category)
|
|
80
81
|
skill_config = skill_config
|
|
81
82
|
|
|
82
|
-
# Get the Heurist API key from
|
|
83
|
+
# Get the Heurist API key from configuration
|
|
83
84
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
84
85
|
api_key = skill_config["api_key"]
|
|
85
86
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
86
87
|
"rate_limit_minutes"
|
|
87
88
|
):
|
|
88
89
|
await self.user_rate_limit_by_category(
|
|
89
|
-
context.user_id,
|
|
90
90
|
skill_config["rate_limit_number"],
|
|
91
|
-
skill_config["rate_limit_minutes"],
|
|
91
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
92
92
|
)
|
|
93
93
|
else:
|
|
94
|
-
api_key =
|
|
95
|
-
await self.user_rate_limit_by_category(
|
|
94
|
+
api_key = config.heurist_api_key
|
|
95
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
96
96
|
|
|
97
97
|
# Generate a unique job ID
|
|
98
98
|
job_id = str(XID())
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -78,20 +79,19 @@ class ImageGenerationArthemyComics(HeuristBaseTool):
|
|
|
78
79
|
skill_config = context.agent.skill_config(self.category)
|
|
79
80
|
skill_config = skill_config
|
|
80
81
|
|
|
81
|
-
# Get the Heurist API key from
|
|
82
|
+
# Get the Heurist API key from configuration
|
|
82
83
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
83
84
|
api_key = skill_config["api_key"]
|
|
84
85
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
85
86
|
"rate_limit_minutes"
|
|
86
87
|
):
|
|
87
88
|
await self.user_rate_limit_by_category(
|
|
88
|
-
context.user_id,
|
|
89
89
|
skill_config["rate_limit_number"],
|
|
90
|
-
skill_config["rate_limit_minutes"],
|
|
90
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
91
91
|
)
|
|
92
92
|
else:
|
|
93
|
-
api_key =
|
|
94
|
-
await self.user_rate_limit_by_category(
|
|
93
|
+
api_key = config.heurist_api_key
|
|
94
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
95
95
|
|
|
96
96
|
# Generate a unique job ID
|
|
97
97
|
job_id = str(XID())
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -78,20 +79,19 @@ class ImageGenerationArthemyReal(HeuristBaseTool):
|
|
|
78
79
|
skill_config = context.agent.skill_config(self.category)
|
|
79
80
|
skill_config = skill_config
|
|
80
81
|
|
|
81
|
-
# Get the Heurist API key from
|
|
82
|
+
# Get the Heurist API key from configuration
|
|
82
83
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
83
84
|
api_key = skill_config["api_key"]
|
|
84
85
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
85
86
|
"rate_limit_minutes"
|
|
86
87
|
):
|
|
87
88
|
await self.user_rate_limit_by_category(
|
|
88
|
-
context.user_id,
|
|
89
89
|
skill_config["rate_limit_number"],
|
|
90
|
-
skill_config["rate_limit_minutes"],
|
|
90
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
91
91
|
)
|
|
92
92
|
else:
|
|
93
|
-
api_key =
|
|
94
|
-
await self.user_rate_limit_by_category(
|
|
93
|
+
api_key = config.heurist_api_key
|
|
94
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
95
95
|
|
|
96
96
|
# Generate a unique job ID
|
|
97
97
|
job_id = str(XID())
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -78,20 +79,19 @@ class ImageGenerationBrainDance(HeuristBaseTool):
|
|
|
78
79
|
skill_config = context.agent.skill_config(self.category)
|
|
79
80
|
skill_config = skill_config
|
|
80
81
|
|
|
81
|
-
# Get the Heurist API key from
|
|
82
|
+
# Get the Heurist API key from configuration
|
|
82
83
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
83
84
|
api_key = skill_config["api_key"]
|
|
84
85
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
85
86
|
"rate_limit_minutes"
|
|
86
87
|
):
|
|
87
88
|
await self.user_rate_limit_by_category(
|
|
88
|
-
context.user_id,
|
|
89
89
|
skill_config["rate_limit_number"],
|
|
90
|
-
skill_config["rate_limit_minutes"],
|
|
90
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
91
91
|
)
|
|
92
92
|
else:
|
|
93
|
-
api_key =
|
|
94
|
-
await self.user_rate_limit_by_category(
|
|
93
|
+
api_key = config.heurist_api_key
|
|
94
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
95
95
|
|
|
96
96
|
# Generate a unique job ID
|
|
97
97
|
job_id = str(XID())
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -78,20 +79,19 @@ class ImageGenerationCyberRealisticXL(HeuristBaseTool):
|
|
|
78
79
|
skill_config = context.agent.skill_config(self.category)
|
|
79
80
|
skill_config = skill_config
|
|
80
81
|
|
|
81
|
-
# Get the Heurist API key from
|
|
82
|
+
# Get the Heurist API key from configuration
|
|
82
83
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
83
84
|
api_key = skill_config["api_key"]
|
|
84
85
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
85
86
|
"rate_limit_minutes"
|
|
86
87
|
):
|
|
87
88
|
await self.user_rate_limit_by_category(
|
|
88
|
-
context.user_id,
|
|
89
89
|
skill_config["rate_limit_number"],
|
|
90
|
-
skill_config["rate_limit_minutes"],
|
|
90
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
91
91
|
)
|
|
92
92
|
else:
|
|
93
|
-
api_key =
|
|
94
|
-
await self.user_rate_limit_by_category(
|
|
93
|
+
api_key = config.heurist_api_key
|
|
94
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
95
95
|
|
|
96
96
|
# Generate a unique job ID
|
|
97
97
|
job_id = str(XID())
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -78,20 +79,19 @@ class ImageGenerationFlux1Dev(HeuristBaseTool):
|
|
|
78
79
|
skill_config = context.agent.skill_config(self.category)
|
|
79
80
|
skill_config = skill_config
|
|
80
81
|
|
|
81
|
-
# Get the Heurist API key from
|
|
82
|
+
# Get the Heurist API key from configuration
|
|
82
83
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
83
84
|
api_key = skill_config["api_key"]
|
|
84
85
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
85
86
|
"rate_limit_minutes"
|
|
86
87
|
):
|
|
87
88
|
await self.user_rate_limit_by_category(
|
|
88
|
-
context.user_id,
|
|
89
89
|
skill_config["rate_limit_number"],
|
|
90
|
-
skill_config["rate_limit_minutes"],
|
|
90
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
91
91
|
)
|
|
92
92
|
else:
|
|
93
|
-
api_key =
|
|
94
|
-
await self.user_rate_limit_by_category(
|
|
93
|
+
api_key = config.heurist_api_key
|
|
94
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
95
95
|
|
|
96
96
|
# Generate a unique job ID
|
|
97
97
|
job_id = str(XID())
|
|
@@ -5,6 +5,7 @@ import httpx
|
|
|
5
5
|
from epyxid import XID
|
|
6
6
|
from pydantic import BaseModel, Field
|
|
7
7
|
|
|
8
|
+
from intentkit.config.config import config
|
|
8
9
|
from intentkit.skills.heurist.base import HeuristBaseTool
|
|
9
10
|
from intentkit.utils.s3 import store_image
|
|
10
11
|
|
|
@@ -78,20 +79,19 @@ class ImageGenerationSDXL(HeuristBaseTool):
|
|
|
78
79
|
skill_config = context.agent.skill_config(self.category)
|
|
79
80
|
skill_config = skill_config
|
|
80
81
|
|
|
81
|
-
# Get the Heurist API key from
|
|
82
|
+
# Get the Heurist API key from configuration
|
|
82
83
|
if "api_key" in skill_config and skill_config["api_key"]:
|
|
83
84
|
api_key = skill_config["api_key"]
|
|
84
85
|
if skill_config.get("rate_limit_number") and skill_config.get(
|
|
85
86
|
"rate_limit_minutes"
|
|
86
87
|
):
|
|
87
88
|
await self.user_rate_limit_by_category(
|
|
88
|
-
context.user_id,
|
|
89
89
|
skill_config["rate_limit_number"],
|
|
90
|
-
skill_config["rate_limit_minutes"],
|
|
90
|
+
skill_config["rate_limit_minutes"] * 60,
|
|
91
91
|
)
|
|
92
92
|
else:
|
|
93
|
-
api_key =
|
|
94
|
-
await self.user_rate_limit_by_category(
|
|
93
|
+
api_key = config.heurist_api_key
|
|
94
|
+
await self.user_rate_limit_by_category(10, 1440 * 60)
|
|
95
95
|
|
|
96
96
|
# Generate a unique job ID
|
|
97
97
|
job_id = str(XID())
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import TypedDict
|
|
5
5
|
|
|
6
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
7
6
|
from intentkit.skills.base import SkillConfig, SkillState
|
|
8
7
|
from intentkit.skills.http.base import HttpBaseTool
|
|
9
8
|
from intentkit.skills.http.get import HttpGet
|
|
@@ -33,7 +32,6 @@ class Config(SkillConfig):
|
|
|
33
32
|
async def get_skills(
|
|
34
33
|
config: "Config",
|
|
35
34
|
is_private: bool,
|
|
36
|
-
store: SkillStoreABC,
|
|
37
35
|
**_,
|
|
38
36
|
) -> list[HttpBaseTool]:
|
|
39
37
|
"""Get all HTTP client skills.
|
|
@@ -41,7 +39,6 @@ async def get_skills(
|
|
|
41
39
|
Args:
|
|
42
40
|
config: The configuration for HTTP client skills.
|
|
43
41
|
is_private: Whether to include private skills.
|
|
44
|
-
store: The skill store for persisting data.
|
|
45
42
|
|
|
46
43
|
Returns:
|
|
47
44
|
A list of HTTP client skills.
|
|
@@ -58,7 +55,7 @@ async def get_skills(
|
|
|
58
55
|
# Get each skill using the cached getter
|
|
59
56
|
result = []
|
|
60
57
|
for name in available_skills:
|
|
61
|
-
skill = get_http_skill(name
|
|
58
|
+
skill = get_http_skill(name)
|
|
62
59
|
if skill:
|
|
63
60
|
result.append(skill)
|
|
64
61
|
return result
|
|
@@ -66,34 +63,26 @@ async def get_skills(
|
|
|
66
63
|
|
|
67
64
|
def get_http_skill(
|
|
68
65
|
name: str,
|
|
69
|
-
store: SkillStoreABC,
|
|
70
66
|
) -> HttpBaseTool:
|
|
71
67
|
"""Get an HTTP client skill by name.
|
|
72
68
|
|
|
73
69
|
Args:
|
|
74
70
|
name: The name of the skill to get
|
|
75
|
-
store: The skill store for persisting data
|
|
76
71
|
|
|
77
72
|
Returns:
|
|
78
73
|
The requested HTTP client skill
|
|
79
74
|
"""
|
|
80
75
|
if name == "http_get":
|
|
81
76
|
if name not in _cache:
|
|
82
|
-
_cache[name] = HttpGet(
|
|
83
|
-
skill_store=store,
|
|
84
|
-
)
|
|
77
|
+
_cache[name] = HttpGet()
|
|
85
78
|
return _cache[name]
|
|
86
79
|
elif name == "http_post":
|
|
87
80
|
if name not in _cache:
|
|
88
|
-
_cache[name] = HttpPost(
|
|
89
|
-
skill_store=store,
|
|
90
|
-
)
|
|
81
|
+
_cache[name] = HttpPost()
|
|
91
82
|
return _cache[name]
|
|
92
83
|
elif name == "http_put":
|
|
93
84
|
if name not in _cache:
|
|
94
|
-
_cache[name] = HttpPut(
|
|
95
|
-
skill_store=store,
|
|
96
|
-
)
|
|
85
|
+
_cache[name] = HttpPut()
|
|
97
86
|
return _cache[name]
|
|
98
87
|
else:
|
|
99
88
|
logger.warning(f"Unknown HTTP skill: {name}")
|
intentkit/skills/http/base.py
CHANGED
|
@@ -2,7 +2,6 @@ from typing import Type
|
|
|
2
2
|
|
|
3
3
|
from pydantic import BaseModel, Field
|
|
4
4
|
|
|
5
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
6
5
|
from intentkit.skills.base import IntentKitSkill
|
|
7
6
|
|
|
8
7
|
|
|
@@ -12,9 +11,6 @@ class HttpBaseTool(IntentKitSkill):
|
|
|
12
11
|
name: str = Field(description="The name of the tool")
|
|
13
12
|
description: str = Field(description="A description of what the tool does")
|
|
14
13
|
args_schema: Type[BaseModel]
|
|
15
|
-
skill_store: SkillStoreABC = Field(
|
|
16
|
-
description="The skill store for persisting data"
|
|
17
|
-
)
|
|
18
14
|
|
|
19
15
|
@property
|
|
20
16
|
def category(self) -> str:
|