seekrai 0.3.1__tar.gz → 0.3.3__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.
- {seekrai-0.3.1 → seekrai-0.3.3}/PKG-INFO +1 -1
- {seekrai-0.3.1 → seekrai-0.3.3}/pyproject.toml +2 -1
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/abstract/api_requestor.py +2 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/alignment.py +44 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/chat/completions.py +3 -3
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/finetune.py +1 -1
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/__init__.py +4 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/alignment.py +18 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/finetune.py +1 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/LICENSE +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/README.md +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/__init__.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/abstract/__init__.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/client.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/constants.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/error.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/filemanager.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/__init__.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/chat/__init__.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/completions.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/deployments.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/embeddings.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/files.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/images.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/models.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/resources/projects.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/seekrflow_response.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/abstract.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/chat_completions.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/common.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/completions.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/deployments.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/embeddings.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/error.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/files.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/images.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/models.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/types/projects.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/utils/__init__.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/utils/_log.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/utils/api_helpers.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/utils/files.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/utils/tools.py +0 -0
- {seekrai-0.3.1 → seekrai-0.3.3}/src/seekrai/version.py +0 -0
|
@@ -14,7 +14,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
14
14
|
|
|
15
15
|
[tool.poetry]
|
|
16
16
|
name = "seekrai"
|
|
17
|
-
version = "0.3.
|
|
17
|
+
version = "0.3.3"
|
|
18
18
|
authors = [
|
|
19
19
|
"SeekrFlow <support@seekr.com>"
|
|
20
20
|
]
|
|
@@ -73,6 +73,7 @@ tox = "^4.14.1"
|
|
|
73
73
|
[tool.poetry.group.dev.dependencies]
|
|
74
74
|
ipdb = "^0.13.13"
|
|
75
75
|
pre-commit = "^3.7.1"
|
|
76
|
+
jupyter = "^1.0.0"
|
|
76
77
|
|
|
77
78
|
[tool.poetry.urls]
|
|
78
79
|
"Homepage" = "https://www.seekr.com/"
|
|
@@ -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 =
|
|
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 =
|
|
39
|
-
tool_choice: str | Dict[str, str | Dict[str, str]] | 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.
|
|
@@ -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"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|