seekrai 0.5.0__py3-none-any.whl → 0.5.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.
@@ -147,7 +147,7 @@ class AsyncChatCompletions:
147
147
  repetition_penalty: float = 1,
148
148
  stream: bool = False,
149
149
  logprobs: bool | None = False,
150
- top_logprobs: int | None = 0,
150
+ top_logprobs: int | None = None,
151
151
  echo: bool = False,
152
152
  n: int = 1,
153
153
  safety_model: str | None = None,
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from pathlib import Path
4
- from typing import Any, Dict
4
+ from typing import Any, Dict, Optional, Union
5
5
 
6
6
  from seekrai.abstract import api_requestor
7
7
  from seekrai.filemanager import DownloadManager, UploadManager
@@ -197,30 +197,92 @@ class Files(ResourceBase):
197
197
 
198
198
  return AlignFileMetadataValidationResp(**response.data)
199
199
 
200
- def list(self) -> FileList:
200
+ def list(
201
+ self,
202
+ limit: Optional[int] = None,
203
+ offset: Optional[int] = None,
204
+ sort_by: Optional[str] = None,
205
+ sort_order: Optional[str] = None,
206
+ purpose: Optional[Union[FilePurpose, str]] = None,
207
+ ) -> FileList:
208
+ """
209
+ List files with pagination, sorting, and filtering options.
210
+
211
+ All parameter defaults are handled by the API if not specified.
212
+
213
+ Args:
214
+ limit: Maximum number of files to return
215
+ offset: Number of files to skip
216
+ sort_by: Field to sort by ('created_at', 'filename', 'type', or 'size')
217
+ sort_order: Sort order ('asc' or 'desc')
218
+ purpose: Filter by file purpose (FilePurpose enum or string)
219
+
220
+ Returns:
221
+ A FileList object containing the list of files
222
+
223
+ Raises:
224
+ Exception: If the API request fails
225
+ """
226
+ # Build query parameters, only including non-None values
227
+ params: Dict[str, Any] = {}
228
+ if limit is not None:
229
+ params["limit"] = limit
230
+ if offset is not None:
231
+ params["offset"] = offset
232
+ if sort_by is not None:
233
+ params["sort_by"] = sort_by
234
+ if sort_order is not None:
235
+ params["sort_order"] = sort_order
236
+
237
+ # Add purpose filter if provided, converting from enum if needed
238
+ if purpose is not None:
239
+ params["purpose"] = (
240
+ purpose.value if isinstance(purpose, FilePurpose) else purpose
241
+ )
242
+
243
+ # Create request and use the API requestor
244
+ requestor = api_requestor.APIRequestor(client=self._client)
245
+
246
+ response, _, _ = requestor.request(
247
+ options=SeekrFlowRequest(
248
+ method="GET",
249
+ url="flow/files",
250
+ params=params,
251
+ ),
252
+ stream=False,
253
+ )
254
+
255
+ assert isinstance(response, SeekrFlowResponse)
256
+
257
+ return FileList.parse_obj(response.data)
258
+
259
+ def rename(self, id: str, new_filename: str) -> FileResponse:
260
+ """
261
+ Rename a file.
262
+
263
+ Args:
264
+ id (str): ID of the file to rename.
265
+ new_filename (str): New filename for the file.
266
+
267
+ Returns:
268
+ FileResponse: Object containing information about the renamed file.
269
+ """
201
270
  requestor = api_requestor.APIRequestor(
202
271
  client=self._client,
203
272
  )
204
273
 
205
274
  response, _, _ = requestor.request(
206
275
  options=SeekrFlowRequest(
207
- method="GET",
208
- url="flow/files",
276
+ method="PUT",
277
+ url=f"flow/files/{id}/rename",
278
+ params={"new_filename": new_filename},
209
279
  ),
210
280
  stream=False,
211
281
  )
212
282
 
213
283
  assert isinstance(response, SeekrFlowResponse)
214
- files = [
215
- FileResponse(
216
- id=file["id"],
217
- filename=file["filename"],
218
- created_at=file["created_at"],
219
- object="file",
220
- )
221
- for file in response.data["data"]
222
- ]
223
- return FileList(object="list", data=files)
284
+
285
+ return FileResponse(**response.data)
224
286
 
225
287
 
226
288
  class AsyncFiles(ResourceBase):
@@ -338,19 +400,89 @@ class AsyncFiles(ResourceBase):
338
400
 
339
401
  return file_responses
340
402
 
