seekrai 0.3.2__py3-none-any.whl → 0.3.3__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.
@@ -524,6 +524,8 @@ class APIRequestor:
524
524
  if rbody.strip().endswith("[DONE]"):
525
525
  # TODO
526
526
  rbody = rbody.replace("data: [DONE]", "")
527
+ if rbody.startswith("data: "):
528
+ rbody = rbody[len("data: ") :]
527
529
  data = json.loads(rbody)
528
530
  except (JSONDecodeError, UnicodeDecodeError) as e:
529
531
  raise error.APIError(
@@ -3,6 +3,8 @@ from typing import List
3
3
  from seekrai.abstract import api_requestor
4
4
  from seekrai.seekrflow_response import SeekrFlowResponse
5
5
  from seekrai.types import (
6
+ AlignmentEstimationRequest,
7
+ AlignmentEstimationResponse,
6
8
  AlignmentList,
7
9
  AlignmentRequest,
8
10
  AlignmentResponse,
@@ -92,6 +94,27 @@ class Alignment:
92
94
 
93
95
  return AlignmentResponse(**response.data)
94
96
 
97
+ def estimate(self, files: List[str]) -> AlignmentEstimationResponse:
98
+ requestor = api_requestor.APIRequestor(
99
+ client=self._client,
100
+ )
101
+
102
+ parameter_payload = AlignmentEstimationRequest(
103
+ files=files,
104
+ ).model_dump()
105
+
106
+ response, _, _ = requestor.request(
107
+ options=SeekrFlowRequest(
108
+ method="POST",
109
+ url="flow/alignment/estimate",
110
+ params=parameter_payload,
111
+ ),
112
+ stream=False,
113
+ )
114
+
115
+ assert isinstance(response, SeekrFlowResponse)
116
+ return AlignmentEstimationResponse(**response.data)
117
+
95
118
 
96
119
  class AsyncAlignment:
97
120
  def __init__(self, client: SeekrFlowClient) -> None:
@@ -173,3 +196,24 @@ class AsyncAlignment:
173
196
  assert isinstance(response, SeekrFlowResponse)
174
197
 
175
198
  return AlignmentResponse(**response.data)
199
+
200
+ async def estimate(self, files: List[str]) -> AlignmentEstimationResponse:
201
+ requestor = api_requestor.APIRequestor(
202
+ client=self._client,
203
+ )
204
+
205
+ parameter_payload = AlignmentEstimationRequest(
206
+ files=files,
207
+ ).model_dump()
208
+
209
+ response, _, _ = await requestor.arequest(
210
+ options=SeekrFlowRequest(
211
+ method="POST",
212
+ url="flow/alignment/estimate",
213
+ params=parameter_payload,
214
+ ),
215
+ stream=False,
216
+ )
217
+
218
+ assert isinstance(response, SeekrFlowResponse)
219
+ return AlignmentEstimationResponse(**response.data)
@@ -30,13 +30,13 @@ class ChatCompletions:
30
30
  repetition_penalty: float = 1,
31
31
  stream: bool = False,
32
32
  logprobs: bool | None = False,
33
- top_logprobs: int | None = 0,
33
+ top_logprobs: int | None = None,
34
34
  echo: bool = False,
35
35
  n: int = 1,
36
36
  safety_model: str | None = None,
37
37
  response_format: Dict[str, str | Dict[str, Any]] | None = None,
38
- tools: Dict[str, str | Dict[str, Any]] | None = None,
39
- tool_choice: str | Dict[str, str | Dict[str, str]] | None = None,
38
+ tools: Dict[str, str | Dict[str, Any]] | None = [],
39
+ tool_choice: str | Dict[str, str | Dict[str, str]] | None = "auto",
40
40
  ) -> ChatCompletionResponse | Iterator[ChatCompletionChunk]:
41
41
  """
42
42
  Method to generate completions based on a given prompt using a specified model.
seekrai/types/__init__.py CHANGED
@@ -1,5 +1,7 @@
1
1
  from seekrai.types.abstract import SeekrFlowClient
2
2
  from seekrai.types.alignment import (
3
+ AlignmentEstimationRequest,
4
+ AlignmentEstimationResponse,
3
5
  AlignmentJobStatus,
4
6
  AlignmentList,
5
7
  AlignmentRequest,
@@ -87,6 +89,8 @@ __all__ = [
87
89
  "ModelResponse",
88
90
  "ModelList",
89
91
  "AlignmentRequest",
92
+ "AlignmentEstimationRequest",
93
+ "AlignmentEstimationResponse",
90
94
  "AlignmentResponse",
91
95
  "AlignmentJobStatus",
92
96
  "AlignmentList",
@@ -18,6 +18,24 @@ class AlignmentRequest(BaseModel):
18
18
  )
19
19
 
20
20
 
21
+ class AlignmentEstimationRequest(BaseModel):
22
+ files: List[str] = Field(
23
+ default=...,
24
+ description="List of file ids to use to generate an alignment estiamte",
25
+ )
26
+
27
+
28
+ class AlignmentEstimationResponse(BaseModel):
29
+ input_tokens: int = Field(
30
+ default=...,
31
+ description="Estimated number of input tokens for the given files",
32
+ )
33
+ output_tokens: int = Field(
34
+ default=...,
35
+ description="Estimated number of output tokens for the given files",
36
+ )
37
+
38
+
21
39
  class AlignmentJobStatus(str, Enum):
22
40
  STATUS_PENDING = "pending"
23
41
  STATUS_QUEUED = "queued"
seekrai/types/finetune.py CHANGED
@@ -172,6 +172,7 @@ class FinetuneResponse(BaseModel):
172
172
  inference_available: bool = False
173
173
  project_id: Optional[int] = None # TODO - fix this
174
174
  completed_at: datetime | None = None
175
+ description: str | None = None
175
176
 
176
177
  # dataset token count
177
178
  # TODO
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seekrai
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Python client for SeekrAI
5
5
  Home-page: https://gitlab.cb.ntent.com/ml/seekr-py
6
6
  License: Apache-2.0
@@ -1,14 +1,14 @@
1
1
  seekrai/__init__.py,sha256=HC6iy-IdwqecabH-6a80Lsy9qO2PBToAI0WqEErV41c,935
2
2
  seekrai/abstract/__init__.py,sha256=wNiOTW9TJpUgfCJCG-wAbhhWWH2PtoVpAuL3nxvQGps,56
3
- seekrai/abstract/api_requestor.py,sha256=tI43JdbUfNQHWjvRrenUM7C7Ea-zD-7yd2JNS-Lki04,18297
3
+ seekrai/abstract/api_requestor.py,sha256=NT41M0_Utfw61bMqibP1PEdIIQmmKWfzj-Y-xk4DNY0,18395
4
4
  seekrai/client.py,sha256=Yhejl-2a-Uoc8nWi-XxETZT4a4Ou_t_TRLcp0e9APIY,5376
5
5
  seekrai/constants.py,sha256=hoR2iF5te5Ydjt_lxIOSGID4vESIakG4F-3xAWdwxaU,1854
6
6
  seekrai/error.py,sha256=rAYL8qEd8INwYMMKvhS-HKeC3QkWL4Wq-zfazFU-zBg,4861
7
7
  seekrai/filemanager.py,sha256=8RuSzJvELD-fCI2Wd_t0jSKeVrmFwF7E5AzXIgDFxNA,9572
8
8
  seekrai/resources/__init__.py,sha256=-OpvrZp0c_ro_e1G14gjOILtcSfpSOeRZeK8kt41WLo,1014
9
- seekrai/resources/alignment.py,sha256=6qQm9w0Em0q3zVeOzs8cX3wulr-B-wh4Pcr3pboIeTE,4468
9
+ seekrai/resources/alignment.py,sha256=U2wMIg45Bo_EAuThn_YotPCHIS_3smHyAf3EhdyPovM,5826
10
10
  seekrai/resources/chat/__init__.py,sha256=KmtPupgECtEN80NyvcnSmieTAFXhwmVxhMHP0qhspA4,618
11
- seekrai/resources/chat/completions.py,sha256=pGBVrIvUfY-wr0ooiywzuhIjZ4GwiojH3ofmRE6bYlw,11643
11
+ seekrai/resources/chat/completions.py,sha256=v_gaeryfOCPL_vR0ysGEvSejai2dNdLcZh2gC6567rk,11646
12
12
  seekrai/resources/completions.py,sha256=w3La3zPMlN00y-b-tJwLgvZVH-xK_dKC6ktI5Ggn1us,8564
13
13
  seekrai/resources/deployments.py,sha256=HmP7MuxAlLUoQl6z705_d1Y53MDvGgSQXhlgN3DKX2A,6078
14
14
  seekrai/resources/embeddings.py,sha256=3lohUrkdFqzSg8FgS7p4r87jwjE0NXU1PilWv278quk,2705
@@ -18,9 +18,9 @@ seekrai/resources/images.py,sha256=E48lAe7YsZ2WXBHR_qz4SF7P4Y-U7t61m_bWNS91pM0,4
18
18
  seekrai/resources/models.py,sha256=Pdd0S0gZdratWcHJPKNb7LkEdUGjr3xNR06W6GDiyxk,5000
19
19
  seekrai/resources/projects.py,sha256=AWJUeUDSzkbxBksHjJ4a3c83UR62TlMGHutm2NdV6Xk,3790
20
20
  seekrai/seekrflow_response.py,sha256=5RFEQzamDy7sTSDkxSsZQThZ3biNmeCPeHWdrFId5Go,1320
21
- seekrai/types/__init__.py,sha256=E41__vAq-tnm5aVYW0Ef1Ky-GMPnMpUKlyLr3pYhLSM,2358
21
+ seekrai/types/__init__.py,sha256=XJ8lP4XDGL5mr1SbKJFFeponmlCRNp1HrvxscoxfRlU,2492
22
22
  seekrai/types/abstract.py,sha256=TqWFQV_6bPblywfCH-r8FCkXWvPkc9KlJ4QVgyrnaMc,642
23
- seekrai/types/alignment.py,sha256=-lxF0Cyj3w4brMft8WAoc2EDMAlbX7zdRYD04ot98-Y,1129
23
+ seekrai/types/alignment.py,sha256=P4HZbmFjgtZkWsj6-ZjZ1v-FZkHusEaIEiRWREla-wA,1632
24
24
  seekrai/types/chat_completions.py,sha256=xRTHBbDJDbz0HgW042WX3csQDolhjEuO81w0rzFSeBU,3691
25
25
  seekrai/types/common.py,sha256=OH3l3u-0_5oz1KYrcHMybFESzivDySocYlJAsLSLOWU,1940
26
26
  seekrai/types/completions.py,sha256=lm9AFdZR3Xg5AHPkV-qETHikkwMJmkHrLGr5GG-YR-M,2171
@@ -28,7 +28,7 @@ seekrai/types/deployments.py,sha256=n7_t7DEeBSC8cDJSjIfvWtcgUql1DaEn89zuGYN_RaI,
28
28
  seekrai/types/embeddings.py,sha256=OANoLNOs0aceS8NppVvvcNYQbF7-pAOAmcr30pw64OU,749
29
29
  seekrai/types/error.py,sha256=uTKISs9aRC4_6zwirtNkanxepN8KY-SqCq0kNbfZylQ,370
30
30
  seekrai/types/files.py,sha256=XmtiM6d9i3tnYS-Kii3QpxZJRqemJi2rvLJ32GsECXQ,2602
31
- seekrai/types/finetune.py,sha256=Izh7NfaW7pGzSN5GpWYSaZpkHV2TilE1CF62DrB8vE0,6089
31
+ seekrai/types/finetune.py,sha256=VNuAZx-Lq4Q55hY47obWnFLDr9if93v5Lwr_qcyCtfU,6124
32
32
  seekrai/types/images.py,sha256=Fusj8OhVYFsT8kz636lRGGivLbPXo_ZNgakKwmzJi3U,914
33
33
  seekrai/types/models.py,sha256=1ZfW9WwayApkISRizDntjkWhYNv-wkbrRVIfHn2QuC4,1242
34
34
  seekrai/types/projects.py,sha256=JFgpZdovia8Orcnhp6QkIEAXzyPCfKT_bUiwjxUaHHQ,670
@@ -38,8 +38,8 @@ seekrai/utils/api_helpers.py,sha256=0Y8BblNIr9h_R12zdmhkxgTlxgoRkbq84QNi4nNWGu8,
38
38
  seekrai/utils/files.py,sha256=B61Pwra49MVVWjPtdkx4hBtAuUe9UI63hdNus87Uq0o,7164
39
39
  seekrai/utils/tools.py,sha256=jgJTL-dOIouDbEJLdQpQfpXhqaz_poQYS52adyUtBjo,1781
40
40
  seekrai/version.py,sha256=q6iGQVFor8zXiPP5F-3vy9TndOxKv5JXbaNJ2kdOQws,125
41
- seekrai-0.3.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
42
- seekrai-0.3.2.dist-info/METADATA,sha256=M1kwCRaiObFvV3IpKSYII0kx3_FqGyPRZ8tU1ukz3e8,4748
43
- seekrai-0.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
44
- seekrai-0.3.2.dist-info/entry_points.txt,sha256=N49yOEGi1sK7Xr13F_rkkcOxQ88suyiMoOmRhUHTZ_U,48
45
- seekrai-0.3.2.dist-info/RECORD,,
41
+ seekrai-0.3.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
42
+ seekrai-0.3.3.dist-info/METADATA,sha256=avqvw86pT87l1EEYJHqURviZ_IMmWWYVViRcBQxojOE,4748
43
+ seekrai-0.3.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
44
+ seekrai-0.3.3.dist-info/entry_points.txt,sha256=N49yOEGi1sK7Xr13F_rkkcOxQ88suyiMoOmRhUHTZ_U,48
45
+ seekrai-0.3.3.dist-info/RECORD,,