solana-agent 27.2.0__tar.gz → 27.3.0__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.
Files changed (40) hide show
  1. solana_agent-27.2.0/README.md → solana_agent-27.3.0/PKG-INFO +149 -11
  2. solana_agent-27.2.0/PKG-INFO → solana_agent-27.3.0/README.md +119 -37
  3. {solana_agent-27.2.0 → solana_agent-27.3.0}/pyproject.toml +5 -1
  4. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/adapters/openai_adapter.py +59 -5
  5. solana_agent-27.3.0/solana_agent/adapters/pinecone_adapter.py +496 -0
  6. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/client/solana_agent.py +145 -1
  7. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/factories/agent_factory.py +73 -7
  8. solana_agent-27.3.0/solana_agent/interfaces/client/client.py +115 -0
  9. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/providers/llm.py +20 -0
  10. solana_agent-27.3.0/solana_agent/interfaces/providers/vector_storage.py +59 -0
  11. solana_agent-27.3.0/solana_agent/interfaces/services/knowledge_base.py +86 -0
  12. solana_agent-27.3.0/solana_agent/services/knowledge_base.py +771 -0
  13. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/services/query.py +33 -2
  14. solana_agent-27.2.0/solana_agent/interfaces/client/client.py +0 -45
  15. {solana_agent-27.2.0 → solana_agent-27.3.0}/LICENSE +0 -0
  16. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/__init__.py +0 -0
  17. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/adapters/__init__.py +0 -0
  18. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/adapters/mongodb_adapter.py +0 -0
  19. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/client/__init__.py +0 -0
  20. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/domains/__init__.py +0 -0
  21. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/domains/agent.py +0 -0
  22. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/domains/routing.py +0 -0
  23. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/factories/__init__.py +0 -0
  24. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/__init__.py +0 -0
  25. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/plugins/plugins.py +0 -0
  26. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/providers/data_storage.py +0 -0
  27. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/providers/memory.py +0 -0
  28. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/services/agent.py +0 -0
  29. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/services/query.py +0 -0
  30. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/interfaces/services/routing.py +0 -0
  31. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/plugins/__init__.py +0 -0
  32. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/plugins/manager.py +0 -0
  33. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/plugins/registry.py +0 -0
  34. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/plugins/tools/__init__.py +0 -0
  35. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/plugins/tools/auto_tool.py +0 -0
  36. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/repositories/__init__.py +0 -0
  37. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/repositories/memory.py +0 -0
  38. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/services/__init__.py +0 -0
  39. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/services/agent.py +0 -0
  40. {solana_agent-27.2.0 → solana_agent-27.3.0}/solana_agent/services/routing.py +0 -0
@@ -1,3 +1,32 @@
1
+ Metadata-Version: 2.3
2
+ Name: solana-agent
3
+ Version: 27.3.0
4
+ Summary: Agentic IQ
5
+ License: MIT
6
+ Keywords: ai,openai,ai agents,agi
7
+ Author: Bevan Hunt
8
+ Author-email: bevan@bevanhunt.com
9
+ Requires-Python: >=3.12,<4.0
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
+ Requires-Dist: instructor (>=1.7.9,<2.0.0)
18
+ Requires-Dist: llama-index-core (>=0.12.30,<0.13.0)
19
+ Requires-Dist: llama-index-embeddings-openai (>=0.3.1,<0.4.0)
20
+ Requires-Dist: openai (>=1.74.0,<2.0.0)
21
+ Requires-Dist: pinecone (>=6.0.2,<7.0.0)
22
+ Requires-Dist: pydantic (>=2.11.3,<3.0.0)
23
+ Requires-Dist: pymongo (>=4.12.0,<5.0.0)
24
+ Requires-Dist: pypdf (>=5.4.0,<6.0.0)
25
+ Requires-Dist: zep-cloud (>=2.10.1,<3.0.0)
26
+ Project-URL: Documentation, https://docs.solana-agent.com
27
+ Project-URL: Repository, https://github.com/truemagic-coder/solana-agent
28
+ Description-Content-Type: text/markdown
29
+
1
30
  # Solana Agent
2
31
 
