seekrai 0.5.2__tar.gz → 0.5.5__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.5.2 → seekrai-0.5.5}/PKG-INFO +2 -2
- {seekrai-0.5.2 → seekrai-0.5.5}/pyproject.toml +2 -2
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/abstract/response_parsing.py +2 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/__init__.py +3 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/agents/agent_inference.py +10 -8
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/chat/completions.py +11 -2
- seekrai-0.5.5/src/seekrai/resources/explainability.py +84 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/__init__.py +4 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/__init__.py +4 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/agent.py +7 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/runs.py +17 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/schemas/file_search_env.py +0 -1
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/chat_completions.py +1 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/deployments.py +1 -0
- seekrai-0.5.5/src/seekrai/types/explainability.py +57 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/finetune.py +9 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/LICENSE +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/README.md +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/abstract/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/abstract/api_requestor.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/client.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/constants.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/error.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/filemanager.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/agents/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/agents/agents.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/agents/threads.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/alignment.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/chat/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/completions.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/deployments.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/embeddings.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/files.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/finetune.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/images.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/ingestion.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/models.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/projects.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/resource_base.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/resources/vectordb.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/seekrflow_response.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/abstract.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/threads.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/env_model_config.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/schemas/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/schemas/file_search.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/tool.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/tool_env_types.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/agents/tools/tool_types.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/alignment.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/common.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/completions.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/embeddings.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/error.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/files.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/images.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/ingestion.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/models.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/projects.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/types/vectordb.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/utils/__init__.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/utils/_log.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/utils/api_helpers.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/utils/files.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/utils/tools.py +0 -0
- {seekrai-0.5.2 → seekrai-0.5.5}/src/seekrai/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: seekrai
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.5
|
|
4
4
|
Summary: Python client for SeekrAI
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Author: SeekrFlow
|
|
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
17
17
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
18
18
|
Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
|
|
19
19
|
Requires-Dist: filelock (>=3.13.1,<4.0.0)
|
|
20
|
-
Requires-Dist: httpx[http2] (>=0.
|
|
20
|
+
Requires-Dist: httpx[http2] (>=0.28.0,<0.29.0)
|
|
21
21
|
Requires-Dist: numpy (>=1.23.5) ; python_version < "3.12"
|
|
22
22
|
Requires-Dist: numpy (>=1.26.0) ; python_version >= "3.12"
|
|
23
23
|
Requires-Dist: pillow (>=10.3.0,<11.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.5.
|
|
17
|
+
version = "0.5.5"
|
|
18
18
|
authors = [
|
|
19
19
|
"SeekrFlow <support@seekr.com>"
|
|
20
20
|
]
|
|
@@ -46,7 +46,7 @@ numpy = [
|
|
|
46
46
|
{ version = ">=1.23.5", python = "<3.12" },
|
|
47
47
|
{ version = ">=1.26.0", python = ">=3.12" },
|
|
48
48
|
]
|
|
49
|
-
httpx = {extras = ["http2"], version = "^0.
|
|
49
|
+
httpx = {extras = ["http2"], version = "^0.28.0"}
|
|
50
50
|
|
|
51
51
|
[tool.poetry.group.quality]
|
|
52
52
|
optional = true
|
|
@@ -4,6 +4,7 @@ from seekrai.resources.chat import AsyncChat, Chat
|
|
|
4
4
|
from seekrai.resources.completions import AsyncCompletions, Completions
|
|
5
5
|
from seekrai.resources.deployments import AsyncDeployments, Deployments
|
|
6
6
|
from seekrai.resources.embeddings import AsyncEmbeddings, Embeddings
|
|
7
|
+
from seekrai.resources.explainability import AsyncExplainability, Explainability
|
|
7
8
|
from seekrai.resources.files import AsyncFiles, Files
|
|
8
9
|
from seekrai.resources.finetune import AsyncFineTuning, FineTuning
|
|
9
10
|
from seekrai.resources.images import AsyncImages, Images
|
|
@@ -41,4 +42,6 @@ __all__ = [
|
|
|
41
42
|
"VectorDatabase",
|
|
42
43
|
"AsyncVectorDatabase",
|
|
43
44
|
"AgentInference",
|
|
45
|
+
"AsyncExplainability",
|
|
46
|
+
"Explainability",
|
|
44
47
|
]
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from typing import Any, AsyncGenerator, Iterator, Union
|
|
1
|
+
from typing import Any, AsyncGenerator, Iterator, Optional, Union
|
|
2
2
|
|
|
3
3
|
from seekrai.abstract import api_requestor
|
|
4
4
|
from seekrai.seekrflow_response import SeekrFlowResponse
|
|
5
|
-
from seekrai.types import Run, RunRequest, RunResponse, SeekrFlowRequest
|
|
5
|
+
from seekrai.types import ModelSettings, Run, RunRequest, RunResponse, SeekrFlowRequest
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class AgentInference:
|
|
@@ -16,7 +16,7 @@ class AgentInference:
|
|
|
16
16
|
thread_id: str,
|
|
17
17
|
*,
|
|
18
18
|
stream: bool = False,
|
|
19
|
-
|
|
19
|
+
model_settings: Optional[ModelSettings] = None,
|
|
20
20
|
) -> Union[RunResponse, Iterator[Any]]:
|
|
21
21
|
"""
|
|
22
22
|
Run an inference call on a deployed agent.
|
|
@@ -25,13 +25,14 @@ class AgentInference:
|
|
|
25
25
|
agent_id (str): The unique identifier of the deployed agent.
|
|
26
26
|
thread_id (str): A thread identifier.
|
|
27
27
|
stream (bool, optional): Whether to stream the response. Defaults to False.
|
|
28
|
-
|
|
28
|
+
model_settings (optional): Additional parameters (such as temperature, max_tokens, etc).
|
|
29
29
|
|
|
30
30
|
Returns:
|
|
31
31
|
A dictionary with the response (if non-streaming) or an iterator over response chunks.
|
|
32
32
|
"""
|
|
33
33
|
payload = RunRequest(agent_id=agent_id).model_dump()
|
|
34
|
-
|
|
34
|
+
if model_settings is not None:
|
|
35
|
+
payload["model_settings"] = model_settings.model_dump()
|
|
35
36
|
endpoint = f"threads/{thread_id}/runs"
|
|
36
37
|
if stream:
|
|
37
38
|
endpoint += "/stream"
|
|
@@ -146,7 +147,7 @@ class AsyncAgentInference:
|
|
|
146
147
|
thread_id: str,
|
|
147
148
|
*,
|
|
148
149
|
stream: bool = False,
|
|
149
|
-
|
|
150
|
+
model_settings: Optional[ModelSettings] = None,
|
|
150
151
|
) -> Union[RunResponse, AsyncGenerator[Any, None]]:
|
|
151
152
|
"""
|
|
152
153
|
Run an inference call on a deployed agent.
|
|
@@ -155,13 +156,14 @@ class AsyncAgentInference:
|
|
|
155
156
|
agent_id (str): The unique identifier of the deployed agent.
|
|
156
157
|
thread_id (str): A thread identifier.
|
|
157
158
|
stream (bool, optional): Whether to stream the response. Defaults to False.
|
|
158
|
-
|
|
159
|
+
model_settings (optional): Additional parameters (such as temperature, max_tokens, etc).
|
|
159
160
|
|
|
160
161
|
Returns:
|
|
161
162
|
A dictionary with the response (if non-streaming) or an iterator over response chunks.
|
|
162
163
|
"""
|
|
163
164
|
payload = RunRequest(agent_id=agent_id).model_dump()
|
|
164
|
-
|
|
165
|
+
if model_settings is not None:
|
|
166
|
+
payload["model_settings"] = model_settings.model_dump()
|
|
165
167
|
endpoint = f"threads/{thread_id}/runs"
|
|
166
168
|
if stream:
|
|
167
169
|
endpoint += "/stream"
|
|
@@ -22,6 +22,7 @@ class ChatCompletions:
|
|
|
22
22
|
*,
|
|
23
23
|
messages: List[Dict[str, str]],
|
|
24
24
|
model: str,
|
|
25
|
+
max_completion_tokens: int | None = None,
|
|
25
26
|
max_tokens: int | None = 512,
|
|
26
27
|
stop: List[str] | None = None,
|
|
27
28
|
temperature: float = 0.7,
|
|
@@ -36,7 +37,7 @@ class ChatCompletions:
|
|
|
36
37
|
safety_model: str | None = None,
|
|
37
38
|
response_format: Dict[str, str | Dict[str, Any]] | None = None,
|
|
38
39
|
tools: Dict[str, str | Dict[str, Any]] | None = None,
|
|
39
|
-
tool_choice: str | Dict[str, str | Dict[str, str]] | None =
|
|
40
|
+
tool_choice: str | Dict[str, str | Dict[str, str]] | None = None,
|
|
40
41
|
) -> ChatCompletionResponse | Iterator[ChatCompletionChunk]:
|
|
41
42
|
"""
|
|
42
43
|
Method to generate completions based on a given prompt using a specified model.
|
|
@@ -45,6 +46,7 @@ class ChatCompletions:
|
|
|
45
46
|
messages (List[Dict[str, str]]): A list of messages in the format
|
|
46
47
|
`[{"role": seekrai.types.chat_completions.MessageRole, "content": TEXT}, ...]`
|
|
47
48
|
model (str): The name of the model to query.
|
|
49
|
+
max_completion_tokens (int, optional): The maximum number of tokens the output can contain.
|
|
48
50
|
max_tokens (int, optional): The maximum number of tokens to generate.
|
|
49
51
|
Defaults to 512.
|
|
50
52
|
stop (List[str], optional): List of strings at which to stop generation.
|
|
@@ -99,6 +101,7 @@ class ChatCompletions:
|
|
|
99
101
|
top_p=top_p,
|
|
100
102
|
top_k=top_k,
|
|
101
103
|
temperature=temperature,
|
|
104
|
+
max_completion_tokens=max_completion_tokens,
|
|
102
105
|
max_tokens=max_tokens,
|
|
103
106
|
stop=stop,
|
|
104
107
|
repetition_penalty=repetition_penalty,
|
|
@@ -110,14 +113,16 @@ class ChatCompletions:
|
|
|
110
113
|
safety_model=safety_model,
|
|
111
114
|
response_format=response_format,
|
|
112
115
|
tools=tools or [],
|
|
113
|
-
tool_choice=tool_choice,
|
|
114
116
|
).model_dump()
|
|
117
|
+
if tool_choice is not None:
|
|
118
|
+
parameter_payload["tool_choice"] = tool_choice
|
|
115
119
|
|
|
116
120
|
response, _, _ = requestor.request(
|
|
117
121
|
options=SeekrFlowRequest(
|
|
118
122
|
method="POST",
|
|
119
123
|
url="inference/chat/completions",
|
|
120
124
|
params=parameter_payload,
|
|
125
|
+
headers={"content-type": "application/json"},
|
|
121
126
|
),
|
|
122
127
|
stream=stream,
|
|
123
128
|
)
|
|
@@ -139,6 +144,7 @@ class AsyncChatCompletions:
|
|
|
139
144
|
*,
|
|
140
145
|
messages: List[Dict[str, str]],
|
|
141
146
|
model: str,
|
|
147
|
+
max_completion_tokens: int | None = None,
|
|
142
148
|
max_tokens: int | None = 512,
|
|
143
149
|
stop: List[str] | None = None,
|
|
144
150
|
temperature: float = 0.7,
|
|
@@ -162,6 +168,7 @@ class AsyncChatCompletions:
|
|
|
162
168
|
messages (List[Dict[str, str]]): A list of messages in the format
|
|
163
169
|
`[{"role": seekrai.types.chat_completions.MessageRole, "content": TEXT}, ...]`
|
|
164
170
|
model (str): The name of the model to query.
|
|
171
|
+
max_completion_tokens (int, optional): The maximum number of tokens the output can contain.
|
|
165
172
|
max_tokens (int, optional): The maximum number of tokens to generate.
|
|
166
173
|
Defaults to 512.
|
|
167
174
|
stop (List[str], optional): List of strings at which to stop generation.
|
|
@@ -217,6 +224,7 @@ class AsyncChatCompletions:
|
|
|
217
224
|
top_p=top_p,
|
|
218
225
|
top_k=top_k,
|
|
219
226
|
temperature=temperature,
|
|
227
|
+
max_completion_tokens=max_completion_tokens,
|
|
220
228
|
max_tokens=max_tokens,
|
|
221
229
|
stop=stop,
|
|
222
230
|
repetition_penalty=repetition_penalty,
|
|
@@ -236,6 +244,7 @@ class AsyncChatCompletions:
|
|
|
236
244
|
method="POST",
|
|
237
245
|
url="inference/chat/completions",
|
|
238
246
|
params=parameter_payload,
|
|
247
|
+
headers={"content-type": "application/json"},
|
|
239
248
|
),
|
|
240
249
|
stream=stream,
|
|
241
250
|
)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from seekrai.abstract import api_requestor
|
|
4
|
+
from seekrai.resources.resource_base import ResourceBase
|
|
5
|
+
from seekrai.seekrflow_response import SeekrFlowResponse
|
|
6
|
+
from seekrai.types import (
|
|
7
|
+
SeekrFlowRequest,
|
|
8
|
+
)
|
|
9
|
+
from seekrai.types.explainability import (
|
|
10
|
+
InfluentialFinetuningDataRequest,
|
|
11
|
+
InfluentialFinetuningDataResponse,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Explainability(ResourceBase):
|
|
16
|
+
def get_influential_finetuning_data(
|
|
17
|
+
self, model_id: str, question: str, answer: Optional[str], k: int = 5
|
|
18
|
+
) -> InfluentialFinetuningDataResponse:
|
|
19
|
+
"""
|
|
20
|
+
Retrieve influential QA pair fine tuning data for a specific model.
|
|
21
|
+
Args:
|
|
22
|
+
- model_id (str): ID of the model to explain.
|
|
23
|
+
- question (str): question from user,
|
|
24
|
+
- answer (str | None): answer of the finetuned model to the question; if None, the answer is retrieved from the finetuned model specified by model_id,
|
|
25
|
+
- k (int): the number of results to be retrieved (5 by default)
|
|
26
|
+
Returns:
|
|
27
|
+
InfluentialFinetuningDataResponse: Object containing the influential fine tuning data.
|
|
28
|
+
"""
|
|
29
|
+
requestor = api_requestor.APIRequestor(
|
|
30
|
+
client=self._client,
|
|
31
|
+
)
|
|
32
|
+
# Create query parameters dictionary
|
|
33
|
+
parameter_payload = InfluentialFinetuningDataRequest(
|
|
34
|
+
question=question, answer=answer, k=k
|
|
35
|
+
).model_dump()
|
|
36
|
+
|
|
37
|
+
# if limit is not None:
|
|
38
|
+
# params["limit"] = limit
|
|
39
|
+
# TODO limits =? timeout: float | None = None, max_retries: int | None = None,
|
|
40
|
+
|
|
41
|
+
response, _, _ = requestor.request(
|
|
42
|
+
options=SeekrFlowRequest(
|
|
43
|
+
method="GET",
|
|
44
|
+
url=f"v1/flow/explain/models/{model_id}/influential-finetuning-data",
|
|
45
|
+
params=parameter_payload,
|
|
46
|
+
),
|
|
47
|
+
stream=False,
|
|
48
|
+
)
|
|
49
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
50
|
+
return InfluentialFinetuningDataResponse(**response.data)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class AsyncExplainability(ResourceBase):
|
|
54
|
+
async def get_influential_finetuning_data(
|
|
55
|
+
self, model_id: str, question: str, answer: Optional[str], k: int = 5
|
|
56
|
+
) -> InfluentialFinetuningDataResponse:
|
|
57
|
+
"""
|
|
58
|
+
Retrieve influential QA pair finetuning data for a specific model asynchronously.
|
|
59
|
+
Args:
|
|
60
|
+
- model_id (str): ID of the model to explain.
|
|
61
|
+
- question (str): question from user,
|
|
62
|
+
- answer (str | None): answer of the finetuned model to the question; if None, the answer is retrieved from the finetuned model specified by model_id,
|
|
63
|
+
- k (int): the number of results to be retrieved (5 by default),
|
|
64
|
+
Returns:
|
|
65
|
+
InfluentialFinetuningDataResponse: Object containing the influential finetuning data.
|
|
66
|
+
"""
|
|
67
|
+
requestor = api_requestor.APIRequestor(
|
|
68
|
+
client=self._client,
|
|
69
|
+
)
|
|
70
|
+
# Create query parameters dictionary
|
|
71
|
+
parameter_payload = InfluentialFinetuningDataRequest(
|
|
72
|
+
model_id=model_id, question=question, answer=answer, k=k
|
|
73
|
+
).model_dump()
|
|
74
|
+
|
|
75
|
+
response, _, _ = await requestor.arequest(
|
|
76
|
+
options=SeekrFlowRequest(
|
|
77
|
+
method="GET",
|
|
78
|
+
url=f"v1/flow/explain/models/{model_id}/influential-finetuning-data",
|
|
79
|
+
params=parameter_payload,
|
|
80
|
+
),
|
|
81
|
+
stream=False,
|
|
82
|
+
)
|
|
83
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
84
|
+
return InfluentialFinetuningDataResponse(**response.data)
|
|
@@ -13,9 +13,11 @@ from seekrai.types.agents import (
|
|
|
13
13
|
InputMessage,
|
|
14
14
|
InputText,
|
|
15
15
|
MessageUpdateRequest,
|
|
16
|
+
ModelSettings,
|
|
16
17
|
OutputGuardrail,
|
|
17
18
|
OutputMessage,
|
|
18
19
|
OutputText,
|
|
20
|
+
ReasoningEffort,
|
|
19
21
|
Run,
|
|
20
22
|
RunRequest,
|
|
21
23
|
RunResponse,
|
|
@@ -183,9 +185,11 @@ __all__ = [
|
|
|
183
185
|
"RunUsage",
|
|
184
186
|
"RunStatus",
|
|
185
187
|
"RunStepUsage",
|
|
188
|
+
"ModelSettings",
|
|
186
189
|
"Agent",
|
|
187
190
|
"AgentStatus",
|
|
188
191
|
"CreateAgentRequest",
|
|
192
|
+
"ReasoningEffort",
|
|
189
193
|
"AgentDeleteResponse",
|
|
190
194
|
"ToolBase",
|
|
191
195
|
"ToolType",
|
|
@@ -3,8 +3,10 @@ from seekrai.types.agents.agent import (
|
|
|
3
3
|
AgentDeleteResponse,
|
|
4
4
|
AgentStatus,
|
|
5
5
|
CreateAgentRequest,
|
|
6
|
+
ReasoningEffort,
|
|
6
7
|
)
|
|
7
8
|
from seekrai.types.agents.runs import (
|
|
9
|
+
ModelSettings,
|
|
8
10
|
Run,
|
|
9
11
|
RunRequest,
|
|
10
12
|
RunResponse,
|
|
@@ -51,6 +53,7 @@ __all__ = [
|
|
|
51
53
|
"RunUsage",
|
|
52
54
|
"RunStatus",
|
|
53
55
|
"RunStepUsage",
|
|
56
|
+
"ModelSettings",
|
|
54
57
|
"MessageUpdateRequest",
|
|
55
58
|
"ThreadCreateRequest",
|
|
56
59
|
"ThreadStatus",
|
|
@@ -78,6 +81,7 @@ __all__ = [
|
|
|
78
81
|
"Agent",
|
|
79
82
|
"AgentStatus",
|
|
80
83
|
"CreateAgentRequest",
|
|
84
|
+
"ReasoningEffort",
|
|
81
85
|
"AgentDeleteResponse",
|
|
82
86
|
"ToolBase",
|
|
83
87
|
"ToolType",
|
|
@@ -14,11 +14,17 @@ class AgentStatus(str, enum.Enum):
|
|
|
14
14
|
FAILED = "Failed"
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
class ReasoningEffort(str, enum.Enum):
|
|
18
|
+
PERFORMANCE_OPTIMIZED = "performance_optimized"
|
|
19
|
+
SPEED_OPTIMIZED = "speed_optimized"
|
|
20
|
+
|
|
21
|
+
|
|
17
22
|
class CreateAgentRequest(BaseModel):
|
|
18
23
|
name: str
|
|
19
24
|
instructions: str
|
|
20
25
|
tools: list[Tool]
|
|
21
26
|
model_id: str
|
|
27
|
+
reasoning_effort: Optional[ReasoningEffort] = None
|
|
22
28
|
|
|
23
29
|
|
|
24
30
|
class Agent(BaseModel):
|
|
@@ -35,6 +41,7 @@ class Agent(BaseModel):
|
|
|
35
41
|
updated_at: datetime
|
|
36
42
|
last_deployed_at: Optional[datetime] = None
|
|
37
43
|
active_duration: int = Field(default=0, ge=0)
|
|
44
|
+
reasoning_effort: ReasoningEffort
|
|
38
45
|
|
|
39
46
|
|
|
40
47
|
class AgentDeleteResponse(BaseModel):
|
|
@@ -115,3 +115,20 @@ class RunStep(BaseModel):
|
|
|
115
115
|
completed_at: Optional[datetime.datetime] = None
|
|
116
116
|
meta_data: dict[str, Any] = Field(default_factory=dict)
|
|
117
117
|
usage: Optional[RunStepUsage] = None
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class ModelSettings(BaseModel):
|
|
121
|
+
"""Settings to use when calling an LLM.
|
|
122
|
+
|
|
123
|
+
This class holds optional model configuration parameters (e.g. temperature,
|
|
124
|
+
top_p, penalties, truncation, etc.).
|
|
125
|
+
|
|
126
|
+
Not all models/providers support all of these parameters, so please check the API documentation
|
|
127
|
+
for the specific model and provider you are using.
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
temperature: float = Field(default=1.0, ge=0.0, le=2.0)
|
|
131
|
+
top_p: float = Field(default=1.0, ge=0.0, le=1.0)
|
|
132
|
+
frequency_penalty: float = Field(default=0.0, ge=-2.0, le=2.0)
|
|
133
|
+
presence_penalty: float = Field(default=0.0, ge=-2.0, le=2.0)
|
|
134
|
+
max_tokens: Optional[int] = None
|
|
@@ -78,6 +78,7 @@ class ChatCompletionRequest(BaseModel):
|
|
|
78
78
|
messages: List[ChatCompletionMessage]
|
|
79
79
|
# model name
|
|
80
80
|
model: str
|
|
81
|
+
max_completion_tokens: int | None = None
|
|
81
82
|
# stopping criteria: max tokens to generate
|
|
82
83
|
max_tokens: int | None = None
|
|
83
84
|
# stopping criteria: list of strings to stop generation
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from enum import Enum
|
|
5
|
+
from typing import Any, Dict, List, Literal
|
|
6
|
+
|
|
7
|
+
from pydantic import Field
|
|
8
|
+
|
|
9
|
+
from seekrai.types.abstract import BaseModel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class InfluentialFinetuningDataResponse(BaseModel):
|
|
13
|
+
results: List[Dict[str, Any]]
|
|
14
|
+
version: str
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InfluentialFinetuningDataRequest(BaseModel):
|
|
18
|
+
question: str
|
|
19
|
+
answer: str = Field(
|
|
20
|
+
default="",
|
|
21
|
+
description="Response could be generated or given",
|
|
22
|
+
)
|
|
23
|
+
k: int
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ExplainabilityJobStatus(Enum):
|
|
27
|
+
QUEUED = "queued"
|
|
28
|
+
RUNNING = "running"
|
|
29
|
+
COMPLETED = "completed"
|
|
30
|
+
FAILED = "failed"
|
|
31
|
+
|
|
32
|
+
# TODO should titles along the following get added:
|
|
33
|
+
# create_index
|
|
34
|
+
# populate_index
|
|
35
|
+
# delete_index
|
|
36
|
+
# influential-finetuning-data
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ExplainabilityRequest(BaseModel):
|
|
40
|
+
files: List[str] = Field(
|
|
41
|
+
default=..., description="List of file ids to use for fine tuning"
|
|
42
|
+
)
|
|
43
|
+
method: str = Field(default="best", description="Method to use for explainability")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class ExplainabilityResponse(BaseModel):
|
|
47
|
+
id: str = Field(default=..., description="Explainability job ID")
|
|
48
|
+
created_at: datetime
|
|
49
|
+
status: ExplainabilityJobStatus
|
|
50
|
+
output_files: List[str]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class ExplainabilityList(BaseModel):
|
|
54
|
+
# object type
|
|
55
|
+
object: Literal["list"] | None = None
|
|
56
|
+
# list of fine-tune job objects
|
|
57
|
+
data: List[ExplainabilityResponse] | None = None
|
|
@@ -72,6 +72,11 @@ class FinetuneEventType(str, Enum):
|
|
|
72
72
|
WARNING = "WARNING"
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
class FineTuneType(str, Enum):
|
|
76
|
+
STANDARD = "STANDARD"
|
|
77
|
+
DPO = "DPO"
|
|
78
|
+
|
|
79
|
+
|
|
75
80
|
class FinetuneEvent(BaseModel):
|
|
76
81
|
"""
|
|
77
82
|
Fine-tune event type
|
|
@@ -105,6 +110,8 @@ class TrainingConfig(BaseModel):
|
|
|
105
110
|
# wandb_key: str | None = None
|
|
106
111
|
# IFT by default
|
|
107
112
|
pre_train: bool = False
|
|
113
|
+
# fine-tune type
|
|
114
|
+
fine_tune_type: FineTuneType = FineTuneType.STANDARD
|
|
108
115
|
|
|
109
116
|
|
|
110
117
|
class AcceleratorType(str, Enum):
|
|
@@ -138,6 +145,8 @@ class FinetuneResponse(BaseModel):
|
|
|
138
145
|
|
|
139
146
|
# job ID
|
|
140
147
|
id: str | None = None
|
|
148
|
+
# fine-tune type
|
|
149
|
+
fine_tune_type: FineTuneType = FineTuneType.STANDARD
|
|
141
150
|
# training file id
|
|
142
151
|
training_files: List[str] | None = None
|
|
143
152
|
# validation file id
|
|
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
|
|
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
|