341
- async def list(self) -> FileList:
403
+ async def list(
404
+ self,
405
+ limit: Optional[int] = None,
406
+ offset: Optional[int] = None,
407
+ sort_by: Optional[str] = None,
408
+ sort_order: Optional[str] = None,
409
+ purpose: Optional[Union[FilePurpose, str]] = None,
410
+ ) -> FileList:
411
+ """
412
+ List files with pagination, sorting, and filtering options.
413
+
414
+ All parameter defaults are handled by the API if not specified.
415
+
416
+ Args:
417
+ limit: Maximum number of files to return
418
+ offset: Number of files to skip
419
+ sort_by: Field to sort by ('created_at', 'filename', 'type', or 'size')
420
+ sort_order: Sort order ('asc' or 'desc')
421
+ purpose: Filter by file purpose (FilePurpose enum or string)
422
+
423
+ Returns:
424
+ A FileList object containing the list of files
425
+
426
+ Raises:
427
+ Exception: If the API request fails
428
+ """
429
+ # Build query parameters, only including non-None values
430
+ params: Dict[str, Any] = {}
431
+ if limit is not None:
432
+ params["limit"] = limit
433
+ if offset is not None:
434
+ params["offset"] = offset
435
+ if sort_by is not None:
436
+ params["sort_by"] = sort_by
437
+ if sort_order is not None:
438
+ params["sort_order"] = sort_order
439
+
440
+ # Add purpose filter if provided, converting from enum if needed
441
+ if purpose is not None:
442
+ params["purpose"] = (
443
+ purpose.value if isinstance(purpose, FilePurpose) else purpose
444
+ )
445
+
446
+ # Create request and use the API requestor
447
+ requestor = api_requestor.APIRequestor(client=self._client)
448
+
449
+ response, _, _ = await requestor.arequest(
450
+ options=SeekrFlowRequest(
451
+ method="GET",
452
+ url="flow/files",
453
+ params=params,
454
+ ),
455
+ stream=False,
456
+ )
457
+
458
+ assert isinstance(response, SeekrFlowResponse)
459
+
460
+ return FileList.parse_obj(response.data)
461
+
462
+ async def rename(self, id: str, new_filename: str) -> FileResponse:
463
+ """
464
+ Rename a file asynchronously.
465
+
466
+ Args:
467
+ id (str): ID of the file to rename.
468
+ new_filename (str): New filename for the file.
469
+
470
+ Returns:
471
+ FileResponse: Object containing information about the renamed file.
472
+ """
342
473
  requestor = api_requestor.APIRequestor(
343
474
  client=self._client,
344
475
  )
345
476
 
346
477
  response, _, _ = await requestor.arequest(
347
478
  options=SeekrFlowRequest(
348
- method="GET",
349
- url="flow/files",
479
+ method="PUT",
480
+ url=f"flow/files/{id}/rename",
481
+ params={"new_filename": new_filename},
350
482
  ),
351
483
  stream=False,
352
484
  )
353
485
 
354
486
  assert isinstance(response, SeekrFlowResponse)
355
487
 
356
- return FileList(**response.data)
488
+ return FileResponse(**response.data)
seekrai/types/files.py CHANGED
@@ -14,8 +14,6 @@ class FilePurpose(str, Enum):
14
14
  FineTune = "fine-tune"
15
15
  PreTrain = "pre-train"
16
16
  Alignment = "alignment"
17
- Ingestion = "ingestion"
18
- VectorIngestion = "vector-ingestion"
19
17
 
20
18
 
21
19
  class TrainingFileType(str, Enum):
@@ -96,6 +94,7 @@ class FileResponse(BaseModel):
96
94
  # file byte size
97
95
  bytes: int | None = None
98
96
  created_by: str | None = None # TODO - fix this later
97
+ original_file_id: str | None = None
99
98
  deleted: bool | None = None
100
99
 
101
100
 
seekrai/types/vectordb.py CHANGED
@@ -69,6 +69,8 @@ class VectorDatabaseFileResponse(BaseModel):
69
69
  vector_database_id: str
70
70
  filename: str
71
71
  created_at: datetime
72
+ status: str
73
+ error_message: Optional[str]
72
74
 
73
75
 