3
32
  [![PyPI - Version](https://img.shields.io/pypi/v/solana-agent)](https://pypi.org/project/solana-agent/)
@@ -26,6 +55,7 @@ Build your AI business in three lines of code!
26
55
  * Business Alignment
27
56
  * Extensible Tooling
28
57
  * Simple Business Definition
58
+ * Knowledge Base with PDF support
29
59
  * Tested & Secure
30
60
  * Built in Python
31
61
  * Powers [CometHeart](https://cometheart.com) & [WalletBubbles](https://walletbubbles.com)
@@ -45,6 +75,7 @@ Build your AI business in three lines of code!
45
75
  * Powerful tool integration using standard Python packages and/or inline tools
46
76
  * Assigned tools are utilized by agents automatically and effectively
47
77
  * Simple business definition using JSON
78
+ * Integrated Knowledge Base with semantic search and automatic PDF chunking
48
79
 
49
80
  ## Stack
50
81
 
@@ -54,15 +85,17 @@ Build your AI business in three lines of code!
54
85
  * [OpenAI](https://openai.com), [Google](https://ai.google.dev), [xAI](https://x.ai) - LLM Providers
55
86
  * [MongoDB](https://mongodb.com) - Conversational History (optional)
56
87
  * [Zep Cloud](https://getzep.com) - Conversational Memory (optional)
88
+ * [Pinecone](https://pinecone.io) - Knowledge Base (optional)
57
89
 
58
90
  ### LLMs
59
91
 
60
92
  * [gpt-4.1-mini](https://platform.openai.com/docs/models/gpt-4.1-mini) (agent)
61
93
  * [gpt-4.1-nano](https://platform.openai.com/docs/models/gpt-4.1-nano) (router)
62
- * [gemini-2.0-flash](https://ai.google.dev/gemini-api/docs/models#gemini-2.0-flash) (optional)
63
- * [grok-3-mini-fast-beta](https://docs.x.ai/docs/models#models-and-pricing) (optional)
94
+ * [text-embedding-3-large](https://platform.openai.com/docs/models/text-embedding-3-large) or [text-embedding-3-small](https://platform.openai.com/docs/models/text-embedding-3-small) (embedding)
64
95
  * [tts-1](https://platform.openai.com/docs/models/tts-1) (audio TTS)
65
96
  * [gpt-4o-mini-transcribe](https://platform.openai.com/docs/models/gpt-4o-mini-transcribe) (audio transcription)
97
+ * [gemini-2.0-flash](https://ai.google.dev/gemini-api/docs/models#gemini-2.0-flash) (optional)
98
+ * [grok-3-mini-fast-beta](https://docs.x.ai/docs/models#models-and-pricing) (optional)
66
99
 
67
100
  ## Installation
68
101
 
@@ -171,7 +204,7 @@ config = {
171
204
 
172
205
  solana_agent = SolanaAgent(config=config)
173
206
 
174
- audio_content = audio_file.read()
207
+ audio_content = await audio_file.read()
175
208
 
176
209
  async for response in solana_agent.process("user123", audio_content, output_format="audio", audio_voice="nova", audio_input_format="webm", audio_output_format="aac"):
177
210
  print(response, end="")
@@ -231,7 +264,7 @@ config = {
231
264
 
232
265
  solana_agent = SolanaAgent(config=config)
233
266
 
234
- audio_content = audio_file.read()
267
+ audio_content = await audio_file.read()
235
268
 
236
269
  async for response in solana_agent.process("user123", audio_content, audio_input_format="aac"):
237
270
  print(response, end="")
@@ -302,6 +335,114 @@ config = {
302
335
  }
303
336
  ```
304
337
 
338
+ ### Knowledge Base
339
+
340
+ The Knowledge Base (KB) is meant to store text values and/or small PDFs.
341
+
342
+ ```python
343
+ config = {
344
+ "knowledge_base": {
345
+ "pinecone": {
346
+ "api_key": "your-pinecone-api-key",
347
+ "index_name": "your-pinecone-index-name",
348
+ }
349
+ },
350
+ "mongo": {
351
+ "connection_string": "your-mongo-connection-string",
352
+ "database": "your-database-name"
353
+ },
354
+ }
355
+ ```
356
+
357
+ #### Example for KB (text)
358
+
359
+ ```python
360
+ from solana_agent import SolanaAgent
361
+
362
+ config = {
363
+ "openai": {
364
+ "api_key": "your-openai-api-key",
365
+ },
366
+ "knowledge_base": {
367
+ "pinecone": {
368
+ "api_key": "your-pinecone-api-key",
369
+ "index_name": "your-pinecone-index-name",
370
+ }
371
+ },
372
+ "mongo": {
373
+ "connection_string": "your-mongo-connection-string",
374
+ "database": "your-database-name"
375
+ },
376
+ "agents": [
377
+ {
378
+ "name": "kb_expert",
379
+ "instructions": "You answer questions based on the provided knowledge base documents.",
380
+ "specialization": "Company Knowledge",
381
+ }
382
+ ]
383
+ }
384
+
385
+ solana_agent = SolanaAgent(config=config)
386
+
387
+ doc_text = "Solana Agent is a Python framework for building multi-agent AI systems."
388
+ doc_metadata = {
389
+ "source": "internal_docs",
390
+ "version": "1.0",
391
+ "tags": ["framework", "python", "ai"]
392
+ }
393
+ await solana_agent.kb_add_document(text=doc_text, metadata=doc_metadata)
394
+
395
+ async for response in solana_agent.process("user123", "What is Solana Agent?"):
396
+ print(response, end="")
397
+ ```
398
+
399
+ #### Example for KB (pdf)
400
+
401
+ ```python
402
+ from solana_agent import SolanaAgent
403
+
404
+ config = {
405
+ "openai": {
406
+ "api_key": "your-openai-api-key",
407
+ },
408
+ "knowledge_base": {
409
+ "pinecone": {
410
+ "api_key": "your-pinecone-api-key",
411
+ "index_name": "your-pinecone-index-name",
412
+ }
413
+ },
414
+ "mongo": {
415
+ "connection_string": "your-mongo-connection-string",
416
+ "database": "your-database-name"
417
+ },
418
+ "agents": [
419
+ {
420
+ "name": "kb_expert",
421
+ "instructions": "You answer questions based on the provided knowledge base documents.",
422
+ "specialization": "Company Knowledge",
423
+ }
424
+ ]
425
+ }
426
+
427
+ solana_agent = SolanaAgent(config=config)
428
+
429
+ pdf_bytes = await pdf_file.read()
430
+
431
+ pdf_metadata = {
432
+ "source": "annual_report_2024.pdf",
433
+ "year": 2024,
434
+ "tags": ["finance", "report"]
435
+ }
436
+
437
+ await solana_agent.kb_add_pdf_document(
438
+ pdf_data=pdf_bytes,
439
+ metadata=pdf_metadata,
440
+ )
441
+
442
+ async for response in solana_agent.process("user123", "Summarize the annual report for 2024."):
443
+ print(response, end="")
444
+ ```
445
+
305
446
  ## Tools
306
447
 
307
448
  Tools can be used from plugins like Solana Agent Kit (sakit) or via inline tools. Tools available via plugins integrate automatically with Solana Agent.
@@ -428,13 +569,9 @@ async for response in solana_agent.process("user123", "What are the latest AI de
428
569
  print(response, end="")
429
570
  ```
430
571
 
431
- ## Agent Training
432
-
433
- Many use cases for Solana Agent require training your agents on your company data.
572
+ ## Advanced Customization
434
573
 
435
- This can be accomplished via runtime prompt injection. Integrations that work well with this method are vector stores like Pinecone and FAQs.
436
-
437
- This knowledge is accessible to all your AI agents.
574
+ ### Runtime Prompt Injection
438
575
 
439
576
  ```python
440
577
  from solana_agent import SolanaAgent
@@ -458,7 +595,7 @@ async for response in solana_agent.process("user123", "How do replace the latch
458
595
  print(response, end="")
459
596
  ```
460
597
 
461
- ## Custom Routing
598
+ ### Custom Routing
462
599
 
463
600
  In advanced cases like implementing a ticketing system on-top of Solana Agent - you can use your own router.
464
601
 
@@ -544,3 +681,4 @@ To run the test suite locally run `poetry run pytest --cov=solana_agent --cov-re
544
681
  ## License
545
682
 
546
683
  This project is licensed under the MIT License - see the LICENSE file for details.
684
+
@@ -1,28 +1,3 @@
1
- Metadata-Version: 2.3
2
- Name: solana-agent
3
- Version: 27.2.0
4
- Summary: Agentic IQ
5
- License: MIT
6
- Keywords: ai,openai,ai agents,agi
7
- Author: Bevan Hunt
8
- Author-email: bevan@bevanhunt.com
9
- Requires-Python: >=3.12,<4.0
10
- Classifier: Development Status :: 5 - Production/Stable
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
17
- Requires-Dist: instructor (>=1.7.9,<2.0.0)
18
- Requires-Dist: openai (>=1.74.0,<2.0.0)
19
- Requires-Dist: pydantic (>=2.11.3,<3.0.0)
20
- Requires-Dist: pymongo (>=4.12.0,<5.0.0)
21
- Requires-Dist: zep-cloud (>=2.10.1,<3.0.0)
22
- Project-URL: Documentation, https://docs.solana-agent.com
23
- Project-URL: Repository, https://github.com/truemagic-coder/solana-agent
24
- Description-Content-Type: text/markdown
25
-
26
1
  # Solana Agent
27
2
 
28
3
  [![PyPI - Version](https://img.shields.io/pypi/v/solana-agent)](https://pypi.org/project/solana-agent/)
@@ -51,6 +26,7 @@ Build your AI business in three lines of code!
51
26
  * Business Alignment
52
27
  * Extensible Tooling
53
28
  * Simple Business Definition
29
+ * Knowledge Base with PDF support
54
30
  * Tested & Secure
55
31
  * Built in Python
56
32
  * Powers [CometHeart](https://cometheart.com) & [WalletBubbles](https://walletbubbles.com)
@@ -70,6 +46,7 @@ Build your AI business in three lines of code!
70
46
  * Powerful tool integration using standard Python packages and/or inline tools
71
47
  * Assigned tools are utilized by agents automatically and effectively
72
48
  * Simple business definition using JSON
49
+ * Integrated Knowledge Base with semantic search and automatic PDF chunking
73
50
 
74
51
  ## Stack
75
52
 
@@ -79,15 +56,17 @@ Build your AI business in three lines of code!
79
56
  * [OpenAI](https://openai.com), [Google](https://ai.google.dev), [xAI](https://x.ai) - LLM Providers
80
57
  * [MongoDB](https://mongodb.com) - Conversational History (optional)
81
58
  * [Zep Cloud](https://getzep.com) - Conversational Memory (optional)
59
+ * [Pinecone](https://pinecone.io) - Knowledge Base (optional)
82
60
 
83
61
  ### LLMs
84
62
 
85
63
  * [gpt-4.1-mini](https://platform.openai.com/docs/models/gpt-4.1-mini) (agent)
86
64
  * [gpt-4.1-nano](https://platform.openai.com/docs/models/gpt-4.1-nano) (router)
87
- * [gemini-2.0-flash](https://ai.google.dev/gemini-api/docs/models#gemini-2.0-flash) (optional)
88
- * [grok-3-mini-fast-beta](https://docs.x.ai/docs/models#models-and-pricing) (optional)
65
+ * [text-embedding-3-large](https://platform.openai.com/docs/models/text-embedding-3-large) or [text-embedding-3-small](https://platform.openai.com/docs/models/text-embedding-3-small) (embedding)
89
66
  * [tts-1](https://platform.openai.com/docs/models/tts-1) (audio TTS)
90
67
  * [gpt-4o-mini-transcribe](https://platform.openai.com/docs/models/gpt-4o-mini-transcribe) (audio transcription)
68
+ * [gemini-2.0-flash](https://ai.google.dev/gemini-api/docs/models#gemini-2.0-flash) (optional)
69
+ * [grok-3-mini-fast-beta](https://docs.x.ai/docs/models#models-and-pricing) (optional)
91
70
 
92
71
  ## Installation
93
72
 
@@ -196,7 +175,7 @@ config = {
196
175
 
197
176
  solana_agent = SolanaAgent(config=config)
198
177
 
199
- audio_content = audio_file.read()
178
+ audio_content = await audio_file.read()
200
179
 
201
180
  async for response in solana_agent.process("user123", audio_content, output_format="audio", audio_voice="nova", audio_input_format="webm", audio_output_format="aac"):
202
181
  print(response, end="")
@@ -256,7 +235,7 @@ config = {
256
235
 
257
236
  solana_agent = SolanaAgent(config=config)
258
237
 
259
- audio_content = audio_file.read()
238
+ audio_content = await audio_file.read()
260
239
 
261
240
  async for response in solana_agent.process("user123", audio_content, audio_input_format="aac"):
262
241
  print(response, end="")
@@ -327,6 +306,114 @@ config = {
327
306
  }
328
307
  ```
329
308
 
309
+ ### Knowledge Base
310
+
311
+ The Knowledge Base (KB) is meant to store text values and/or small PDFs.
312
+
313
+ ```python
314
+ config = {
315
+ "knowledge_base": {
316
+ "pinecone": {
317
+ "api_key": "your-pinecone-api-key",
318
+ "index_name": "your-pinecone-index-name",
319
+ }
320
+ },
321
+ "mongo": {
322
+ "connection_string": "your-mongo-connection-string",
323
+ "database": "your-database-name"
324
+ },
325
+ }
326
+ ```
327
+
328
+ #### Example for KB (text)
329
+
330
+ ```python
331
+ from solana_agent import SolanaAgent
332
+
333
+ config = {
334
+ "openai": {
335
+ "api_key": "your-openai-api-key",
336
+ },
337
+ "knowledge_base": {
338
+ "pinecone": {
339
+ "api_key": "your-pinecone-api-key",
340
+ "index_name": "your-pinecone-index-name",
341
+ }
342
+ },
343
+ "mongo": {
344
+ "connection_string": "your-mongo-connection-string",
345
+ "database": "your-database-name"
346
+ },
347
+ "agents": [
348
+ {
349
+ "name": "kb_expert",
350
+ "instructions": "You answer questions based on the provided knowledge base documents.",
351
+ "specialization": "Company Knowledge",
352
+ }
353
+ ]
354
+ }
355
+
356
+ solana_agent = SolanaAgent(config=config)
357
+
358
+ doc_text = "Solana Agent is a Python framework for building multi-agent AI systems."
359
+ doc_metadata = {
360
+ "source": "internal_docs",
361
+ "version": "1.0",
362
+ "tags": ["framework", "python", "ai"]
363
+ }
364
+ await solana_agent.kb_add_document(text=doc_text, metadata=doc_metadata)
365
+
366
+ async for response in solana_agent.process("user123", "What is Solana Agent?"):
367
+ print(response, end="")
368
+ ```
369
+
370
+ #### Example for KB (pdf)
371
+
372
+ ```python
373
+ from solana_agent import SolanaAgent
374
+
375
+ config = {
376
+ "openai": {
377
+ "api_key": "your-openai-api-key",
378
+ },
379
+ "knowledge_base": {
380
+ "pinecone": {
381
+ "api_key": "your-pinecone-api-key",
382
+ "index_name": "your-pinecone-index-name",
383
+ }
384
+ },
385
+ "mongo": {
386
+ "connection_string": "your-mongo-connection-string",
387
+ "database": "your-database-name"
388
+ },
389
+ "agents": [
390
+ {
391
+ "name": "kb_expert",
392
+ "instructions": "You answer questions based on the provided knowledge base documents.",
393
+ "specialization": "Company Knowledge",
394
+ }
395
+ ]
396
+ }
397
+
398
+ solana_agent = SolanaAgent(config=config)
399
+
400
+ pdf_bytes = await pdf_file.read()
401
+
402
+ pdf_metadata = {
403
+ "source": "annual_report_2024.pdf",
404
+ "year": 2024,
405
+ "tags": ["finance", "report"]
406
+ }
407
+
408
+ await solana_agent.kb_add_pdf_document(
409
+ pdf_data=pdf_bytes,
410
+ metadata=pdf_metadata,
411
+ )
412
+
413
+ async for response in solana_agent.process("user123", "Summarize the annual report for 2024."):
414
+ print(response, end="")
415
+ ```
416
+
330
417
  ## Tools
331
418
 
332
419
  Tools can be used from plugins like Solana Agent Kit (sakit) or via inline tools. Tools available via plugins integrate automatically with Solana Agent.
@@ -453,13 +540,9 @@ async for response in solana_agent.process("user123", "What are the latest AI de
453
540
  print(response, end="")
454
541
  ```
455
542
 
456
- ## Agent Training
457
-
458
- Many use cases for Solana Agent require training your agents on your company data.
543
+ ## Advanced Customization
459
544
 
460
- This can be accomplished via runtime prompt injection. Integrations that work well with this method are vector stores like Pinecone and FAQs.
461
-
462
- This knowledge is accessible to all your AI agents.
545
+ ### Runtime Prompt Injection
463
546
 
464
547
  ```python
465
548
  from solana_agent import SolanaAgent
@@ -483,7 +566,7 @@ async for response in solana_agent.process("user123", "How do replace the latch
483
566
  print(response, end="")
484
567
  ```
485
568
 
486
- ## Custom Routing
569
+ ### Custom Routing
487
570
 
488
571
  In advanced cases like implementing a ticketing system on-top of Solana Agent - you can use your own router.
489
572
 
@@ -569,4 +652,3 @@ To run the test suite locally run `poetry run pytest --cov=solana_agent --cov-re
569
652
  ## License
570
653
 
571
654
  This project is licensed under the MIT License - see the LICENSE file for details.
572
-
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "solana-agent"
3
- version = "27.2.0"
3
+ version = "27.3.0"
4
4
  description = "Agentic IQ"
5
5
  authors = ["Bevan Hunt <bevan@bevanhunt.com>"]
6
6
  license = "MIT"
@@ -28,6 +28,10 @@ pydantic = "^2.11.3"
28
28
  pymongo = "^4.12.0"
29
29
  zep-cloud = "^2.10.1"
30
30
  instructor = "^1.7.9"
31
+ pinecone = "^6.0.2"
32
+ llama-index-core = "^0.12.30"
33
+ llama-index-embeddings-openai = "^0.3.1"
34
+ pypdf = "^5.4.0"
31
35
 
32
36
  [tool.poetry.group.dev.dependencies]
33
37
  pytest = "^8.3.5"
@@ -3,7 +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
- from typing import AsyncGenerator, Literal, Optional, Type, TypeVar
6
+ from typing import AsyncGenerator, List, Literal, Optional, Type, TypeVar
7
7
 
8
8
  from openai import AsyncOpenAI
9
9
  from pydantic import BaseModel
@@ -14,16 +14,25 @@ from solana_agent.interfaces.providers.llm import LLMProvider
14
14
 
15
15
  T = TypeVar('T', bound=BaseModel)
16
16
 
17
+ DEFAULT_CHAT_MODEL = "gpt-4.1-mini"
18
+ DEFAULT_PARSE_MODEL = "gpt-4.1-nano"
19
+ DEFAULT_EMBEDDING_MODEL = "text-embedding-3-large"
20
+ DEFAULT_EMBEDDING_DIMENSIONS = 3072
21
+ DEFAULT_TRANSCRIPTION_MODEL = "gpt-4o-mini-transcribe"
22
+ DEFAULT_TTS_MODEL = "tts-1"
23
+
17
24
 
18
25
  class OpenAIAdapter(LLMProvider):
19
26
  """OpenAI implementation of LLMProvider with web search capabilities."""
20
27
 
21
28
  def __init__(self, api_key: str):
22
29
  self.client = AsyncOpenAI(api_key=api_key)
23
- self.parse_model = "gpt-4.1-nano"
24
- self.text_model = "gpt-4.1-mini"
25
- self.transcription_model = "gpt-4o-mini-transcribe"
26
- self.tts_model = "tts-1"
30
+ self.parse_model = DEFAULT_PARSE_MODEL
31
+ self.text_model = DEFAULT_CHAT_MODEL
32
+ self.transcription_model = DEFAULT_TRANSCRIPTION_MODEL
33
+ self.tts_model = DEFAULT_TTS_MODEL
34
+ self.embedding_model = DEFAULT_EMBEDDING_MODEL
35
+ self.embedding_dimensions = DEFAULT_EMBEDDING_DIMENSIONS
27
36
 
28
37
  async def tts(
29
38
  self,
@@ -248,3 +257,48 @@ class OpenAIAdapter(LLMProvider):
248
257
  raise ValueError(
249
258
  f"Failed to generate structured output: {e}. All fallbacks failed."
250
259
  ) from e
260
+
261
+ async def embed_text(
262
+ self,
263
+ text: str,
264
+ model: Optional[str] = None,
265
+ dimensions: Optional[int] = None
266
+ ) -> List[float]: # pragma: no cover
267
+ """Generate an embedding for the given text using OpenAI.
268
+
269
+ Args:
270
+ text: The text to embed.
271
+ model: The embedding model to use (defaults to text-embedding-3-large).
272
+ dimensions: Desired output dimensions for the embedding.
273
+
274
+ Returns:
275
+ A list of floats representing the embedding vector.
276
+ """
277
+ if not text:
278
+ raise ValueError("Text cannot be empty")
279
+
280
+ try:
281
+ # Use provided model/dimensions or fall back to defaults
282
+ embedding_model = model or self.embedding_model
283
+ embedding_dimensions = dimensions or self.embedding_dimensions
284
+
285
+ # Replace newlines with spaces as recommended by OpenAI
286
+ text = text.replace("\n", " ")
287
+
288
+ response = await self.client.embeddings.create(
289
+ input=[text],
290
+ model=embedding_model,
291
+ dimensions=embedding_dimensions
292
+ )
293
+
294
+ if response.data and response.data[0].embedding:
295
+ return response.data[0].embedding
296
+ else:
297
+ raise ValueError(
298
+ "Failed to retrieve embedding from OpenAI response")
299
+
300
+ except Exception as e:
301
+ print(f"Error generating embedding: {e}")
302
+ import traceback
303
+ print(traceback.format_exc())
304
+ raise