intentkit 0.8.12rc0__py3-none-any.whl → 0.8.13.dev1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intentkit might be problematic. Click here for more details.
- intentkit/__init__.py +1 -1
- intentkit/abstracts/skill.py +2 -59
- intentkit/clients/twitter.py +35 -28
- intentkit/config/config.py +1 -0
- intentkit/core/agent.py +2 -279
- intentkit/core/asset.py +63 -16
- intentkit/core/engine.py +9 -5
- intentkit/core/scheduler.py +8 -8
- intentkit/models/agent.py +138 -94
- intentkit/models/agent_schema.json +6 -9
- intentkit/models/chat.py +1 -0
- intentkit/models/llm.csv +15 -12
- 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 -5
- intentkit/skills/cdp/base.py +0 -4
- intentkit/skills/cdp/schema.json +1 -17
- 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/utils/schema.py +100 -0
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/METADATA +1 -1
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/RECORD +175 -174
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/WHEEL +0 -0
- {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,121 +1,118 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from typing import Dict, List, Optional, Tuple, Type
|
|
3
|
-
|
|
4
|
-
from langchain_core.tools.base import ToolException
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from intentkit.
|
|
8
|
-
from intentkit.skills.base import IntentKitSkill
|
|
9
|
-
|
|
10
|
-
logger = logging.getLogger(__name__)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class VeniceAudioBaseTool(IntentKitSkill):
|
|
14
|
-
"""Base class for Venice Audio tools."""
|
|
15
|
-
|
|
16
|
-
name: str = Field(default="venice_base_tool", description="The name of the tool")
|
|
17
|
-
description: str = Field(description="A description of what the tool does")
|
|
18
|
-
args_schema: Type[BaseModel] # type: ignore
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
logger.debug(
|
|
120
|
-
f"No agent rate limits configured for category '{self.category}'. Skipping rate limit for user {user_id}."
|
|
121
|
-
)
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Dict, List, Optional, Tuple, Type
|
|
3
|
+
|
|
4
|
+
from langchain_core.tools.base import ToolException
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
from intentkit.config.config import config
|
|
8
|
+
from intentkit.skills.base import IntentKitSkill
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class VeniceAudioBaseTool(IntentKitSkill):
|
|
14
|
+
"""Base class for Venice Audio tools."""
|
|
15
|
+
|
|
16
|
+
name: str = Field(default="venice_base_tool", description="The name of the tool")
|
|
17
|
+
description: str = Field(description="A description of what the tool does")
|
|
18
|
+
args_schema: Type[BaseModel] # type: ignore
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def category(self) -> str:
|
|
22
|
+
return "venice_audio"
|
|
23
|
+
|
|
24
|
+
def validate_voice_model(
|
|
25
|
+
self, context, voice_model: str
|
|
26
|
+
) -> Tuple[bool, Optional[Dict[str, object]]]:
|
|
27
|
+
config = context.config
|
|
28
|
+
|
|
29
|
+
selected_model = config.get("voice_model")
|
|
30
|
+
custom_models = config.get("voice_model_custom", [])
|
|
31
|
+
|
|
32
|
+
allowed_voice_models: List[str] = []
|
|
33
|
+
|
|
34
|
+
if selected_model == "custom":
|
|
35
|
+
allowed_voice_models = custom_models or []
|
|
36
|
+
else:
|
|
37
|
+
allowed_voice_models = [selected_model] if selected_model else []
|
|
38
|
+
|
|
39
|
+
if voice_model not in allowed_voice_models:
|
|
40
|
+
return False, {
|
|
41
|
+
"error": f'"{voice_model}" is not allowed',
|
|
42
|
+
"allowed": allowed_voice_models,
|
|
43
|
+
"suggestion": "please try again with allowed voice model",
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return True, None
|
|
47
|
+
|
|
48
|
+
def get_api_key(self) -> str:
|
|
49
|
+
"""
|
|
50
|
+
Retrieves the Venice AI API key based on the api_key_provider setting.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
The API key if found.
|
|
54
|
+
|
|
55
|
+
Raises:
|
|
56
|
+
ToolException: If the API key is not found or provider is invalid.
|
|
57
|
+
"""
|
|
58
|
+
try:
|
|
59
|
+
context = self.get_context()
|
|
60
|
+
skill_config = context.agent.skill_config(self.category)
|
|
61
|
+
api_key_provider = skill_config.get("api_key_provider")
|
|
62
|
+
if api_key_provider == "agent_owner":
|
|
63
|
+
agent_api_key = skill_config.get("api_key")
|
|
64
|
+
if agent_api_key:
|
|
65
|
+
logger.debug(
|
|
66
|
+
f"Using agent-specific Venice API key for skill {self.name} in category {self.category}"
|
|
67
|
+
)
|
|
68
|
+
return agent_api_key
|
|
69
|
+
raise ToolException(
|
|
70
|
+
f"No agent-owned Venice API key found for skill '{self.name}' in category '{self.category}'."
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
elif api_key_provider == "platform":
|
|
74
|
+
system_api_key = config.venice_api_key
|
|
75
|
+
if system_api_key:
|
|
76
|
+
logger.debug(
|
|
77
|
+
f"Using system Venice API key for skill {self.name} in category {self.category}"
|
|
78
|
+
)
|
|
79
|
+
return system_api_key
|
|
80
|
+
raise ToolException(
|
|
81
|
+
f"No platform-hosted Venice API key found for skill '{self.name}' in category '{self.category}'."
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
else:
|
|
85
|
+
raise ToolException(
|
|
86
|
+
f"Invalid API key provider '{api_key_provider}' for skill '{self.name}'"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
except Exception as e:
|
|
90
|
+
raise ToolException(f"Failed to retrieve Venice API key: {str(e)}") from e
|
|
91
|
+
|
|
92
|
+
async def apply_rate_limit(self, context) -> None:
|
|
93
|
+
"""
|
|
94
|
+
Applies rate limiting ONLY if specified in the agent's config ('skill_config').
|
|
95
|
+
Checks for 'rate_limit_number' and 'rate_limit_minutes'.
|
|
96
|
+
If not configured, NO rate limiting is applied.
|
|
97
|
+
Raises ConnectionAbortedError if the configured limit is exceeded.
|
|
98
|
+
"""
|
|
99
|
+
skill_config = context.agent.skill_config(self.category)
|
|
100
|
+
user_id = context.agent.id
|
|
101
|
+
|
|
102
|
+
# Get agent-specific limits safely
|
|
103
|
+
limit_num = skill_config.get("rate_limit_number")
|
|
104
|
+
limit_min = skill_config.get("rate_limit_minutes")
|
|
105
|
+
|
|
106
|
+
# Apply limit ONLY if both values are present and valid (truthy check handles None and 0)
|
|
107
|
+
if limit_num and limit_min:
|
|
108
|
+
limit_source = "Agent"
|
|
109
|
+
logger.debug(
|
|
110
|
+
f"Applying {limit_source} rate limit ({limit_num}/{limit_min} min) for user {user_id} on {self.name}"
|
|
111
|
+
)
|
|
112
|
+
if user_id:
|
|
113
|
+
await self.user_rate_limit_by_category(limit_num, limit_min * 60)
|
|
114
|
+
else:
|
|
115
|
+
# No valid agent configuration found, so do nothing.
|
|
116
|
+
logger.debug(
|
|
117
|
+
f"No agent rate limits configured for category '{self.category}'. Skipping rate limit for user {user_id}."
|
|
118
|
+
)
|
|
@@ -4,9 +4,8 @@ import logging
|
|
|
4
4
|
from typing import Any, Dict, Optional, Type
|
|
5
5
|
|
|
6
6
|
import httpx
|
|
7
|
-
from pydantic import BaseModel
|
|
7
|
+
from pydantic import BaseModel
|
|
8
8
|
|
|
9
|
-
from intentkit.abstracts.skill import SkillStoreABC
|
|
10
9
|
from intentkit.skills.venice_audio.base import VeniceAudioBaseTool
|
|
11
10
|
from intentkit.skills.venice_audio.input import AllowedAudioFormat, VeniceAudioInput
|
|
12
11
|
from intentkit.utils.s3 import store_file
|
|
@@ -34,9 +33,6 @@ class VeniceAudioTool(VeniceAudioBaseTool):
|
|
|
34
33
|
"and audio format (mp3, opus, aac, flac, wav, pcm, default mp3)."
|
|
35
34
|
)
|
|
36
35
|
args_schema: Type[BaseModel] = VeniceAudioInput
|
|
37
|
-
skill_store: SkillStoreABC = Field(
|
|
38
|
-
description="The skill store instance for accessing system/agent configurations and persisting data."
|
|
39
|
-
)
|
|
40
36
|
|
|
41
37
|
async def _arun(
|
|
42
38
|
self,
|
|
@@ -1,154 +1,147 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from typing import NotRequired, Optional, TypedDict
|
|
3
|
-
|
|
4
|
-
from intentkit.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
from intentkit.skills.venice_image.
|
|
12
|
-
from intentkit.skills.venice_image.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
from intentkit.skills.venice_image.
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return None
|
|
149
|
-
|
|
150
|
-
# Cache and return the newly created instance
|
|
151
|
-
_cache[name] = skill_class(
|
|
152
|
-
skill_store=store,
|
|
153
|
-
)
|
|
154
|
-
return _cache[name]
|
|
1
|
+
import logging
|
|
2
|
+
from typing import NotRequired, Optional, TypedDict
|
|
3
|
+
|
|
4
|
+
from intentkit.skills.base import (
|
|
5
|
+
SkillConfig,
|
|
6
|
+
SkillState,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
# Import the base tool and all specific model skill classes
|
|
10
|
+
from intentkit.skills.venice_image.base import VeniceImageBaseTool
|
|
11
|
+
from intentkit.skills.venice_image.image_enhance.image_enhance import ImageEnhance
|
|
12
|
+
from intentkit.skills.venice_image.image_generation.image_generation_fluently_xl import (
|
|
13
|
+
ImageGenerationFluentlyXL,
|
|
14
|
+
)
|
|
15
|
+
from intentkit.skills.venice_image.image_generation.image_generation_flux_dev import (
|
|
16
|
+
ImageGenerationFluxDev,
|
|
17
|
+
)
|
|
18
|
+
from intentkit.skills.venice_image.image_generation.image_generation_flux_dev_uncensored import (
|
|
19
|
+
ImageGenerationFluxDevUncensored,
|
|
20
|
+
)
|
|
21
|
+
from intentkit.skills.venice_image.image_generation.image_generation_lustify_sdxl import (
|
|
22
|
+
ImageGenerationLustifySDXL,
|
|
23
|
+
)
|
|
24
|
+
from intentkit.skills.venice_image.image_generation.image_generation_pony_realism import (
|
|
25
|
+
ImageGenerationPonyRealism,
|
|
26
|
+
)
|
|
27
|
+
from intentkit.skills.venice_image.image_generation.image_generation_stable_diffusion_3_5 import (
|
|
28
|
+
ImageGenerationStableDiffusion35,
|
|
29
|
+
)
|
|
30
|
+
from intentkit.skills.venice_image.image_generation.image_generation_venice_sd35 import (
|
|
31
|
+
ImageGenerationVeniceSD35,
|
|
32
|
+
)
|
|
33
|
+
from intentkit.skills.venice_image.image_upscale.image_upscale import ImageUpscale
|
|
34
|
+
from intentkit.skills.venice_image.image_vision.image_vision import ImageVision
|
|
35
|
+
|
|
36
|
+
# Cache skills at the system level, because they are stateless and only depend on the store
|
|
37
|
+
_cache: dict[str, VeniceImageBaseTool] = {}
|
|
38
|
+
|
|
39
|
+
logger = logging.getLogger(__name__)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
# Define the expected structure for the 'states' dictionary in the config
|
|
43
|
+
class SkillStates(TypedDict):
|
|
44
|
+
image_upscale: SkillState
|
|
45
|
+
image_enhance: SkillState
|
|
46
|
+
image_vision: SkillState
|
|
47
|
+
image_generation_flux_dev: SkillState
|
|
48
|
+
image_generation_flux_dev_uncensored: SkillState
|
|
49
|
+
image_generation_venice_sd35: SkillState
|
|
50
|
+
image_generation_fluently_xl: SkillState
|
|
51
|
+
image_generation_lustify_sdxl: SkillState
|
|
52
|
+
image_generation_pony_realism: SkillState
|
|
53
|
+
image_generation_stable_diffusion_3_5: SkillState
|
|
54
|
+
# Add new skill names here if more models are added
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# Define the overall configuration structure for the venice_image category
|
|
58
|
+
class Config(SkillConfig):
|
|
59
|
+
"""Configuration for Venice Image skills."""
|
|
60
|
+
|
|
61
|
+
enabled: bool # Keep standard enabled flag
|
|
62
|
+
states: SkillStates
|
|
63
|
+
api_key_provider: str = "agent_owner"
|
|
64
|
+
api_key: NotRequired[Optional[str]] # Explicitly Optional
|
|
65
|
+
safe_mode: NotRequired[bool] # Defaults handled in base or usage
|
|
66
|
+
hide_watermark: NotRequired[bool] # Defaults handled in base or usage
|
|
67
|
+
negative_prompt: NotRequired[str] # Defaults handled in base or usage
|
|
68
|
+
rate_limit_number: NotRequired[Optional[int]] # Explicitly Optional
|
|
69
|
+
rate_limit_minutes: NotRequired[Optional[int]] # Explicitly Optional
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
_SKILL_NAME_TO_CLASS_MAP: dict[str, type[VeniceImageBaseTool]] = {
|
|
73
|
+
"image_upscale": ImageUpscale,
|
|
74
|
+
"image_enhance": ImageEnhance,
|
|
75
|
+
"image_vision": ImageVision,
|
|
76
|
+
"image_generation_flux_dev": ImageGenerationFluxDev,
|
|
77
|
+
"image_generation_flux_dev_uncensored": ImageGenerationFluxDevUncensored,
|
|
78
|
+
"image_generation_venice_sd35": ImageGenerationVeniceSD35,
|
|
79
|
+
"image_generation_fluently_xl": ImageGenerationFluentlyXL,
|
|
80
|
+
"image_generation_lustify_sdxl": ImageGenerationLustifySDXL,
|
|
81
|
+
"image_generation_pony_realism": ImageGenerationPonyRealism,
|
|
82
|
+
"image_generation_stable_diffusion_3_5": ImageGenerationStableDiffusion35,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
async def get_skills(
|
|
87
|
+
config: "Config",
|
|
88
|
+
is_private: bool,
|
|
89
|
+
**_, # Allow for extra arguments if the loader passes them
|
|
90
|
+
) -> list[VeniceImageBaseTool]:
|
|
91
|
+
"""Get all enabled Venice Image skills based on configuration and privacy level.
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
config: The configuration for Venice Image skills.
|
|
95
|
+
is_private: Whether the context is private (e.g., agent owner).
|
|
96
|
+
|
|
97
|
+
Returns:
|
|
98
|
+
A list of instantiated and enabled Venice Image skill objects.
|
|
99
|
+
"""
|
|
100
|
+
# Check if the entire category is disabled first
|
|
101
|
+
if not config.get("enabled", False):
|
|
102
|
+
return []
|
|
103
|
+
|
|
104
|
+
available_skills: list[VeniceImageBaseTool] = []
|
|
105
|
+
|
|
106
|
+
# Include skills based on their state
|
|
107
|
+
for skill_name, state in config["states"].items():
|
|
108
|
+
if state == "disabled":
|
|
109
|
+
continue
|
|
110
|
+
elif state == "public" or (state == "private" and is_private):
|
|
111
|
+
available_skills.append(skill_name)
|
|
112
|
+
|
|
113
|
+
# Get each skill using the cached getter
|
|
114
|
+
result = []
|
|
115
|
+
for name in available_skills:
|
|
116
|
+
skill = get_venice_image_skill(name, config)
|
|
117
|
+
if skill:
|
|
118
|
+
result.append(skill)
|
|
119
|
+
return result
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def get_venice_image_skill(
|
|
123
|
+
name: str,
|
|
124
|
+
config: "Config",
|
|
125
|
+
) -> Optional[VeniceImageBaseTool]:
|
|
126
|
+
"""
|
|
127
|
+
Factory function to get a cached Venice Image skill instance by name.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
name: The name of the skill to get (must match keys in _SKILL_NAME_TO_CLASS_MAP).
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
The requested Venice Image skill instance, or None if the name is unknown.
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
# Return from cache immediately if already exists
|
|
137
|
+
if name in _cache:
|
|
138
|
+
return _cache[name]
|
|
139
|
+
|
|
140
|
+
skill_class = _SKILL_NAME_TO_CLASS_MAP.get(name)
|
|
141
|
+
if not skill_class:
|
|
142
|
+
logger.warning(f"Unknown Venice skill: {name}")
|
|
143
|
+
return None
|
|
144
|
+
|
|
145
|
+
# Cache and return the newly created instance
|
|
146
|
+
_cache[name] = skill_class()
|
|
147
|
+
return _cache[name]
|