74
76
  class VectorDatabaseFileList(BaseModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: seekrai
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: Python client for SeekrAI
5
5
  License: Apache-2.0
6
6
  Author: SeekrFlow
@@ -13,11 +13,11 @@ seekrai/resources/agents/agents.py,sha256=Cs184v2jYQRlk5MmsAH_hRI93D7qS6mJpuCLGI
13
13
  seekrai/resources/agents/threads.py,sha256=BwZ2_6wlezsb12PQjEw1fgdJh5S83SPgD6qZQoGvyIM,14544
14
14
  seekrai/resources/alignment.py,sha256=IOKlKK2I9_NhS9pwcrsd9-5OO7lVT8Uw0y_wuGHOnyA,5839
15
15
  seekrai/resources/chat/__init__.py,sha256=KmtPupgECtEN80NyvcnSmieTAFXhwmVxhMHP0qhspA4,618
16
- seekrai/resources/chat/completions.py,sha256=U75hKIDBAX8h5-4aFe20DowO1adqBD6ZRHjPK9EdqqM,11653
16
+ seekrai/resources/chat/completions.py,sha256=9KP1eiQ7uHuf8A4BPOKOKwgnsn6kkp2swT6Q5g_4xoI,11656
17
17
  seekrai/resources/completions.py,sha256=JhTN_lW2mblfHHONFmPC7QZei3wo5vx6GliMs9FkbOY,8452
18
18
  seekrai/resources/deployments.py,sha256=DY7IN7QgqDduCHGNuHENSVwrE5PXFL88jWgh8SES7Qk,5970
19
19
  seekrai/resources/embeddings.py,sha256=UMVb6LIJn8KFACMajVRL3SY88bbZl1aQ2Sx5MdT1sQQ,2593
20
- seekrai/resources/files.py,sha256=AJRTXbTxV3lYWML0eGFrhbBcGoFQFAQUA2Dc287E250,10875
20
+ seekrai/resources/files.py,sha256=bEn4jfYWfsI2OqKRGCUpnefIN-udNnafItgT2A7m-e4,15329
21
21
  seekrai/resources/finetune.py,sha256=Aw8lU9TohZdJGOstex12gg2t-RDppOponnWg203Bn-Q,11304
22
22
  seekrai/resources/images.py,sha256=VjZiU2cxq2uNrJzm-EwNpOW3rBIgFyRHss8_DF1OuVE,4799
23
23
  seekrai/resources/ingestion.py,sha256=tSJhX6kMzSdNxhHGBdzUKg9gsMP_aOFBz4EBoIFlGUM,4854
@@ -47,21 +47,21 @@ seekrai/types/completions.py,sha256=lm9AFdZR3Xg5AHPkV-qETHikkwMJmkHrLGr5GG-YR-M,
47
47
  seekrai/types/deployments.py,sha256=GdZPDaQgzmk9W1aXxZr9CDxqJRNv7NP0pNvqRV3E4xM,1760
48
48
  seekrai/types/embeddings.py,sha256=OANoLNOs0aceS8NppVvvcNYQbF7-pAOAmcr30pw64OU,749
49
49
  seekrai/types/error.py,sha256=uTKISs9aRC4_6zwirtNkanxepN8KY-SqCq0kNbfZylQ,370
50
- seekrai/types/files.py,sha256=aG8pTMiUJh11wpNqvJBHaDCfr45clcXBpSPa5Hv2V4Y,2737
50
+ seekrai/types/files.py,sha256=yjJYT8twY-cNh9AY9qlcN_moTeCfR0tJSSCQsOVB02Y,2708
51
51
  seekrai/types/finetune.py,sha256=e1TexW2PdNcRAGdHeNmRSWGKE2K9NLhbdcce0XYvWio,6162
52
52
  seekrai/types/images.py,sha256=Fusj8OhVYFsT8kz636lRGGivLbPXo_ZNgakKwmzJi3U,914
53
53
  seekrai/types/ingestion.py,sha256=uUdKOR4xqSfAXWQOR1UOltSlOnuyAwKVA1Q2a6Yslk8,919
54
54
  seekrai/types/models.py,sha256=9Z0nvLdlAfpF8mNRW5-IqBdDHoE-3qQ5przmIDJgwLo,1345
55
55
  seekrai/types/projects.py,sha256=JFgpZdovia8Orcnhp6QkIEAXzyPCfKT_bUiwjxUaHHQ,670
56
- seekrai/types/vectordb.py,sha256=JzVi6na1sHx0SfdNZp_1OKIKN9wO-0_iMoZHtcC-vJ8,2219
56
+ seekrai/types/vectordb.py,sha256=zWtB9OEfTpFf0hABko8WqhyZ0SH3os6ZRWXxkvg88-Q,2268
57
57
  seekrai/utils/__init__.py,sha256=dfbiYEc47EBVRkq6C4O9y6tTGuPuV3LbV3__v01Mbds,658
58
58
  seekrai/utils/_log.py,sha256=Cayw5B394H2WGVTXPXS2AN8znQdxsgrLqADXgqmokvU,1649
59
59
  seekrai/utils/api_helpers.py,sha256=0Y8BblNIr9h_R12zdmhkxgTlxgoRkbq84QNi4nNWGu8,2385
60
60
  seekrai/utils/files.py,sha256=7ixn_hgV-6pEhYqLyOp-EN0o8c1CzUwJzX9n3PQ5oqo,7164
61
61
  seekrai/utils/tools.py,sha256=jgJTL-dOIouDbEJLdQpQfpXhqaz_poQYS52adyUtBjo,1781
62
62
  seekrai/version.py,sha256=q6iGQVFor8zXiPP5F-3vy9TndOxKv5JXbaNJ2kdOQws,125
63
- seekrai-0.5.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
- seekrai-0.5.0.dist-info/METADATA,sha256=woZebLMxAmACmHj2a5FmVa-fvVgas0TJgBCVkG2PfZc,4748
65
- seekrai-0.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
66
- seekrai-0.5.0.dist-info/entry_points.txt,sha256=N49yOEGi1sK7Xr13F_rkkcOxQ88suyiMoOmRhUHTZ_U,48
67
- seekrai-0.5.0.dist-info/RECORD,,
63
+ seekrai-0.5.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
64
+ seekrai-0.5.1.dist-info/METADATA,sha256=WE8Hbfl-J_XWofa47b1BBFjItV4ny3t8AOBsG8zbwQw,4748
65
+ seekrai-0.5.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
66
+ seekrai-0.5.1.dist-info/entry_points.txt,sha256=N49yOEGi1sK7Xr13F_rkkcOxQ88suyiMoOmRhUHTZ_U,48
67
+ seekrai-0.5.1.dist-info/RECORD,,