solana-agent 27.3.6__tar.gz → 27.3.8__tar.gz
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.
- {solana_agent-27.3.6 → solana_agent-27.3.8}/PKG-INFO +6 -5
- {solana_agent-27.3.6 → solana_agent-27.3.8}/README.md +4 -3
- {solana_agent-27.3.6 → solana_agent-27.3.8}/pyproject.toml +3 -2
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/__init__.py +1 -3
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/adapters/mongodb_adapter.py +5 -2
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/adapters/openai_adapter.py +32 -27
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/adapters/pinecone_adapter.py +91 -63
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/client/solana_agent.py +38 -23
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/domains/agent.py +7 -13
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/domains/routing.py +5 -5
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/factories/agent_factory.py +49 -34
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/client/client.py +22 -13
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/plugins/plugins.py +2 -1
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/providers/data_storage.py +9 -2
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/providers/llm.py +26 -12
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/providers/memory.py +1 -1
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/providers/vector_storage.py +3 -9
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/services/agent.py +21 -6
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/services/knowledge_base.py +6 -8
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/services/query.py +16 -5
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/services/routing.py +0 -1
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/plugins/manager.py +14 -9
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/plugins/registry.py +13 -11
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/plugins/tools/__init__.py +0 -5
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/plugins/tools/auto_tool.py +1 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/repositories/memory.py +20 -22
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/services/__init__.py +1 -1
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/services/agent.py +119 -89
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/services/knowledge_base.py +182 -131
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/services/query.py +48 -24
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/services/routing.py +30 -18
- {solana_agent-27.3.6 → solana_agent-27.3.8}/LICENSE +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/adapters/__init__.py +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/client/__init__.py +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/domains/__init__.py +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/factories/__init__.py +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/interfaces/__init__.py +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/plugins/__init__.py +0 -0
- {solana_agent-27.3.6 → solana_agent-27.3.8}/solana_agent/repositories/__init__.py +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: solana-agent
|
3
|
-
Version: 27.3.
|
4
|
-
Summary:
|
3
|
+
Version: 27.3.8
|
4
|
+
Summary: AI Agents for Solana
|
5
5
|
License: MIT
|
6
6
|
Keywords: ai,openai,ai agents,agi
|
7
7
|
Author: Bevan Hunt
|
@@ -36,13 +36,14 @@ Description-Content-Type: text/markdown
|
|
36
36
|
[](https://codecov.io/gh/truemagic-coder/solana-agent)
|
37
37
|
[](https://github.com/truemagic-coder/solana-agent/actions/workflows/ci.yml)
|
38
38
|
[](https://github.com/truemagic-coder/solana-agent)
|
39
|
+
[](https://github.com/astral-sh/ruff)
|
39
40
|
[](https://libraries.io/pypi/solana-agent)
|
40
41
|
|
41
42
|

|
42
43
|
|
43
|
-
##
|
44
|
+
## AI Agents for Solana
|
44
45
|
|
45
|
-
Build your AI
|
46
|
+
Build your AI agents in three lines of code!
|
46
47
|
|
47
48
|
## Why?
|
48
49
|
* Three lines of code setup
|
@@ -56,7 +57,7 @@ Build your AI business in three lines of code!
|
|
56
57
|
* Business Alignment
|
57
58
|
* Extensible Tooling
|
58
59
|
* Simple Business Definition
|
59
|
-
* Knowledge Base
|
60
|
+
* Knowledge Base
|
60
61
|
* MCP Support
|
61
62
|
* Tested & Secure
|
62
63
|
* Built in Python
|
@@ -7,13 +7,14 @@
|
|
7
7
|
[](https://codecov.io/gh/truemagic-coder/solana-agent)
|
8
8
|
[](https://github.com/truemagic-coder/solana-agent/actions/workflows/ci.yml)
|
9
9
|
[](https://github.com/truemagic-coder/solana-agent)
|
10
|
+
[](https://github.com/astral-sh/ruff)
|
10
11
|
[](https://libraries.io/pypi/solana-agent)
|
11
12
|
|
12
13
|

|
13
14
|
|
14
|
-
##
|
15
|
+
## AI Agents for Solana
|
15
16
|
|
16
|
-
Build your AI
|
17
|
+
Build your AI agents in three lines of code!
|
17
18
|
|
18
19
|
## Why?
|
19
20
|
* Three lines of code setup
|
@@ -27,7 +28,7 @@ Build your AI business in three lines of code!
|
|
27
28
|
* Business Alignment
|
28
29
|
* Extensible Tooling
|
29
30
|
* Simple Business Definition
|
30
|
-
* Knowledge Base
|
31
|
+
* Knowledge Base
|
31
32
|
* MCP Support
|
32
33
|
* Tested & Secure
|
33
34
|
* Built in Python
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "solana-agent"
|
3
|
-
version = "27.3.
|
4
|
-
description = "
|
3
|
+
version = "27.3.8"
|
4
|
+
description = "AI Agents for Solana"
|
5
5
|
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
|
6
6
|
license = "MIT"
|
7
7
|
readme = "README.md"
|
@@ -44,6 +44,7 @@ sphinx-rtd-theme = "^3.0.2"
|
|
44
44
|
myst-parser = "^4.0.1"
|
45
45
|
sphinx-autobuild = "^2024.10.3"
|
46
46
|
mongomock = "^4.3.0"
|
47
|
+
ruff = "^0.11.6"
|
47
48
|
|
48
49
|
[build-system]
|
49
50
|
requires = ["poetry-core>=1.0.0"]
|
@@ -16,16 +16,14 @@ from solana_agent.factories.agent_factory import SolanaAgentFactory
|
|
16
16
|
# Useful tools and utilities
|
17
17
|
from solana_agent.plugins.manager import PluginManager
|
18
18
|
from solana_agent.plugins.registry import ToolRegistry
|
19
|
-
from solana_agent.plugins.tools import AutoTool
|
19
|
+
from solana_agent.plugins.tools.auto_tool import AutoTool
|
20
20
|
|
21
21
|
# Package metadata
|
22
22
|
__all__ = [
|
23
23
|
# Main client interfaces
|
24
24
|
"SolanaAgent",
|
25
|
-
|
26
25
|
# Factories
|
27
26
|
"SolanaAgentFactory",
|
28
|
-
|
29
27
|
# Tools
|
30
28
|
"PluginManager",
|
31
29
|
"ToolRegistry",
|
@@ -3,6 +3,7 @@ MongoDB adapter for the Solana Agent system.
|
|
3
3
|
|
4
4
|
This adapter implements the DataStorageProvider interface for MongoDB.
|
5
5
|
"""
|
6
|
+
|
6
7
|
import uuid
|
7
8
|
from typing import Dict, List, Tuple, Optional
|
8
9
|
|
@@ -40,7 +41,7 @@ class MongoDBAdapter(DataStorageProvider):
|
|
40
41
|
query: Dict,
|
41
42
|
sort: Optional[List[Tuple]] = None,
|
42
43
|
limit: int = 0,
|
43
|
-
skip: int = 0
|
44
|
+
skip: int = 0,
|
44
45
|
) -> List[Dict]:
|
45
46
|
cursor = self.db[collection].find(query)
|
46
47
|
if sort:
|
@@ -51,7 +52,9 @@ class MongoDBAdapter(DataStorageProvider):
|
|
51
52
|
cursor = cursor.skip(skip)
|
52
53
|
return list(cursor)
|
53
54
|
|
54
|
-
def update_one(
|
55
|
+
def update_one(
|
56
|
+
self, collection: str, query: Dict, update: Dict, upsert: bool = False
|
57
|
+
) -> bool:
|
55
58
|
result = self.db[collection].update_one(query, update, upsert=upsert)
|
56
59
|
return result.modified_count > 0 or (upsert and result.upserted_id is not None)
|
57
60
|
|
@@ -3,6 +3,7 @@ LLM provider adapters for the Solana Agent system.
|
|
3
3
|
|
4
4
|
These adapters implement the LLMProvider interface for different LLM services.
|
5
5
|
"""
|
6
|
+
|
6
7
|
from typing import AsyncGenerator, List, Literal, Optional, Type, TypeVar
|
7
8
|
|
8
9
|
from openai import AsyncOpenAI
|
@@ -12,7 +13,7 @@ from instructor import Mode
|
|
12
13
|
|
13
14
|
from solana_agent.interfaces.providers.llm import LLMProvider
|
14
15
|
|
15
|
-
T = TypeVar(
|
16
|
+
T = TypeVar("T", bound=BaseModel)
|
16
17
|
|
17
18
|
DEFAULT_CHAT_MODEL = "gpt-4.1-mini"
|
18
19
|
DEFAULT_PARSE_MODEL = "gpt-4.1-nano"
|
@@ -38,10 +39,19 @@ class OpenAIAdapter(LLMProvider):
|
|
38
39
|
self,
|
39
40
|
text: str,
|
40
41
|
instructions: str = "You speak in a friendly and helpful manner.",
|
41
|
-
voice: Literal[
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
voice: Literal[
|
43
|
+
"alloy",
|
44
|
+
"ash",
|
45
|
+
"ballad",
|
46
|
+
"coral",
|
47
|
+
"echo",
|
48
|
+
"fable",
|
49
|
+
"onyx",
|
50
|
+
"nova",
|
51
|
+
"sage",
|
52
|
+
"shimmer",
|
53
|
+
] = "nova",
|
54
|
+
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] = "aac",
|
45
55
|
) -> AsyncGenerator[bytes, None]: # pragma: no cover
|
46
56
|
"""Stream text-to-speech audio from OpenAI models.
|
47
57
|
|
@@ -59,7 +69,7 @@ class OpenAIAdapter(LLMProvider):
|
|
59
69
|
model=self.tts_model,
|
60
70
|
voice=voice,
|
61
71
|
input=text,
|
62
|
-
response_format=response_format
|
72
|
+
response_format=response_format,
|
63
73
|
) as stream:
|
64
74
|
# Stream the bytes in 16KB chunks
|
65
75
|
async for chunk in stream.iter_bytes(chunk_size=1024 * 16):
|
@@ -68,12 +78,14 @@ class OpenAIAdapter(LLMProvider):
|
|
68
78
|
except Exception as e:
|
69
79
|
print(f"Error in text_to_speech: {str(e)}")
|
70
80
|
import traceback
|
81
|
+
|
71
82
|
print(traceback.format_exc())
|
72
83
|
yield b"" # Return empty bytes on error
|
73
84
|
|
74
85
|
except Exception as e:
|
75
86
|
print(f"Error in text_to_speech: {str(e)}")
|
76
87
|
import traceback
|
88
|
+
|
77
89
|
print(traceback.format_exc())
|
78
90
|
yield b"" # Return empty bytes on error
|
79
91
|
|
@@ -106,6 +118,7 @@ class OpenAIAdapter(LLMProvider):
|
|
106
118
|
except Exception as e:
|
107
119
|
print(f"Error in transcribe_audio: {str(e)}")
|
108
120
|
import traceback
|
121
|
+
|
109
122
|
print(traceback.format_exc())
|
110
123
|
yield f"I apologize, but I encountered an error transcribing the audio: {str(e)}"
|
111
124
|
|
@@ -152,6 +165,7 @@ class OpenAIAdapter(LLMProvider):
|
|
152
165
|
except Exception as e:
|
153
166
|
print(f"Error in generate_text: {str(e)}")
|
154
167
|
import traceback
|
168
|
+
|
155
169
|
print(traceback.format_exc())
|
156
170
|
yield f"I apologize, but I encountered an error: {str(e)}"
|
157
171
|
|
@@ -179,20 +193,18 @@ class OpenAIAdapter(LLMProvider):
|
|
179
193
|
if model:
|
180
194
|
self.parse_model = model
|
181
195
|
|
182
|
-
patched_client = instructor.from_openai(
|
183
|
-
client, mode=Mode.TOOLS_STRICT)
|
196
|
+
patched_client = instructor.from_openai(client, mode=Mode.TOOLS_STRICT)
|
184
197
|
|
185
198
|
# Use instructor's structured generation with function calling
|
186
199
|
response = await patched_client.chat.completions.create(
|
187
200
|
model=self.parse_model,
|
188
201
|
messages=messages,
|
189
202
|
response_model=model_class,
|
190
|
-
max_retries=2 # Automatically retry on validation errors
|
203
|
+
max_retries=2, # Automatically retry on validation errors
|
191
204
|
)
|
192
205
|
return response
|
193
206
|
except Exception as e:
|
194
|
-
print(
|
195
|
-
f"Error with instructor parsing (TOOLS_STRICT mode): {e}")
|
207
|
+
print(f"Error with instructor parsing (TOOLS_STRICT mode): {e}")
|
196
208
|
|
197
209
|
try:
|
198
210
|
if api_key and base_url:
|
@@ -204,13 +216,12 @@ class OpenAIAdapter(LLMProvider):
|
|
204
216
|
self.parse_model = model
|
205
217
|
|
206
218
|
# First fallback: Try regular JSON mode
|
207
|
-
patched_client = instructor.from_openai(
|
208
|
-
client, mode=Mode.JSON)
|
219
|
+
patched_client = instructor.from_openai(client, mode=Mode.JSON)
|
209
220
|
response = await patched_client.chat.completions.create(
|
210
221
|
model=self.parse_model,
|
211
222
|
messages=messages,
|
212
223
|
response_model=model_class,
|
213
|
-
max_retries=1
|
224
|
+
max_retries=1,
|
214
225
|
)
|
215
226
|
return response
|
216
227
|
except Exception as json_error:
|
@@ -218,8 +229,7 @@ class OpenAIAdapter(LLMProvider):
|
|
218
229
|
|
219
230
|
try:
|
220
231
|
if api_key and base_url:
|
221
|
-
client = AsyncOpenAI(
|
222
|
-
api_key=api_key, base_url=base_url)
|
232
|
+
client = AsyncOpenAI(api_key=api_key, base_url=base_url)
|
223
233
|
else:
|
224
234
|
client = self.client
|
225
235
|
|
@@ -241,9 +251,9 @@ class OpenAIAdapter(LLMProvider):
|
|
241
251
|
model=self.parse_model,
|
242
252
|
messages=[
|
243
253
|
{"role": "system", "content": fallback_system_prompt},
|
244
|
-
{"role": "user", "content": prompt}
|
254
|
+
{"role": "user", "content": prompt},
|
245
255
|
],
|
246
|
-
response_format={"type": "json_object"}
|
256
|
+
response_format={"type": "json_object"},
|
247
257
|
)
|
248
258
|
|
249
259
|
# Extract and parse the JSON response
|
@@ -259,10 +269,7 @@ class OpenAIAdapter(LLMProvider):
|
|
259
269
|
) from e
|
260
270
|
|
261
271
|
async def embed_text(
|
262
|
-
self,
|
263
|
-
text: str,
|
264
|
-
model: Optional[str] = None,
|
265
|
-
dimensions: Optional[int] = None
|
272
|
+
self, text: str, model: Optional[str] = None, dimensions: Optional[int] = None
|
266
273
|
) -> List[float]: # pragma: no cover
|
267
274
|
"""Generate an embedding for the given text using OpenAI.
|
268
275
|
|
@@ -286,19 +293,17 @@ class OpenAIAdapter(LLMProvider):
|
|
286
293
|
text = text.replace("\n", " ")
|
287
294
|
|
288
295
|
response = await self.client.embeddings.create(
|
289
|
-
input=[text],
|
290
|
-
model=embedding_model,
|
291
|
-
dimensions=embedding_dimensions
|
296
|
+
input=[text], model=embedding_model, dimensions=embedding_dimensions
|
292
297
|
)
|
293
298
|
|
294
299
|
if response.data and response.data[0].embedding:
|
295
300
|
return response.data[0].embedding
|
296
301
|
else:
|
297
|
-
raise ValueError(
|
298
|
-
"Failed to retrieve embedding from OpenAI response")
|
302
|
+
raise ValueError("Failed to retrieve embedding from OpenAI response")
|
299
303
|
|
300
304
|
except Exception as e:
|
301
305
|
print(f"Error generating embedding: {e}")
|
302
306
|
import traceback
|
307
|
+
|
303
308
|
print(traceback.format_exc())
|
304
309
|
raise
|