solana-agent 2.1.0__py3-none-any.whl → 2.1.2__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,5 +1,6 @@
1
1
  import asyncio
2
2
  import datetime
3
+ import ntplib
3
4
  import json
4
5
  from typing import AsyncGenerator, List, Literal, Dict, Any, Callable
5
6
  import uuid
@@ -430,9 +431,8 @@ class AI:
430
431
  self.kb.delete(ids=[id], namespace=user_id)
431
432
  self._database.kb.delete_one({"reference": id})
432
433
 
433
- # check time tool - has to be sync
434
434
  def check_time(self) -> str:
435
- """Get current UTC time formatted as a string.
435
+ """Get current UTC time formatted as a string via Cloudflare's NTP service.
436
436
 
437
437
  Returns:
438
438
  str: Current UTC time in format 'YYYY-MM-DD HH:MM:SS UTC'
@@ -440,16 +440,22 @@ class AI:
440
440
  Example:
441
441
  ```python
442
442
  time = ai.check_time()
443
- # Returns: "2024-02-13 15:30:45 UTC"
443
+ # Returns: "2025-02-26 15:30:45 UTC"
444
444
  ```
445
445
 
446
446
  Note:
447
447
  This is a synchronous tool method required for OpenAI function calling.
448
- Always returns time in UTC timezone for consistency.
448
+ Fetches time over NTP from Cloudflare's time server (time.cloudflare.com).
449
449
  """
450
- return datetime.datetime.now(datetime.timezone.utc).strftime(
451
- "%Y-%m-%d %H:%M:%S %Z"
452
- )
450
+ try:
451
+ client = ntplib.NTPClient()
452
+ # Request time from Cloudflare's NTP server.
453
+ response = client.request("time.cloudflare.com", version=3)
454
+ dt = datetime.datetime.fromtimestamp(
455
+ response.tx_time, datetime.timezone.utc)
456
+ return dt.strftime("%Y-%m-%d %H:%M:%S UTC")
457
+ except Exception as e:
458
+ return f"Error: {e}"
453
459
 
454
460
  # has to be sync for tool
455
461
  def get_memory_context(
@@ -833,7 +839,6 @@ class AI:
833
839
  "content": result,
834
840
  },
835
841
  ],
836
- tools=self._tools,
837
842
  stream=True,
838
843
  )
839
844
  for chunk in response:
@@ -994,7 +999,6 @@ class AI:
994
999
  "content": result,
995
1000
  },
996
1001
  ],
997
- tools=self._tools,
998
1002
  stream=True,
999
1003
  )
1000
1004
  for chunk in response:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 2.1.0
3
+ Version: 2.1.2
4
4
  Summary: Build self-learning AI Agents
5
5
  License: MIT
6
6
  Keywords: ai,openai,ai agents
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Classifier: Programming Language :: Python :: 3 :: Only
18
18
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Dist: ntplib (>=0.4.0,<0.5.0)
19
20
  Requires-Dist: openai (>=1.64.0,<2.0.0)
20
21
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
21
22
  Requires-Dist: pinecone (>=6.0.1,<7.0.0)
@@ -0,0 +1,6 @@
1
+ solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
+ solana_agent/ai.py,sha256=UdAsO1t3JBeW8UQBYSJjUcT4NUyrMJuAHf-yI2nzT0I,44216
3
+ solana_agent-2.1.2.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
+ solana_agent-2.1.2.dist-info/METADATA,sha256=wbK_aB2WBqNvGAoVt1eRn6dLWO3DYlqS7pvBGP0j0Qw,4808
5
+ solana_agent-2.1.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
6
+ solana_agent-2.1.2.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
- solana_agent/ai.py,sha256=TM1oqJtPE5cfIxtRiy2uyTRgH2ux4o7Fy_0P3HUkcss,44006
3
- solana_agent-2.1.0.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
- solana_agent-2.1.0.dist-info/METADATA,sha256=pw_VcbC-0q3OEH2Tx2xLEASOpPyuh-KKPjYvAhaKTCo,4769
5
- solana_agent-2.1.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
6
- solana_agent-2.1.0.dist-info/RECORD,,