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 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._pinecone_index = (
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._pinecone_index.query(
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._pinecone_index.upsert(
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
- List[str] | None: List of found facts or None if Zep is not configured
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="project requirements"
386
+ query="How many cats do I have?"
387
387
  )
388
- # Returns: ["Fact 1", "Fact 2", ...]
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
- facts = []
397
- results = self._sync_zep.memory.search_sessions(
398
- user_id=user_id,
399
- session_ids=[user_id],
400
- text=query,
401
- limit=limit,
402
- )
403
- for result in results.results:
404
- fact = result.fact.fact
405
- facts.append(fact)
406
- return json.dumps(facts)
407
- return None
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(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 0.0.20
3
+ Version: 0.0.22
4
4
  Summary: Build self-learning AI Agents
5
5
  License: MIT
6
6
  Keywords: ai,openai,ai agents
@@ -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,,