solana-agent 0.0.101__py3-none-any.whl → 1.0.1__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
@@ -215,7 +215,7 @@ class AI:
215
215
  user_id="user123",
216
216
  query="How many cats do I have?"
217
217
  )
218
- # Returns: [{"fact": "user123 has 4 cats", ...}]
218
+ # Returns: [{"fact": "user123 has 4 cats", "timestamp": "2022-01-01T12:00:00Z"}]
219
219
  ```
220
220
 
221
221
  Note:
@@ -232,8 +232,9 @@ class AI:
232
232
  limit=limit,
233
233
  )
234
234
  for result in results.results:
235
- fact = result.fact
236
- facts.append(fact)
235
+ fact = result.fact.fact
236
+ timestamp = result.fact.created_at
237
+ facts.append({"fact": fact, "timestamp": timestamp})
237
238
  return json.dumps(facts)
238
239
  except Exception as e:
239
240
  return f"Failed to search facts. Error: {e}"
@@ -429,12 +430,40 @@ class AI:
429
430
  except Exception as e:
430
431
  return f"Failed to search X. Error: {e}"
431
432
 
433
+ async def clear_user_history(self, user_id: str):
434
+ """Clear stored conversation history for a specific user.
435
+
436
+ Args:
437
+ user_id (str): Unique identifier for the user whose history should be cleared
438
+
439
+ Example:
440
+ ```python
441
+ await ai.clear_user_history("user123")
442
+ # Clears all stored messages, facts, and threads for user123
443
+ ```
444
+
445
+ Note:
446
+ This is an async method and must be awaited.
447
+ """
448
+ try:
449
+ await self.delete_assistant_thread(user_id)
450
+ except Exception:
451
+ pass
452
+ try:
453
+ await self._database.clear_user_history(user_id)
454
+ except Exception:
455
+ pass
456
+ try:
457
+ await self.delete_facts(user_id)
458
+ except Exception:
459
+ pass
460
+
432
461
  async def delete_assistant_thread(self, user_id: str):
433
462
  """Delete stored conversation thread for a user on OpenAI.
434
463
 
435
464
  Example:
436
465
  ```python
437
- await ai.delete_assistant_thread(user_id="user123")
466
+ await ai.delete_assistant_thread("user123")
438
467
  # Deletes the assistant conversation thread for a user
439
468
  ```
440
469
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 0.0.101
3
+ Version: 1.0.1
4
4
  Summary: Build self-learning AI Agents
5
5
  License: MIT
6
6
  Keywords: ai,openai,ai agents
@@ -98,7 +98,7 @@ pip install solana-agent
98
98
  ```
99
99
 
100
100
  ## Documentation
101
- * All public methods have docstrings for real-time IDE hinting
101
+ * Each public method has a docstring for real-time IDE hinting
102
102
 
103
103
  ## Production Apps
104
104
  * [Solana Agent Copilot](https://ai.solana-agent.com) - Solana Token AI Copilot using streaming text conversations
@@ -0,0 +1,6 @@
1
+ solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
+ solana_agent/ai.py,sha256=4hAb_iyHr-IkVqi8DFI3-Wu2QiCWSLFV5ji61X05aTk,29229
3
+ solana_agent-1.0.1.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
+ solana_agent-1.0.1.dist-info/METADATA,sha256=Uhkk0hS0xBrc51IVvZGOfAYm8LrUo6NEPlTdLQoQ2uM,4341
5
+ solana_agent-1.0.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
+ solana_agent-1.0.1.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
- solana_agent/ai.py,sha256=XMXAXwFG62PRSfjH0cbRMRixMulCJECFtg7B9z0nmSk,28291
3
- solana_agent-0.0.101.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
- solana_agent-0.0.101.dist-info/METADATA,sha256=DPGz_VxS2T56RDxrIrgdFq0HBRksmRzVmJmoe67sI6Q,4343
5
- solana_agent-0.0.101.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
- solana_agent-0.0.101.dist-info/RECORD,,