solana-agent 0.0.3__py3-none-any.whl → 0.0.5__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
@@ -16,6 +16,7 @@ import requests
16
16
  from zep_python.client import AsyncZep
17
17
  from zep_python.client import Zep
18
18
  from zep_python.types import Message, RoleType
19
+ import pandas as pd
19
20
 
20
21
 
21
22
  def adapt_datetime(ts):
@@ -173,6 +174,7 @@ class AI:
173
174
  zep_base_url: str = None,
174
175
  perplexity_api_key: str = None,
175
176
  grok_api_key: str = None,
177
+ gemini_api_key: str = None,
176
178
  code_interpreter: bool = True,
177
179
  model: Literal["gpt-4o-mini", "gpt-4o"] = "gpt-4o-mini",
178
180
  ):
@@ -195,6 +197,7 @@ class AI:
195
197
  )
196
198
  self.perplexity_api_key = perplexity_api_key
197
199
  self.grok_api_key = grok_api_key
200
+ self.gemini_api_key = gemini_api_key
198
201
 
199
202
  async def __aenter__(self):
200
203
  assistants = openai.beta.assistants.list()
@@ -250,6 +253,37 @@ class AI:
250
253
  thread_id=thread_id, run_id=run_id)
251
254
  return run.status
252
255
 
256
+ # converter tool - has to be sync
257
+ def csv_to_json(self, file_path: str) -> str:
258
+ df = pd.read_csv(file_path)
259
+ records = df.to_dict(orient="records")
260
+ return json.dumps(records)
261
+
262
+ # summarize tool - has to be sync
263
+ def summarize(
264
+ self, text: str, model: Literal["gemini-2.0-flash"] = "gemini-2.0-flash"
265
+ ) -> str:
266
+ try:
267
+ client = OpenAI(
268
+ api_key=self.gemini_api_key,
269
+ base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
270
+ )
271
+
272
+ completion = client.chat.completions.create(
273
+ model=model,
274
+ messages=[
275
+ {
276
+ "role": "system",
277
+ "content": "You summarize the text.",
278
+ },
279
+ {"role": "user", "content": text},
280
+ ],
281
+ )
282
+
283
+ return completion.choices[0].message.content
284
+ except Exception as e:
285
+ return f"Failed to summarize text. Error: {e}"
286
+
253
287
  # search facts tool - has to be sync
254
288
  def search_facts(
255
289
  self,
@@ -317,6 +351,9 @@ class AI:
317
351
  self,
318
352
  user_id: str,
319
353
  query: str,
354
+ use_perplexity: bool = True,
355
+ use_grok: bool = True,
356
+ use_facts: bool = True,
320
357
  perplexity_model: Literal[
321
358
  "sonar", "sonar-pro", "sonar-reasoning-pro", "sonar-reasoning"
322
359
  ] = "sonar",
@@ -324,11 +361,20 @@ class AI:
324
361
  grok_model: Literal["grok-beta"] = "grok-beta",
325
362
  ) -> str:
326
363
  try:
327
- facts = self.search_facts(user_id, query)
328
- if not facts:
364
+ if use_facts:
365
+ facts = self.search_facts(user_id, query)
366
+ if not facts:
367
+ facts = ""
368
+ else:
329
369
  facts = ""
330
- search_results = self.search_internet(query, perplexity_model)
331
- x_search_results = self.search_x(query, grok_model)
370
+ if use_perplexity:
371
+ search_results = self.search_internet(query, perplexity_model)
372
+ else:
373
+ search_results = ""
374
+ if use_grok:
375
+ x_search_results = self.search_x(query, grok_model)
376
+ else:
377
+ x_search_results = ""
332
378
 
333
379
  response = self.client.chat.completions.create(
334
380
  model=openai_model,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: solana-agent
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: The Best AI Agent Framework
5
5
  License: MIT
6
6
  Keywords: ai,openai,ai agents
@@ -19,6 +19,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
19
  Requires-Dist: aiosqlite (>=0.21.0,<0.22.0)
20
20
  Requires-Dist: motor (>=3.7.0,<4.0.0)
21
21
  Requires-Dist: openai (>=1.61.1,<2.0.0)
22
+ Requires-Dist: pandas (>=2.2.3,<3.0.0)
22
23
  Requires-Dist: pydantic (>=2.10.6,<3.0.0)
23
24
  Requires-Dist: requests (>=2.32.3,<3.0.0)
24
25
  Requires-Dist: zep-python (>=2.0.2,<3.0.0)
@@ -46,6 +47,8 @@ Solana Agent is the best AI Agent framework.
46
47
  - Search Zep facts tool
47
48
  - Search X with Grok tool
48
49
  - Reasoning tool that combines OpenAI model reasoning, Zep facts, Internet search, and X search.
50
+ - CSV to JSON tool
51
+ - Summarize text tool using Gemini
49
52
  - Solana tools upcoming...
50
53
 
51
54
  ## Installation
@@ -0,0 +1,6 @@
1
+ solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
+ solana_agent/ai.py,sha256=a82WmVPwsQEKMojS9DM4-rSHqdoF3XwKdn92I96UQwA,22001
3
+ solana_agent-0.0.5.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
+ solana_agent-0.0.5.dist-info/METADATA,sha256=IKT-sJnHh6_jOK7TsSfMH9Fe1NxNvXUONWF7Kr53qn0,2970
5
+ solana_agent-0.0.5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
+ solana_agent-0.0.5.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- solana_agent/__init__.py,sha256=zpfnWqANd3OHGWm7NCF5Y6m01BWG4NkNk8SK9Ex48nA,18
2
- solana_agent/ai.py,sha256=JHpIAGMKy4WxTs2ofA7MQXn-y82F35rAa_Bb71FGzBo,20498
3
- solana_agent-0.0.3.dist-info/LICENSE,sha256=BnSRc-NSFuyF2s496l_4EyrwAP6YimvxWcjPiJ0J7g4,1057
4
- solana_agent-0.0.3.dist-info/METADATA,sha256=pqGWounnqb9zTud-1UPFqV5u1gpBFiFDP1iN5xUAd6o,2877
5
- solana_agent-0.0.3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
6
- solana_agent-0.0.3.dist-info/RECORD,,