seekrai 0.3.3__py3-none-any.whl → 0.4.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.
seekrai/filemanager.py CHANGED
@@ -91,10 +91,9 @@ def _prepare_output(
91
91
 
92
92
  content_type = str(headers.get("content-type"))
93
93
 
94
- assert remote_name, (
95
- "No model name found in fine_tune object. "
96
- "Please specify an `output` file name."
97
- )
94
+ assert (
95
+ remote_name
96
+ ), "No model name found in fine_tune object. Please specify an `output` file name."
98
97
 
99
98
  if step > 0:
100
99
  remote_name += f"-checkpoint-{step}"
@@ -8,6 +8,7 @@ from seekrai.types import (
8
8
  AlignmentList,
9
9
  AlignmentRequest,
10
10
  AlignmentResponse,
11
+ AlignmentType,
11
12
  SeekrFlowClient,
12
13
  SeekrFlowRequest,
13
14
  )
@@ -21,14 +22,14 @@ class Alignment:
21
22
  self,
22
23
  instructions: str,
23
24
  files: List[str],
25
+ type: AlignmentType = AlignmentType.PRINCIPLE,
24
26
  ) -> AlignmentResponse:
25
27
  requestor = api_requestor.APIRequestor(
26
28
  client=self._client,
27
29
  )
28
30
 
29
31
  parameter_payload = AlignmentRequest(
30
- instructions=instructions,
31
- files=files,
32
+ instructions=instructions, files=files, type=type
32
33
  ).model_dump()
33
34
 
34
35
  response, _, _ = requestor.request(
@@ -124,14 +125,14 @@ class AsyncAlignment:
124
125
  self,
125
126
  instructions: str,
126
127
  files: List[str],
128
+ type: AlignmentType = AlignmentType.PRINCIPLE,
127
129
  ) -> AlignmentResponse:
128
130
  requestor = api_requestor.APIRequestor(
129
131
  client=self._client,
130
132
  )
131
133
 
132
134
  parameter_payload = AlignmentRequest(
133
- instructions=instructions,
134
- files=files,
135
+ instructions=instructions, files=files, type=type
135
136
  ).model_dump()
136
137
 
137
138
  response, _, _ = await requestor.arequest(
@@ -35,7 +35,7 @@ class ChatCompletions:
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 = [],
38
+ tools: Dict[str, str | Dict[str, Any]] | None = None,
39
39
  tool_choice: str | Dict[str, str | Dict[str, str]] | None = "auto",
40
40
  ) -> ChatCompletionResponse | Iterator[ChatCompletionChunk]:
41
41
  """
@@ -89,7 +89,6 @@ class ChatCompletions:
89
89
  ChatCompletionResponse | Iterator[ChatCompletionChunk]: Object containing the completions
90
90
  or an iterator over completion chunks.
91
91
  """
92
-
93
92
  requestor = api_requestor.APIRequestor(
94
93
  client=self._client,
95
94
  )
@@ -110,7 +109,7 @@ class ChatCompletions:
110
109
  n=n,
111
110
  safety_model=safety_model,
112
111
  response_format=response_format,
113
- tools=tools,
112
+ tools=tools or [],
114
113
  tool_choice=tool_choice,
115
114
  ).model_dump()
116
115
 
seekrai/types/__init__.py CHANGED
@@ -6,6 +6,7 @@ from seekrai.types.alignment import (
6
6
  AlignmentList,
7
7
  AlignmentRequest,
8
8
  AlignmentResponse,
9
+ AlignmentType,
9
10
  )
