solana-agent 0.0.20__py3-none-any.whl → 0.0.22__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 +22 -18
- {solana_agent-0.0.20.dist-info → solana_agent-0.0.22.dist-info}/METADATA +1 -1
- solana_agent-0.0.22.dist-info/RECORD +6 -0
- solana_agent-0.0.20.dist-info/RECORD +0 -6
- {solana_agent-0.0.20.dist-info → solana_agent-0.0.22.dist-info}/LICENSE +0 -0
- {solana_agent-0.0.20.dist-info → solana_agent-0.0.22.dist-info}/WHEEL +0 -0
solana_agent/ai.py
CHANGED
|
@@ -141,7 +141,7 @@ class AI:
|
|
|
141
141
|
Pinecone(api_key=pinecone_api_key) if pinecone_api_key else None
|
|
142
142
|
)
|
|
143
143
|
self._pinecone_index_name = pinecone_index_name if pinecone_index_name else None
|
|
144
|
-
self.
|
|
144
|
+
self.kb = (
|
|
145
145
|
self._pinecone.Index(
|
|
146
146
|
self._pinecone_index_name) if self._pinecone else None
|
|
147
147
|
)
|
|
@@ -261,7 +261,7 @@ class AI:
|
|
|
261
261
|
input=query,
|
|
262
262
|
model=self._openai_embedding_model,
|
|
263
263
|
)
|
|
264
|
-
search_results = self.
|
|
264
|
+
search_results = self.kb.query(
|
|
265
265
|
vector=response.data[0].embedding,
|
|
266
266
|
top_k=limit,
|
|
267
267
|
include_metadata=True,
|
|
@@ -302,7 +302,7 @@ class AI:
|
|
|
302
302
|
input=values,
|
|
303
303
|
model=self._openai_embedding_model,
|
|
304
304
|
)
|
|
305
|
-
self.
|
|
305
|
+
self.kb.upsert(
|
|
306
306
|
vectors=[
|
|
307
307
|
{
|
|
308
308
|
"id": uuid.uuid4().hex,
|
|
@@ -377,15 +377,15 @@ class AI:
|
|
|
377
377
|
limit (int, optional): Maximum number of facts to return. Defaults to 10.
|
|
378
378
|
|
|
379
379
|
Returns:
|
|
380
|
-
|
|
380
|
+
str: JSON string of matched facts or error message
|
|
381
381
|
|
|
382
382
|
Example:
|
|
383
383
|
```python
|
|
384
384
|
facts = ai.search_facts(
|
|
385
385
|
user_id="user123",
|
|
386
|
-
query="
|
|
386
|
+
query="How many cats do I have?"
|
|
387
387
|
)
|
|
388
|
-
# Returns: ["
|
|
388
|
+
# Returns: [{"fact": "user123 has 4 cats", ...}]
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
Note:
|
|
@@ -393,18 +393,22 @@ class AI:
|
|
|
393
393
|
This is a synchronous tool method required for OpenAI function calling.
|
|
394
394
|
"""
|
|
395
395
|
if self._sync_zep:
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
396
|
+
try:
|
|
397
|
+
facts = []
|
|
398
|
+
results = self._sync_zep.memory.search_sessions(
|
|
399
|
+
user_id=user_id,
|
|
400
|
+
session_ids=[user_id],
|
|
401
|
+
text=query,
|
|
402
|
+
limit=limit,
|
|
403
|
+
)
|
|
404
|
+
for result in results.results:
|
|
405
|
+
fact = result.fact
|
|
406
|
+
facts.append(fact)
|
|
407
|
+
return json.dumps(facts)
|
|
408
|
+
except Exception as e:
|
|
409
|
+
return f"Failed to search facts. Error: {e}"
|
|
410
|
+
else:
|
|
411
|
+
return "Zep integration not configured."
|
|
408
412
|
|
|
409
413
|
# search internet tool - has to be sync
|
|
410
414
|
def search_internet(
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
|
|
2
|
+
solana_agent/ai.py,sha256=TMyTxHiFudcYDGLMub74TZV1ZRiWa4kOJ3dp4hjXUyg,33828
|
|
3
|
+
solana_agent-0.0.22.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
|
|
4
|
+
solana_agent-0.0.22.dist-info/METADATA,sha256=VhkFrYnj87JRe9hDhIOSDm-uVCm6uDDHFq0FTpCGM84,5577
|
|
5
|
+
solana_agent-0.0.22.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
6
|
+
solana_agent-0.0.22.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
|
|
2
|
-
solana_agent/ai.py,sha256=UsGmhg710HrujIEsyXykhLYVvGMAT-fuHORMrtoAZ28,33672
|
|
3
|
-
solana_agent-0.0.20.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
|
|
4
|
-
solana_agent-0.0.20.dist-info/METADATA,sha256=wOdfWqoaZHVooYnutm1fGbPTaOfszhBWN-wHeBHus-8,5577
|
|
5
|
-
solana_agent-0.0.20.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
6
|
-
solana_agent-0.0.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|