solana-agent 0.0.21__tar.gz → 0.0.100__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-0.0.21 → solana_agent-0.0.100}/PKG-INFO +4 -39
- {solana_agent-0.0.21 → solana_agent-0.0.100}/README.md +3 -36
- {solana_agent-0.0.21 → solana_agent-0.0.100}/pyproject.toml +1 -3
- {solana_agent-0.0.21 → solana_agent-0.0.100}/solana_agent/ai.py +5 -175
- {solana_agent-0.0.21 → solana_agent-0.0.100}/LICENSE +0 -0
- {solana_agent-0.0.21 → solana_agent-0.0.100}/solana_agent/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: solana-agent
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.100
|
|
4
4
|
Summary: Build self-learning AI Agents
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: ai,openai,ai agents
|
|
@@ -18,8 +18,6 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
18
18
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
19
|
Requires-Dist: motor (>=3.7.0,<4.0.0)
|
|
20
20
|
Requires-Dist: openai (>=1.61.1,<2.0.0)
|
|
21
|
-
Requires-Dist: pandas (>=2.2.3,<3.0.0)
|
|
22
|
-
Requires-Dist: pinecone (>=6.0.1,<7.0.0)
|
|
23
21
|
Requires-Dist: pydantic (>=2.10.6,<3.0.0)
|
|
24
22
|
Requires-Dist: requests (>=2.32.3,<3.0.0)
|
|
25
23
|
Requires-Dist: zep-cloud (>=2.4.0,<3.0.0)
|
|
@@ -49,33 +47,6 @@ Unlike traditional AI assistants that forget conversations after each session, S
|
|
|
49
47
|
|
|
50
48
|
**"It's not just an AI assistant - it's your organization's evolving intelligence layer."**
|
|
51
49
|
|
|
52
|
-
## Benefits
|
|
53
|
-
|
|
54
|
-
💬 **Enhanced Communication**
|
|
55
|
-
- Engage in natural conversations without typing delays
|
|
56
|
-
- Communicate hands-free with voice interactions
|
|
57
|
-
- Reduce response time with real-time processing
|
|
58
|
-
|
|
59
|
-
🎯 **Improved Decision Making**
|
|
60
|
-
- Access comprehensive data from multiple trusted sources
|
|
61
|
-
- Get instant answers backed by Internet and social-media research
|
|
62
|
-
- Make informed decisions with cross-referenced information
|
|
63
|
-
|
|
64
|
-
💪 **Operational Efficiency**
|
|
65
|
-
- Automate repetitive data processing tasks
|
|
66
|
-
- Convert data formats seamlessly
|
|
67
|
-
- Scale knowledge management effortlessly
|
|
68
|
-
|
|
69
|
-
🔐 **Enterprise Ready**
|
|
70
|
-
- Secure data handling with advanced memory systems
|
|
71
|
-
- Customize functionality through extensible architecture
|
|
72
|
-
- Integrate with existing business tools and APIs
|
|
73
|
-
|
|
74
|
-
🚀 **Competitive Advantage**
|
|
75
|
-
- Stay current with real-time social media and Internet insights
|
|
76
|
-
- Process and analyze large datasets quickly
|
|
77
|
-
- Transform raw data into actionable intelligence
|
|
78
|
-
|
|
79
50
|
## Features
|
|
80
51
|
|
|
81
52
|
🔄 **Real-time AI Interactions**
|
|
@@ -83,22 +54,16 @@ Unlike traditional AI assistants that forget conversations after each session, S
|
|
|
83
54
|
- Real-time voice-to-voice conversations
|
|
84
55
|
|
|
85
56
|
🧠 **Memory System and Extensibility**
|
|
86
|
-
- Advanced AI memory combining conversational context, conversational facts, and
|
|
87
|
-
-
|
|
57
|
+
- Advanced AI memory combining conversational context, conversational facts, and parallel tool calling
|
|
58
|
+
- Create custom tools for extending the Agent's capabilities like further API integrations
|
|
88
59
|
|
|
89
60
|
🔍 **Multi-Source Search and Reasoning**
|
|
90
61
|
- Internet search via Perplexity
|
|
91
|
-
- Conversational fact search powered by Zep
|
|
92
62
|
- X (Twitter) search using Grok
|
|
63
|
+
- Conversational fact search powered by Zep
|
|
93
64
|
- Conversational message history using MongoDB (on-prem or hosted)
|
|
94
|
-
- Knowledge Base search via Pinecone
|
|
95
65
|
- Comprehensive reasoning combining multiple data sources
|
|
96
66
|
|
|
97
|
-
🛠️ **Data Processing Tools**
|
|
98
|
-
- CSV to JSON conversion for data integration
|
|
99
|
-
- Text summarization powered by Gemini
|
|
100
|
-
- Enterprise-ready knowledge base powered by Pinecone
|
|
101
|
-
|
|
102
67
|
## Why Choose Solana Agent Over LangChain?
|
|
103
68
|
|
|
104
69
|
### 🎯 Key Differentiators
|
|
@@ -21,33 +21,6 @@ Unlike traditional AI assistants that forget conversations after each session, S
|
|
|
21
21
|
|
|
22
22
|
**"It's not just an AI assistant - it's your organization's evolving intelligence layer."**
|
|
23
23
|
|
|
24
|
-
## Benefits
|
|
25
|
-
|
|
26
|
-
💬 **Enhanced Communication**
|
|
27
|
-
- Engage in natural conversations without typing delays
|
|
28
|
-
- Communicate hands-free with voice interactions
|
|
29
|
-
- Reduce response time with real-time processing
|
|
30
|
-
|
|
31
|
-
🎯 **Improved Decision Making**
|
|
32
|
-
- Access comprehensive data from multiple trusted sources
|
|
33
|
-
- Get instant answers backed by Internet and social-media research
|
|
34
|
-
- Make informed decisions with cross-referenced information
|
|
35
|
-
|
|
36
|
-
💪 **Operational Efficiency**
|
|
37
|
-
- Automate repetitive data processing tasks
|
|
38
|
-
- Convert data formats seamlessly
|
|
39
|
-
- Scale knowledge management effortlessly
|
|
40
|
-
|
|
41
|
-
🔐 **Enterprise Ready**
|
|
42
|
-
- Secure data handling with advanced memory systems
|
|
43
|
-
- Customize functionality through extensible architecture
|
|
44
|
-
- Integrate with existing business tools and APIs
|
|
45
|
-
|
|
46
|
-
🚀 **Competitive Advantage**
|
|
47
|
-
- Stay current with real-time social media and Internet insights
|
|
48
|
-
- Process and analyze large datasets quickly
|
|
49
|
-
- Transform raw data into actionable intelligence
|
|
50
|
-
|
|
51
24
|
## Features
|
|
52
25
|
|
|
53
26
|
🔄 **Real-time AI Interactions**
|
|
@@ -55,22 +28,16 @@ Unlike traditional AI assistants that forget conversations after each session, S
|
|
|
55
28
|
- Real-time voice-to-voice conversations
|
|
56
29
|
|
|
57
30
|
🧠 **Memory System and Extensibility**
|
|
58
|
-
- Advanced AI memory combining conversational context, conversational facts, and
|
|
59
|
-
-
|
|
31
|
+
- Advanced AI memory combining conversational context, conversational facts, and parallel tool calling
|
|
32
|
+
- Create custom tools for extending the Agent's capabilities like further API integrations
|
|
60
33
|
|
|
61
34
|
🔍 **Multi-Source Search and Reasoning**
|
|
62
35
|
- Internet search via Perplexity
|
|
63
|
-
- Conversational fact search powered by Zep
|
|
64
36
|
- X (Twitter) search using Grok
|
|
37
|
+
- Conversational fact search powered by Zep
|
|
65
38
|
- Conversational message history using MongoDB (on-prem or hosted)
|
|
66
|
-
- Knowledge Base search via Pinecone
|
|
67
39
|
- Comprehensive reasoning combining multiple data sources
|
|
68
40
|
|
|
69
|
-
🛠️ **Data Processing Tools**
|
|
70
|
-
- CSV to JSON conversion for data integration
|
|
71
|
-
- Text summarization powered by Gemini
|
|
72
|
-
- Enterprise-ready knowledge base powered by Pinecone
|
|
73
|
-
|
|
74
41
|
## Why Choose Solana Agent Over LangChain?
|
|
75
42
|
|
|
76
43
|
### 🎯 Key Differentiators
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "solana-agent"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.100"
|
|
4
4
|
description = "Build self-learning AI Agents"
|
|
5
5
|
authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -23,8 +23,6 @@ pydantic = "^2.10.6"
|
|
|
23
23
|
motor = "^3.7.0"
|
|
24
24
|
zep-cloud = "^2.4.0"
|
|
25
25
|
requests = "^2.32.3"
|
|
26
|
-
pandas = "^2.2.3"
|
|
27
|
-
pinecone = "^6.0.1"
|
|
28
26
|
|
|
29
27
|
[build-system]
|
|
30
28
|
requires = ["poetry-core>=1.0.0"]
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
|
|
2
|
+
import datetime
|
|
3
3
|
import json
|
|
4
|
-
from typing import AsyncGenerator,
|
|
5
|
-
import uuid
|
|
4
|
+
from typing import AsyncGenerator, Literal, Optional, Dict, Any, Callable
|
|
6
5
|
from pydantic import BaseModel
|
|
7
6
|
from motor.motor_asyncio import AsyncIOMotorClient
|
|
8
7
|
from openai import OpenAI
|
|
@@ -14,8 +13,6 @@ import requests
|
|
|
14
13
|
from zep_cloud.client import AsyncZep
|
|
15
14
|
from zep_cloud.client import Zep
|
|
16
15
|
from zep_cloud.types import Message
|
|
17
|
-
import pandas as pd
|
|
18
|
-
from pinecone import Pinecone
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
class EventHandler(AssistantEventHandler):
|
|
@@ -78,9 +75,6 @@ class AI:
|
|
|
78
75
|
zep_api_key: str = None,
|
|
79
76
|
perplexity_api_key: str = None,
|
|
80
77
|
grok_api_key: str = None,
|
|
81
|
-
gemini_api_key: str = None,
|
|
82
|
-
pinecone_api_key: str = None,
|
|
83
|
-
pinecone_index_name: str = None,
|
|
84
78
|
code_interpreter: bool = True,
|
|
85
79
|
openai_assistant_model: Literal["gpt-4o-mini",
|
|
86
80
|
"gpt-4o"] = "gpt-4o-mini",
|
|
@@ -98,9 +92,6 @@ class AI:
|
|
|
98
92
|
zep_api_key (str, optional): API key for Zep memory integration. Defaults to None
|
|
99
93
|
perplexity_api_key (str, optional): API key for Perplexity search. Defaults to None
|
|
100
94
|
grok_api_key (str, optional): API key for X/Twitter search via Grok. Defaults to None
|
|
101
|
-
gemini_api_key (str, optional): API key for Google Gemini. Defaults to None
|
|
102
|
-
pinecone_api_key (str, optional): API key for Pinecone. Defaults to None
|
|
103
|
-
pinecone_index_name (str, optional): Pinecone index name. Defaults to None
|
|
104
95
|
code_interpreter (bool, optional): Enable code interpretation. Defaults to True
|
|
105
96
|
openai_assistant_model (Literal["gpt-4o-mini", "gpt-4o"], optional): OpenAI model for assistant. Defaults to "gpt-4o-mini"
|
|
106
97
|
openai_embedding_model (Literal["text-embedding-3-small", "text-embedding-3-large"], optional): OpenAI model for text embedding. Defaults to "text-embedding-3-small"
|
|
@@ -117,7 +108,7 @@ class AI:
|
|
|
117
108
|
Notes:
|
|
118
109
|
- Requires valid OpenAI API key for core functionality
|
|
119
110
|
- Database instance for storing messages and threads
|
|
120
|
-
- Optional integrations for Zep, Perplexity
|
|
111
|
+
- Optional integrations for Zep, Perplexity and Grok
|
|
121
112
|
- Supports code interpretation and custom tool functions
|
|
122
113
|
- You must create the Pinecone index in the dashboard before using it
|
|
123
114
|
"""
|
|
@@ -136,15 +127,6 @@ class AI:
|
|
|
136
127
|
self._sync_zep = Zep(api_key=zep_api_key) if zep_api_key else None
|
|
137
128
|
self._perplexity_api_key = perplexity_api_key
|
|
138
129
|
self._grok_api_key = grok_api_key
|
|
139
|
-
self._gemini_api_key = gemini_api_key
|
|
140
|
-
self._pinecone = (
|
|
141
|
-
Pinecone(api_key=pinecone_api_key) if pinecone_api_key else None
|
|
142
|
-
)
|
|
143
|
-
self._pinecone_index_name = pinecone_index_name if pinecone_index_name else None
|
|
144
|
-
self._pinecone_index = (
|
|
145
|
-
self._pinecone.Index(
|
|
146
|
-
self._pinecone_index_name) if self._pinecone else None
|
|
147
|
-
)
|
|
148
130
|
|
|
149
131
|
async def __aenter__(self):
|
|
150
132
|
assistants = self._client.beta.assistants.list()
|
|
@@ -210,158 +192,6 @@ class AI:
|
|
|
210
192
|
)
|
|
211
193
|
return run.status
|
|
212
194
|
|
|
213
|
-
# converter tool - has to be sync
|
|
214
|
-
def csv_to_json(self, file_path: str) -> str:
|
|
215
|
-
"""Convert CSV file to JSON string format.
|
|
216
|
-
|
|
217
|
-
Args:
|
|
218
|
-
file_path (str): Path to the CSV file to convert
|
|
219
|
-
|
|
220
|
-
Returns:
|
|
221
|
-
str: JSON string containing the CSV data
|
|
222
|
-
|
|
223
|
-
Example:
|
|
224
|
-
```python
|
|
225
|
-
result = ai.csv_to_json("data.csv")
|
|
226
|
-
# Returns: '[{"column1": "value1", "column2": "value2"}]'
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Note:
|
|
230
|
-
This is a synchronous tool method required for OpenAI function calling.
|
|
231
|
-
"""
|
|
232
|
-
df = pd.read_csv(file_path)
|
|
233
|
-
records = df.to_dict(orient="records")
|
|
234
|
-
return json.dumps(records)
|
|
235
|
-
|
|
236
|
-
# search kb tool - has to be sync
|
|
237
|
-
def search_kb(self, query: str, limit: int = 10) -> str:
|
|
238
|
-
"""Search Pinecone knowledge base using OpenAI embeddings.
|
|
239
|
-
|
|
240
|
-
Args:
|
|
241
|
-
query (str): Search query to find relevant documents
|
|
242
|
-
limit (int, optional): Maximum number of results to return. Defaults to 10.
|
|
243
|
-
|
|
244
|
-
Returns:
|
|
245
|
-
str: JSON string of matched documents or error message
|
|
246
|
-
|
|
247
|
-
Example:
|
|
248
|
-
```python
|
|
249
|
-
results = ai.search_kb("machine learning basics", limit=5)
|
|
250
|
-
# Returns: '[{"title": "ML Intro", "content": "..."}]'
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
Note:
|
|
254
|
-
- Requires configured Pinecone index
|
|
255
|
-
- Uses OpenAI embeddings for semantic search
|
|
256
|
-
- Returns JSON-serialized Pinecone match metadata results
|
|
257
|
-
- Returns error message string if search fails
|
|
258
|
-
"""
|
|
259
|
-
try:
|
|
260
|
-
response = self._client.embeddings.create(
|
|
261
|
-
input=query,
|
|
262
|
-
model=self._openai_embedding_model,
|
|
263
|
-
)
|
|
264
|
-
search_results = self._pinecone_index.query(
|
|
265
|
-
vector=response.data[0].embedding,
|
|
266
|
-
top_k=limit,
|
|
267
|
-
include_metadata=True,
|
|
268
|
-
include_values=False,
|
|
269
|
-
)
|
|
270
|
-
matches = search_results.matches
|
|
271
|
-
metadata = [match.metadata for match in matches]
|
|
272
|
-
return json.dumps(metadata)
|
|
273
|
-
except Exception as e:
|
|
274
|
-
return f"Failed to search KB. Error: {e}"
|
|
275
|
-
|
|
276
|
-
# add document to kb tool - has to be sync
|
|
277
|
-
def add_document_to_kb(self, document: Dict[str, str]):
|
|
278
|
-
"""Add a document to the Pinecone knowledge base with OpenAI embeddings.
|
|
279
|
-
|
|
280
|
-
Args:
|
|
281
|
-
document (Dict[str, str]): Document to add, with string fields as values
|
|
282
|
-
|
|
283
|
-
Example:
|
|
284
|
-
```python
|
|
285
|
-
ai.add_document_to_kb({
|
|
286
|
-
"title": "AI Basics",
|
|
287
|
-
"content": "Introduction to artificial intelligence...",
|
|
288
|
-
"author": "John Doe"
|
|
289
|
-
})
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
Note:
|
|
293
|
-
- Requires Pinecone index to be configured
|
|
294
|
-
- Uses OpenAI embeddings API
|
|
295
|
-
- Document values must be strings
|
|
296
|
-
- Automatically generates UUID for document
|
|
297
|
-
"""
|
|
298
|
-
values: List[str] = []
|
|
299
|
-
for _, v in document.items():
|
|
300
|
-
values.append(v)
|
|
301
|
-
response = self._client.embeddings.create(
|
|
302
|
-
input=values,
|
|
303
|
-
model=self._openai_embedding_model,
|
|
304
|
-
)
|
|
305
|
-
self._pinecone_index.upsert(
|
|
306
|
-
vectors=[
|
|
307
|
-
{
|
|
308
|
-
"id": uuid.uuid4().hex,
|
|
309
|
-
"values": response.data[0].embedding,
|
|
310
|
-
"metadata": document,
|
|
311
|
-
}
|
|
312
|
-
]
|
|
313
|
-
)
|
|
314
|
-
|
|
315
|
-
# summarize tool - has to be sync
|
|
316
|
-
def summarize(
|
|
317
|
-
self,
|
|
318
|
-
text: str,
|
|
319
|
-
model: Literal["gemini-2.0-flash",
|
|
320
|
-
"gemini-1.5-pro"] = "gemini-1.5-pro",
|
|
321
|
-
) -> str:
|
|
322
|
-
"""Summarize text using Google's Gemini language model.
|
|
323
|
-
|
|
324
|
-
Args:
|
|
325
|
-
text (str): The text content to be summarized
|
|
326
|
-
model (Literal["gemini-2.0-flash", "gemini-1.5-pro"], optional):
|
|
327
|
-
Gemini model to use. Defaults to "gemini-1.5-pro"
|
|
328
|
-
- gemini-2.0-flash: Faster, shorter summaries
|
|
329
|
-
- gemini-1.5-pro: More detailed summaries
|
|
330
|
-
|
|
331
|
-
Returns:
|
|
332
|
-
str: Summarized text or error message if summarization fails
|
|
333
|
-
|
|
334
|
-
Example:
|
|
335
|
-
```python
|
|
336
|
-
summary = ai.summarize("Long article text here...", model="gemini-1.5-pro")
|
|
337
|
-
# Returns: "Concise summary of the article..."
|
|
338
|
-
```
|
|
339
|
-
|
|
340
|
-
Note:
|
|
341
|
-
This is a synchronous tool method required for OpenAI function calling.
|
|
342
|
-
Requires valid Gemini API key to be configured.
|
|
343
|
-
"""
|
|
344
|
-
try:
|
|
345
|
-
client = OpenAI(
|
|
346
|
-
api_key=self._gemini_api_key,
|
|
347
|
-
base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
348
|
-
)
|
|
349
|
-
|
|
350
|
-
completion = client.chat.completions.create(
|
|
351
|
-
model=model,
|
|
352
|
-
messages=[
|
|
353
|
-
{
|
|
354
|
-
"role": "system",
|
|
355
|
-
"content": "You summarize the text.",
|
|
356
|
-
},
|
|
357
|
-
{"role": "user", "content": text},
|
|
358
|
-
],
|
|
359
|
-
)
|
|
360
|
-
|
|
361
|
-
return completion.choices[0].message.content
|
|
362
|
-
except Exception as e:
|
|
363
|
-
return f"Failed to summarize text. Error: {e}"
|
|
364
|
-
|
|
365
195
|
# search facts tool - has to be sync
|
|
366
196
|
def search_facts(
|
|
367
197
|
self,
|
|
@@ -704,7 +534,7 @@ class AI:
|
|
|
704
534
|
"user_id": user_id,
|
|
705
535
|
"message": user_text,
|
|
706
536
|
"response": full_response,
|
|
707
|
-
"timestamp": datetime.now(),
|
|
537
|
+
"timestamp": datetime.datetime.now(datetime.timezone.utc),
|
|
708
538
|
}
|
|
709
539
|
|
|
710
540
|
await self._database.save_message(user_id, metadata)
|
|
@@ -815,7 +645,7 @@ class AI:
|
|
|
815
645
|
"user_id": user_id,
|
|
816
646
|
"message": transcript,
|
|
817
647
|
"response": full_response,
|
|
818
|
-
"timestamp": datetime.now(),
|
|
648
|
+
"timestamp": datetime.datetime.now(datetime.timezone.utc),
|
|
819
649
|
}
|
|
820
650
|
|
|
821
651
|
await self._database.save_message(user_id, metadata)
|
|
File without changes
|
|
File without changes
|