10
11
  from seekrai.types.chat_completions import (
11
12
  ChatCompletionChunk,
@@ -94,6 +95,7 @@ __all__ = [
94
95
  "AlignmentResponse",
95
96
  "AlignmentJobStatus",
96
97
  "AlignmentList",
98
+ "AlignmentType",
97
99
  "Project",
98
100
  "ProjectWithRuns",
99
101
  "GetProjectsResponse",
@@ -9,6 +9,12 @@ from pydantic import Field
9
9
  from seekrai.types.abstract import BaseModel
10
10
 
11
11
 
12
+ class AlignmentType(str, Enum):
13
+ PRINCIPLE = "principle"
14
+ CHAIN_OF_THOUGHT = "chain_of_thought"
15
+ RAFT = "raft"
16
+
17
+
12
18
  class AlignmentRequest(BaseModel):
13
19
  instructions: str = Field(
14
20
  default=..., description="Task description/instructions for the alignment task"
@@ -16,12 +22,16 @@ class AlignmentRequest(BaseModel):
16
22
  files: List[str] = Field(
17
23
  default=..., description="List of file ids to use for alignment"
18
24
  )
25
+ type: AlignmentType = Field(
26
+ default=AlignmentType.PRINCIPLE,
27
+ description="Type of alignment task (principle, chain_of_thought, or raft)",
28
+ )
19
29
 
20
30
 
21
31
  class AlignmentEstimationRequest(BaseModel):
22
32
  files: List[str] = Field(
23
33
  default=...,
24
- description="List of file ids to use to generate an alignment estiamte",
34
+ description="List of file ids to use to generate an alignment estimate",
25
35
  )
26
36
 
27
37
 
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class IngestionJobStatus(Enum):
5
+ QUEUED = "queued"
6
+ RUNNING = "running"
7
+ COMPLETED = "completed"
8
+ FAILED = "failed"
seekrai/utils/files.py CHANGED
@@ -47,7 +47,7 @@ def check_file(
47
47
 
48
48
  if file_size > MAX_FILE_SIZE_GB * NUM_BYTES_IN_GB:
49
49
  report_dict["message"] = (
50
- f"Maximum supported file size is {MAX_FILE_SIZE_GB} GB. Found file with size of {round(file_size / NUM_BYTES_IN_GB ,3)} GB."
50
+ f"Maximum supported file size is {MAX_FILE_SIZE_GB} GB. Found file with size of {round(file_size / NUM_BYTES_IN_GB, 3)} GB."
51
51
  )
52
52
  report_dict["is_check_passed"] = False
53
53
  elif file_size == 0:
@@ -117,7 +117,7 @@ def _check_jsonl(file: Path) -> Dict[str, Any]:
117
117
  report_dict["key_value"] = False
118
118
  report_dict["message"] = (
119
119
  f'Invalid value type for "text" key on line {idx + 1}. '
120
- f'Expected string. Found {type(json_line["text"])}.'
120
+ f"Expected string. Found {type(json_line['text'])}."
121
121
  )
122
122
 
123
123
  report_dict["is_check_passed"] = False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: seekrai
3
- Version: 0.3.3
3
+ Version: 0.4.1
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
@@ -4,11 +4,11 @@ seekrai/abstract/api_requestor.py,sha256=NT41M0_Utfw61bMqibP1PEdIIQmmKWfzj-Y-xk4
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
- seekrai/filemanager.py,sha256=8RuSzJvELD-fCI2Wd_t0jSKeVrmFwF7E5AzXIgDFxNA,9572
7
+ seekrai/filemanager.py,sha256=5tl7fjsLbNy-U1Ko_5iQSdkZ0Bca_bhvR9FhWpaG8FA,9561
8
8
  seekrai/resources/__init__.py,sha256=-OpvrZp0c_ro_e1G14gjOILtcSfpSOeRZeK8kt41WLo,1014
9
- seekrai/resources/alignment.py,sha256=U2wMIg45Bo_EAuThn_YotPCHIS_3smHyAf3EhdyPovM,5826
9
+ seekrai/resources/alignment.py,sha256=MMrADpXNZa0eQ-jqfLcP7-fisJXgpRl-03GPdkjkTcc,5951
10
10
  seekrai/resources/chat/__init__.py,sha256=KmtPupgECtEN80NyvcnSmieTAFXhwmVxhMHP0qhspA4,618
11
- seekrai/resources/chat/completions.py,sha256=v_gaeryfOCPL_vR0ysGEvSejai2dNdLcZh2gC6567rk,11646
11
+ seekrai/resources/chat/completions.py,sha256=U75hKIDBAX8h5-4aFe20DowO1adqBD6ZRHjPK9EdqqM,11653
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=XJ8lP4XDGL5mr1SbKJFFeponmlCRNp1HrvxscoxfRlU,2492
21
+ seekrai/types/__init__.py,sha256=34IvdhaeKDNqA03G0nwta8sptpURzbXeTlqr6mhagnw,2532
22
22
  seekrai/types/abstract.py,sha256=TqWFQV_6bPblywfCH-r8FCkXWvPkc9KlJ4QVgyrnaMc,642
23
- seekrai/types/alignment.py,sha256=P4HZbmFjgtZkWsj6-ZjZ1v-FZkHusEaIEiRWREla-wA,1632
23
+ seekrai/types/alignment.py,sha256=H9rAYsr4rg7uZCgl2tDZjkeq-b_Ov27gljejH8fC26w,1919
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
@@ -30,16 +30,17 @@ seekrai/types/error.py,sha256=uTKISs9aRC4_6zwirtNkanxepN8KY-SqCq0kNbfZylQ,370
30
30
  seekrai/types/files.py,sha256=XmtiM6d9i3tnYS-Kii3QpxZJRqemJi2rvLJ32GsECXQ,2602
31
31
  seekrai/types/finetune.py,sha256=VNuAZx-Lq4Q55hY47obWnFLDr9if93v5Lwr_qcyCtfU,6124
32
32
  seekrai/types/images.py,sha256=Fusj8OhVYFsT8kz636lRGGivLbPXo_ZNgakKwmzJi3U,914
33
+ seekrai/types/ingestion.py,sha256=GqDzPjEA_rtiiDKpEmTOXOitZSSKG-JkH1siII5m8oA,152
33
34
  seekrai/types/models.py,sha256=1ZfW9WwayApkISRizDntjkWhYNv-wkbrRVIfHn2QuC4,1242
34
35
  seekrai/types/projects.py,sha256=JFgpZdovia8Orcnhp6QkIEAXzyPCfKT_bUiwjxUaHHQ,670
35
36
  seekrai/utils/__init__.py,sha256=dfbiYEc47EBVRkq6C4O9y6tTGuPuV3LbV3__v01Mbds,658
36
37
  seekrai/utils/_log.py,sha256=Cayw5B394H2WGVTXPXS2AN8znQdxsgrLqADXgqmokvU,1649
37
38
  seekrai/utils/api_helpers.py,sha256=0Y8BblNIr9h_R12zdmhkxgTlxgoRkbq84QNi4nNWGu8,2385
38
- seekrai/utils/files.py,sha256=B61Pwra49MVVWjPtdkx4hBtAuUe9UI63hdNus87Uq0o,7164
39
+ seekrai/utils/files.py,sha256=7ixn_hgV-6pEhYqLyOp-EN0o8c1CzUwJzX9n3PQ5oqo,7164
39
40
  seekrai/utils/tools.py,sha256=jgJTL-dOIouDbEJLdQpQfpXhqaz_poQYS52adyUtBjo,1781
40
41
  seekrai/version.py,sha256=q6iGQVFor8zXiPP5F-3vy9TndOxKv5JXbaNJ2kdOQws,125
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,,
42
+ seekrai-0.4.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
43
+ seekrai-0.4.1.dist-info/METADATA,sha256=28ojGXBP-65YoZv0VfwQ__mN76eC_I53aSso7caRz_E,4748
44
+ seekrai-0.4.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
45
+ seekrai-0.4.1.dist-info/entry_points.txt,sha256=N49yOEGi1sK7Xr13F_rkkcOxQ88suyiMoOmRhUHTZ_U,48
46
+ seekrai-0.4.1.dist-info/RECORD,,