solana-agent 1.3.0__tar.gz → 1.3.1__tar.gz
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-1.3.0 → solana_agent-1.3.1}/PKG-INFO +1 -1
- {solana_agent-1.3.0 → solana_agent-1.3.1}/pyproject.toml +1 -1
- {solana_agent-1.3.0 → solana_agent-1.3.1}/solana_agent/ai.py +5 -16
- {solana_agent-1.3.0 → solana_agent-1.3.1}/LICENSE +0 -0
- {solana_agent-1.3.0 → solana_agent-1.3.1}/README.md +0 -0
- {solana_agent-1.3.0 → solana_agent-1.3.1}/solana_agent/__init__.py +0 -0
|
@@ -215,8 +215,7 @@ class AI:
|
|
|
215
215
|
else:
|
|
216
216
|
uid = uuid.uuid4().hex
|
|
217
217
|
self._vector_store = self._client.beta.vector_stores.create(
|
|
218
|
-
name=uid
|
|
219
|
-
)
|
|
218
|
+
name=uid)
|
|
220
219
|
self._database.save_vector_store_id(self._vector_store.id)
|
|
221
220
|
self._client.beta.assistants.update(
|
|
222
221
|
assistant_id=self._assistant_id,
|
|
@@ -335,24 +334,14 @@ class AI:
|
|
|
335
334
|
|
|
336
335
|
def add_file(
|
|
337
336
|
self,
|
|
337
|
+
filename: str,
|
|
338
338
|
file_stream: bytes,
|
|
339
|
-
file_extension: Literal[
|
|
340
|
-
"doc", "docx", "json", "md", "pdf", "pptx", "tex", "txt"
|
|
341
|
-
] = "pdf",
|
|
342
339
|
) -> Literal["in_progress", "completed", "cancelled", "failed"]:
|
|
343
340
|
"""Upload and process a file in the OpenAI vector store.
|
|
344
341
|
|
|
345
342
|
Args:
|
|
343
|
+
filename (str): Name of the file to upload
|
|
346
344
|
file_stream (bytes): Raw bytes of the file to upload
|
|
347
|
-
file_extension (Literal, optional): File type extension. Defaults to "pdf"
|
|
348
|
-
Supported formats:
|
|
349
|
-
- doc, docx: Word documents
|
|
350
|
-
- json: JSON files
|
|
351
|
-
- md: Markdown files
|
|
352
|
-
- pdf: PDF documents
|
|
353
|
-
- pptx: PowerPoint presentations
|
|
354
|
-
- tex: LaTeX files
|
|
355
|
-
- txt: Plain text files
|
|
356
345
|
|
|
357
346
|
Returns:
|
|
358
347
|
Literal["in_progress", "completed", "cancelled", "failed"]: Status of file processing
|
|
@@ -360,7 +349,7 @@ class AI:
|
|
|
360
349
|
Example:
|
|
361
350
|
```python
|
|
362
351
|
with open('document.pdf', 'rb') as f:
|
|
363
|
-
status = ai.add_file(f.read()
|
|
352
|
+
status = ai.add_file(f.filename, f.read())
|
|
364
353
|
if status == "completed":
|
|
365
354
|
print("File processed successfully")
|
|
366
355
|
```
|
|
@@ -374,7 +363,7 @@ class AI:
|
|
|
374
363
|
"""
|
|
375
364
|
vector_store_id = self._database.get_vector_store_id()
|
|
376
365
|
file = self._client.files.create(
|
|
377
|
-
file=(
|
|
366
|
+
file=(filename, file_stream), purpose="assistants"
|
|
378
367
|
)
|
|
379
368
|
file_batch = self._client.beta.vector_stores.files.create_and_poll(
|
|
380
369
|
vector_store_id=vector_store_id, file_id=file.id
|
|
File without changes
|
|
File without changes
|
|
File without changes
|