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.

Files changed (175) hide show
  1. intentkit/__init__.py +1 -1
  2. intentkit/abstracts/skill.py +2 -59
  3. intentkit/clients/twitter.py +35 -28
  4. intentkit/config/config.py +1 -0
  5. intentkit/core/agent.py +2 -279
  6. intentkit/core/asset.py +63 -16
  7. intentkit/core/engine.py +9 -5
  8. intentkit/core/scheduler.py +8 -8
  9. intentkit/models/agent.py +138 -94
  10. intentkit/models/agent_schema.json +6 -9
  11. intentkit/models/chat.py +1 -0
  12. intentkit/models/llm.csv +15 -12
  13. intentkit/skills/acolyt/__init__.py +2 -9
  14. intentkit/skills/acolyt/base.py +2 -5
  15. intentkit/skills/aixbt/__init__.py +2 -13
  16. intentkit/skills/aixbt/base.py +0 -4
  17. intentkit/skills/aixbt/projects.py +1 -2
  18. intentkit/skills/allora/__init__.py +2 -9
  19. intentkit/skills/allora/base.py +2 -5
  20. intentkit/skills/base.py +101 -27
  21. intentkit/skills/basename/__init__.py +1 -3
  22. intentkit/skills/carv/__init__.py +116 -121
  23. intentkit/skills/carv/base.py +184 -185
  24. intentkit/skills/casino/__init__.py +4 -15
  25. intentkit/skills/casino/base.py +0 -4
  26. intentkit/skills/casino/deck_draw.py +1 -2
  27. intentkit/skills/casino/deck_shuffle.py +1 -2
  28. intentkit/skills/casino/dice_roll.py +1 -2
  29. intentkit/skills/cdp/__init__.py +0 -5
  30. intentkit/skills/cdp/base.py +0 -4
  31. intentkit/skills/cdp/schema.json +1 -17
  32. intentkit/skills/chainlist/__init__.py +2 -7
  33. intentkit/skills/chainlist/base.py +0 -4
  34. intentkit/skills/common/__init__.py +2 -9
  35. intentkit/skills/common/base.py +0 -4
  36. intentkit/skills/cookiefun/__init__.py +6 -9
  37. intentkit/skills/cookiefun/base.py +0 -4
  38. intentkit/skills/cryptocompare/__init__.py +7 -24
  39. intentkit/skills/cryptocompare/base.py +0 -5
  40. intentkit/skills/cryptopanic/__init__.py +3 -6
  41. intentkit/skills/cryptopanic/base.py +53 -55
  42. intentkit/skills/cryptopanic/fetch_crypto_news.py +0 -2
  43. intentkit/skills/cryptopanic/fetch_crypto_sentiment.py +1 -3
  44. intentkit/skills/dapplooker/__init__.py +2 -9
  45. intentkit/skills/dapplooker/base.py +2 -5
  46. intentkit/skills/defillama/__init__.py +24 -74
  47. intentkit/skills/defillama/base.py +0 -4
  48. intentkit/skills/defillama/coins/fetch_batch_historical_prices.py +2 -2
  49. intentkit/skills/defillama/coins/fetch_block.py +2 -2
  50. intentkit/skills/defillama/coins/fetch_current_prices.py +2 -2
  51. intentkit/skills/defillama/coins/fetch_first_price.py +2 -2
  52. intentkit/skills/defillama/coins/fetch_historical_prices.py +2 -2
  53. intentkit/skills/defillama/coins/fetch_price_chart.py +2 -2
  54. intentkit/skills/defillama/coins/fetch_price_percentage.py +2 -2
  55. intentkit/skills/defillama/fees/fetch_fees_overview.py +2 -2
  56. intentkit/skills/defillama/stablecoins/fetch_stablecoin_chains.py +2 -2
  57. intentkit/skills/defillama/stablecoins/fetch_stablecoin_charts.py +2 -2
  58. intentkit/skills/defillama/stablecoins/fetch_stablecoin_prices.py +2 -2
  59. intentkit/skills/defillama/stablecoins/fetch_stablecoins.py +2 -2
  60. intentkit/skills/defillama/tvl/fetch_chain_historical_tvl.py +2 -2
  61. intentkit/skills/defillama/tvl/fetch_chains.py +2 -2
  62. intentkit/skills/defillama/tvl/fetch_historical_tvl.py +2 -2
  63. intentkit/skills/defillama/tvl/fetch_protocol.py +2 -2
  64. intentkit/skills/defillama/tvl/fetch_protocol_current_tvl.py +2 -2
  65. intentkit/skills/defillama/tvl/fetch_protocols.py +2 -2
  66. intentkit/skills/defillama/volumes/fetch_dex_overview.py +2 -2
  67. intentkit/skills/defillama/volumes/fetch_dex_summary.py +2 -2
  68. intentkit/skills/defillama/volumes/fetch_options_overview.py +2 -2
  69. intentkit/skills/defillama/yields/fetch_pool_chart.py +2 -2
  70. intentkit/skills/defillama/yields/fetch_pools.py +2 -2
  71. intentkit/skills/dexscreener/__init__.py +97 -102
  72. intentkit/skills/dexscreener/base.py +125 -130
  73. intentkit/skills/dexscreener/get_pair_info.py +2 -3
  74. intentkit/skills/dexscreener/get_token_pairs.py +2 -3
  75. intentkit/skills/dexscreener/get_tokens_info.py +2 -3
  76. intentkit/skills/dexscreener/search_token.py +2 -4
  77. intentkit/skills/dune_analytics/__init__.py +4 -6
  78. intentkit/skills/dune_analytics/base.py +50 -52
  79. intentkit/skills/dune_analytics/fetch_kol_buys.py +0 -2
  80. intentkit/skills/dune_analytics/fetch_nation_metrics.py +0 -2
  81. intentkit/skills/elfa/__init__.py +5 -18
  82. intentkit/skills/elfa/base.py +8 -10
  83. intentkit/skills/enso/__init__.py +9 -29
  84. intentkit/skills/enso/base.py +3 -6
  85. intentkit/skills/enso/route.py +1 -3
  86. intentkit/skills/erc20/__init__.py +1 -5
  87. intentkit/skills/erc721/__init__.py +1 -3
  88. intentkit/skills/firecrawl/__init__.py +5 -18
  89. intentkit/skills/firecrawl/base.py +2 -5
  90. intentkit/skills/firecrawl/crawl.py +10 -9
  91. intentkit/skills/firecrawl/query.py +3 -1
  92. intentkit/skills/firecrawl/scrape.py +8 -10
  93. intentkit/skills/firecrawl/utils.py +25 -26
  94. intentkit/skills/github/__init__.py +2 -7
  95. intentkit/skills/github/base.py +0 -4
  96. intentkit/skills/heurist/__init__.py +8 -27
  97. intentkit/skills/heurist/base.py +2 -5
  98. intentkit/skills/heurist/image_generation_animagine_xl.py +5 -5
  99. intentkit/skills/heurist/image_generation_arthemy_comics.py +5 -5
  100. intentkit/skills/heurist/image_generation_arthemy_real.py +5 -5
  101. intentkit/skills/heurist/image_generation_braindance.py +5 -5
  102. intentkit/skills/heurist/image_generation_cyber_realistic_xl.py +5 -5
  103. intentkit/skills/heurist/image_generation_flux_1_dev.py +5 -5
  104. intentkit/skills/heurist/image_generation_sdxl.py +5 -5
  105. intentkit/skills/http/__init__.py +4 -15
  106. intentkit/skills/http/base.py +0 -4
  107. intentkit/skills/lifi/__init__.py +1 -6
  108. intentkit/skills/lifi/base.py +0 -4
  109. intentkit/skills/lifi/token_execute.py +1 -4
  110. intentkit/skills/lifi/token_quote.py +1 -3
  111. intentkit/skills/moralis/__init__.py +3 -7
  112. intentkit/skills/moralis/base.py +2 -5
  113. intentkit/skills/morpho/__init__.py +1 -3
  114. intentkit/skills/nation/__init__.py +2 -7
  115. intentkit/skills/nation/base.py +4 -7
  116. intentkit/skills/openai/__init__.py +5 -18
  117. intentkit/skills/openai/base.py +8 -10
  118. intentkit/skills/openai/dalle_image_generation.py +2 -5
  119. intentkit/skills/openai/gpt_image_generation.py +2 -5
  120. intentkit/skills/openai/gpt_image_to_image.py +2 -5
  121. intentkit/skills/openai/image_to_text.py +2 -5
  122. intentkit/skills/portfolio/__init__.py +11 -35
  123. intentkit/skills/portfolio/base.py +2 -5
  124. intentkit/skills/pyth/__init__.py +1 -5
  125. intentkit/skills/slack/__init__.py +5 -17
  126. intentkit/skills/slack/base.py +0 -4
  127. intentkit/skills/supabase/__init__.py +7 -23
  128. intentkit/skills/supabase/base.py +0 -4
  129. intentkit/skills/superfluid/__init__.py +1 -3
  130. intentkit/skills/system/__init__.py +7 -24
  131. intentkit/skills/system/add_autonomous_task.py +2 -2
  132. intentkit/skills/system/delete_autonomous_task.py +2 -2
  133. intentkit/skills/system/edit_autonomous_task.py +2 -4
  134. intentkit/skills/system/list_autonomous_tasks.py +2 -2
  135. intentkit/skills/system/read_agent_api_key.py +6 -4
  136. intentkit/skills/system/regenerate_agent_api_key.py +6 -4
  137. intentkit/skills/tavily/__init__.py +3 -12
  138. intentkit/skills/tavily/base.py +2 -5
  139. intentkit/skills/tavily/tavily_extract.py +1 -2
  140. intentkit/skills/tavily/tavily_search.py +3 -3
  141. intentkit/skills/token/__init__.py +5 -10
  142. intentkit/skills/token/base.py +2 -6
  143. intentkit/skills/twitter/__init__.py +11 -35
  144. intentkit/skills/twitter/base.py +14 -16
  145. intentkit/skills/twitter/follow_user.py +0 -1
  146. intentkit/skills/twitter/get_mentions.py +0 -1
  147. intentkit/skills/twitter/get_timeline.py +0 -1
  148. intentkit/skills/twitter/get_user_by_username.py +0 -1
  149. intentkit/skills/twitter/get_user_tweets.py +0 -1
  150. intentkit/skills/twitter/like_tweet.py +0 -1
  151. intentkit/skills/twitter/post_tweet.py +2 -2
  152. intentkit/skills/twitter/reply_tweet.py +2 -2
  153. intentkit/skills/twitter/retweet.py +0 -1
  154. intentkit/skills/twitter/search_tweets.py +0 -1
  155. intentkit/skills/unrealspeech/__init__.py +2 -7
  156. intentkit/skills/unrealspeech/base.py +0 -4
  157. intentkit/skills/venice_audio/__init__.py +99 -106
  158. intentkit/skills/venice_audio/base.py +118 -121
  159. intentkit/skills/venice_audio/venice_audio.py +1 -5
  160. intentkit/skills/venice_image/__init__.py +147 -154
  161. intentkit/skills/venice_image/base.py +185 -192
  162. intentkit/skills/web_scraper/__init__.py +5 -18
  163. intentkit/skills/web_scraper/base.py +20 -4
  164. intentkit/skills/web_scraper/document_indexer.py +6 -4
  165. intentkit/skills/web_scraper/scrape_and_index.py +11 -8
  166. intentkit/skills/web_scraper/utils.py +31 -27
  167. intentkit/skills/web_scraper/website_indexer.py +7 -8
  168. intentkit/skills/weth/__init__.py +1 -5
  169. intentkit/skills/wow/__init__.py +1 -5
  170. intentkit/skills/xmtp/__init__.py +4 -15
  171. intentkit/utils/schema.py +100 -0
  172. {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/METADATA +1 -1
  173. {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/RECORD +175 -174
  174. {intentkit-0.8.12rc0.dist-info → intentkit-0.8.13.dev1.dist-info}/WHEEL +0 -0
  175. {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.abstracts.skill import SkillStoreABC
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
- skill_store: SkillStoreABC = Field(
20
- description="The skill store for persisting data"
21
- )
22
-
23
- @property
24
- def category(self) -> str:
25
- return "venice_audio"
26
-
27
- def validate_voice_model(
28
- self, context, voice_model: str
29
- ) -> Tuple[bool, Optional[Dict[str, object]]]:
30
- config = context.config
31
-
32
- selected_model = config.get("voice_model")
33
- custom_models = config.get("voice_model_custom", [])
34
-
35
- allowed_voice_models: List[str] = []
36
-
37
- if selected_model == "custom":
38
- allowed_voice_models = custom_models or []
39
- else:
40
- allowed_voice_models = [selected_model] if selected_model else []
41
-
42
- if voice_model not in allowed_voice_models:
43
- return False, {
44
- "error": f'"{voice_model}" is not allowed',
45
- "allowed": allowed_voice_models,
46
- "suggestion": "please try again with allowed voice model",
47
- }
48
-
49
- return True, None
50
-
51
- def get_api_key(self) -> str:
52
- """
53
- Retrieves the Venice AI API key based on the api_key_provider setting.
54
-
55
- Returns:
56
- The API key if found.
57
-
58
- Raises:
59
- ToolException: If the API key is not found or provider is invalid.
60
- """
61
- try:
62
- context = self.get_context()
63
- skill_config = context.agent.skill_config(self.category)
64
- api_key_provider = skill_config.get("api_key_provider")
65
- if api_key_provider == "agent_owner":
66
- agent_api_key = skill_config.get("api_key")
67
- if agent_api_key:
68
- logger.debug(
69
- f"Using agent-specific Venice API key for skill {self.name} in category {self.category}"
70
- )
71
- return agent_api_key
72
- raise ToolException(
73
- f"No agent-owned Venice API key found for skill '{self.name}' in category '{self.category}'."
74
- )
75
-
76
- elif api_key_provider == "platform":
77
- system_api_key = self.skill_store.get_system_config("venice_api_key")
78
- if system_api_key:
79
- logger.debug(
80
- f"Using system Venice API key for skill {self.name} in category {self.category}"
81
- )
82
- return system_api_key
83
- raise ToolException(
84
- f"No platform-hosted Venice API key found for skill '{self.name}' in category '{self.category}'."
85
- )
86
-
87
- else:
88
- raise ToolException(
89
- f"Invalid API key provider '{api_key_provider}' for skill '{self.name}'"
90
- )
91
-
92
- except Exception as e:
93
- raise ToolException(f"Failed to retrieve Venice API key: {str(e)}") from e
94
-
95
- async def apply_rate_limit(self, context) -> None:
96
- """
97
- Applies rate limiting ONLY if specified in the agent's config ('skill_config').
98
- Checks for 'rate_limit_number' and 'rate_limit_minutes'.
99
- If not configured, NO rate limiting is applied.
100
- Raises ConnectionAbortedError if the configured limit is exceeded.
101
- """
102
- skill_config = context.agent.skill_config(self.category)
103
- user_id = context.agent.id
104
-
105
- # Get agent-specific limits safely
106
- limit_num = skill_config.get("rate_limit_number")
107
- limit_min = skill_config.get("rate_limit_minutes")
108
-
109
- # Apply limit ONLY if both values are present and valid (truthy check handles None and 0)
110
- if limit_num and limit_min:
111
- limit_source = "Agent"
112
- logger.debug(
113
- f"Applying {limit_source} rate limit ({limit_num}/{limit_min} min) for user {user_id} on {self.name}"
114
- )
115
- if user_id:
116
- await self.user_rate_limit_by_category(user_id, limit_num, limit_min)
117
- else:
118
- # No valid agent configuration found, so do nothing.
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, Field
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.abstracts.skill import SkillStoreABC
5
- from intentkit.skills.base import (
6
- SkillConfig,
7
- SkillState,
8
- )
9
-
10
- # Import the base tool and all specific model skill classes
11
- from intentkit.skills.venice_image.base import VeniceImageBaseTool
12
- from intentkit.skills.venice_image.image_enhance.image_enhance import ImageEnhance
13
- from intentkit.skills.venice_image.image_generation.image_generation_fluently_xl import (
14
- ImageGenerationFluentlyXL,
15
- )
16
- from intentkit.skills.venice_image.image_generation.image_generation_flux_dev import (
17
- ImageGenerationFluxDev,
18
- )
19
- from intentkit.skills.venice_image.image_generation.image_generation_flux_dev_uncensored import (
20
- ImageGenerationFluxDevUncensored,
21
- )
22
- from intentkit.skills.venice_image.image_generation.image_generation_lustify_sdxl import (
23
- ImageGenerationLustifySDXL,
24
- )
25
- from intentkit.skills.venice_image.image_generation.image_generation_pony_realism import (
26
- ImageGenerationPonyRealism,
27
- )
28
- from intentkit.skills.venice_image.image_generation.image_generation_stable_diffusion_3_5 import (
29
- ImageGenerationStableDiffusion35,
30
- )
31
- from intentkit.skills.venice_image.image_generation.image_generation_venice_sd35 import (
32
- ImageGenerationVeniceSD35,
33
- )
34
- from intentkit.skills.venice_image.image_upscale.image_upscale import ImageUpscale
35
- from intentkit.skills.venice_image.image_vision.image_vision import ImageVision
36
-
37
- # Cache skills at the system level, because they are stateless and only depend on the store
38
- _cache: dict[str, VeniceImageBaseTool] = {}
39
-
40
- logger = logging.getLogger(__name__)
41
-
42
-
43
- # Define the expected structure for the 'states' dictionary in the config
44
- class SkillStates(TypedDict):
45
- image_upscale: SkillState
46
- image_enhance: SkillState
47
- image_vision: SkillState
48
- image_generation_flux_dev: SkillState
49
- image_generation_flux_dev_uncensored: SkillState
50
- image_generation_venice_sd35: SkillState
51
- image_generation_fluently_xl: SkillState
52
- image_generation_lustify_sdxl: SkillState
53
- image_generation_pony_realism: SkillState
54
- image_generation_stable_diffusion_3_5: SkillState
55
- # Add new skill names here if more models are added
56
-
57
-
58
- # Define the overall configuration structure for the venice_image category
59
- class Config(SkillConfig):
60
- """Configuration for Venice Image skills."""
61
-
62
- enabled: bool # Keep standard enabled flag
63
- states: SkillStates
64
- api_key_provider: str = "agent_owner"
65
- api_key: NotRequired[Optional[str]] # Explicitly Optional
66
- safe_mode: NotRequired[bool] # Defaults handled in base or usage
67
- hide_watermark: NotRequired[bool] # Defaults handled in base or usage
68
- negative_prompt: NotRequired[str] # Defaults handled in base or usage
69
- rate_limit_number: NotRequired[Optional[int]] # Explicitly Optional
70
- rate_limit_minutes: NotRequired[Optional[int]] # Explicitly Optional
71
-
72
-
73
- _SKILL_NAME_TO_CLASS_MAP: dict[str, type[VeniceImageBaseTool]] = {
74
- "image_upscale": ImageUpscale,
75
- "image_enhance": ImageEnhance,
76
- "image_vision": ImageVision,
77
- "image_generation_flux_dev": ImageGenerationFluxDev,
78
- "image_generation_flux_dev_uncensored": ImageGenerationFluxDevUncensored,
79
- "image_generation_venice_sd35": ImageGenerationVeniceSD35,
80
- "image_generation_fluently_xl": ImageGenerationFluentlyXL,
81
- "image_generation_lustify_sdxl": ImageGenerationLustifySDXL,
82
- "image_generation_pony_realism": ImageGenerationPonyRealism,
83
- "image_generation_stable_diffusion_3_5": ImageGenerationStableDiffusion35,
84
- }
85
-
86
-
87
- async def get_skills(
88
- config: "Config",
89
- is_private: bool,
90
- store: SkillStoreABC,
91
- **_, # Allow for extra arguments if the loader passes them
92
- ) -> list[VeniceImageBaseTool]:
93
- """Get all enabled Venice Image skills based on configuration and privacy level.
94
-
95
- Args:
96
- config: The configuration for Venice Image skills.
97
- is_private: Whether the context is private (e.g., agent owner).
98
- store: The skill store for persisting data and accessing system config.
99
-
100
- Returns:
101
- A list of instantiated and enabled Venice Image skill objects.
102
- """
103
- # Check if the entire category is disabled first
104
- if not config.get("enabled", False):
105
- return []
106
-
107
- available_skills: list[VeniceImageBaseTool] = []
108
-
109
- # Include skills based on their state
110
- for skill_name, state in config["states"].items():
111
- if state == "disabled":
112
- continue
113
- elif state == "public" or (state == "private" and is_private):
114
- available_skills.append(skill_name)
115
-
116
- # Get each skill using the cached getter
117
- result = []
118
- for name in available_skills:
119
- skill = get_venice_image_skill(name, store, config)
120
- if skill:
121
- result.append(skill)
122
- return result
123
-
124
-
125
- def get_venice_image_skill(
126
- name: str,
127
- store: SkillStoreABC,
128
- config: "Config",
129
- ) -> Optional[VeniceImageBaseTool]:
130
- """
131
- Factory function to get a cached Venice Image skill instance by name.
132
-
133
- Args:
134
- name: The name of the skill to get (must match keys in _SKILL_NAME_TO_CLASS_MAP).
135
- store: The skill store, passed to the skill constructor.
136
-
137
- Returns:
138
- The requested Venice Image skill instance, or None if the name is unknown.
139
- """
140
-
141
- # Return from cache immediately if already exists
142
- if name in _cache:
143
- return _cache[name]
144
-
145
- skill_class = _SKILL_NAME_TO_CLASS_MAP.get(name)
146
- if not skill_class:
147
- logger.warning(f"Unknown Venice skill: {name}")
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]