solana-agent 0.0.21__py3-none-any.whl → 0.0.100__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.
solana_agent/ai.py CHANGED
@@ -1,8 +1,7 @@
1
1
  import asyncio
2
- from datetime import datetime
2
+ import datetime
3
3
  import json
4
- from typing import AsyncGenerator, List, Literal, Optional, Dict, Any, Callable
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, Grok, Gemini, Pinecone, and Cohere
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 0.0.21
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 knowledge base
87
- - Simple custom tool creation for extending capabilities like additional API integrations
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
@@ -0,0 +1,6 @@
1
+ solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
+ solana_agent/ai.py,sha256=T9Lnf8i9To6Oi16e3NzIfCvJI9La0Cpkx-sNfXFZSXY,27833
3
+ solana_agent-0.0.100.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
+ solana_agent-0.0.100.dist-info/METADATA,sha256=RuMKQKR2aI-Eew61WVUEmxehUXuXu2DqXrxt0dkYOF4,4343
5
+ solana_agent-0.0.100.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
+ solana_agent-0.0.100.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
- solana_agent/ai.py,sha256=rzb7854cnM6abePB6uPrCSPddLiZ8njTC52BGUqaPFc,33867
3
- solana_agent-0.0.21.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
- solana_agent-0.0.21.dist-info/METADATA,sha256=MP86I2MaIHLGCE7TqW1Ay6WVo0uACFct3f0rxIdTb3k,5577
5
- solana_agent-0.0.21.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
- solana_agent-0.0.21.dist-info/RECORD,,