seekrai 0.5.15__tar.gz → 0.5.17__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.15 → seekrai-0.5.17}/PKG-INFO +3 -4
- {seekrai-0.5.15 → seekrai-0.5.17}/pyproject.toml +1 -1
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/client.py +4 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/agents/agent_inference.py +10 -4
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/agents/agent_observability.py +4 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/agents/python_functions.py +21 -56
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/explainability.py +19 -11
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/ingestion.py +5 -7
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/vectordb.py +6 -2
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/observability.py +1 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/runs.py +1 -0
- seekrai-0.5.17/src/seekrai/types/explainability.py +26 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/vectordb.py +6 -1
- seekrai-0.5.15/src/seekrai/types/explainability.py +0 -57
- {seekrai-0.5.15 → seekrai-0.5.17}/LICENSE +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/README.md +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/abstract/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/abstract/api_requestor.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/abstract/response_parsing.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/constants.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/error.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/filemanager.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/agents/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/agents/agents.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/agents/threads.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/alignment.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/chat/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/chat/completions.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/completions.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/deployments.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/embeddings.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/files.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/finetune.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/images.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/models.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/projects.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/resources/resource_base.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/seekrflow_response.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/abstract.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/agent.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/python_functions.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/threads.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/env_model_config.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/file_search.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/file_search_env.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/run_python.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/run_python_env.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/web_search.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/schemas/web_search_env.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/tool.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/agents/tools/tool_types.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/alignment.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/chat_completions.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/common.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/completions.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/deployments.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/embeddings.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/error.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/files.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/finetune.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/images.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/ingestion.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/models.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/types/projects.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/utils/__init__.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/utils/_log.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/utils/api_helpers.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/utils/files.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/utils/tools.py +0 -0
- {seekrai-0.5.15 → seekrai-0.5.17}/src/seekrai/version.py +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
2
|
Name: seekrai
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.17
|
|
4
4
|
Summary: Python client for SeekrAI
|
|
5
|
+
Home-page: https://gitlab.cb.ntent.com/ml/seekr-py
|
|
5
6
|
License: Apache-2.0
|
|
6
7
|
Author: SeekrFlow
|
|
7
8
|
Author-email: support@seekr.com
|
|
@@ -12,8 +13,6 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
16
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
18
17
|
Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
|
|
19
18
|
Requires-Dist: filelock (>=3.13.1,<4.0.0)
|
|
@@ -25,6 +25,7 @@ class SeekrFlow:
|
|
|
25
25
|
vector_database: resources.VectorDatabase
|
|
26
26
|
agents: resources.Agents
|
|
27
27
|
observability: resources.AgentObservability
|
|
28
|
+
explainability: resources.Explainability
|
|
28
29
|
|
|
29
30
|
# client options
|
|
30
31
|
client: SeekrFlowClient
|
|
@@ -91,6 +92,7 @@ class SeekrFlow:
|
|
|
91
92
|
self.vector_database = resources.VectorDatabase(self.client)
|
|
92
93
|
self.agents = resources.Agents(self.client)
|
|
93
94
|
self.observability = resources.AgentObservability(self.client)
|
|
95
|
+
self.explainability = resources.Explainability(self.client)
|
|
94
96
|
|
|
95
97
|
|
|
96
98
|
class AsyncSeekrFlow:
|
|
@@ -108,6 +110,7 @@ class AsyncSeekrFlow:
|
|
|
108
110
|
vector_database: resources.AsyncVectorDatabase
|
|
109
111
|
agents: resources.AsyncAgents
|
|
110
112
|
observability: resources.AsyncAgentObservability
|
|
113
|
+
explainability: resources.AsyncExplainability
|
|
111
114
|
|
|
112
115
|
# client options
|
|
113
116
|
client: SeekrFlowClient
|
|
@@ -174,6 +177,7 @@ class AsyncSeekrFlow:
|
|
|
174
177
|
self.vector_database = resources.AsyncVectorDatabase(self.client)
|
|
175
178
|
self.agents = resources.AsyncAgents(self.client)
|
|
176
179
|
self.observability = resources.AsyncAgentObservability(self.client)
|
|
180
|
+
self.explainability = resources.AsyncExplainability(self.client)
|
|
177
181
|
|
|
178
182
|
|
|
179
183
|
Client = SeekrFlow
|
|
@@ -19,7 +19,8 @@ class AgentInference:
|
|
|
19
19
|
stream: bool = False,
|
|
20
20
|
model_settings: ModelSettings = ModelSettings(),
|
|
21
21
|
response_format: Optional[Any] = None,
|
|
22
|
-
group: Optional[str] =
|
|
22
|
+
group: Optional[str] = "default_group",
|
|
23
|
+
metadata: Optional[dict[str, str]] = None,
|
|
23
24
|
) -> Union[RunResponse, Iterator[Any]]:
|
|
24
25
|
"""
|
|
25
26
|
Run an inference call on a deployed agent.
|
|
@@ -30,7 +31,8 @@ class AgentInference:
|
|
|
30
31
|
stream (bool, optional): Whether to stream the response. Defaults to False.
|
|
31
32
|
model_settings (optional): Additional parameters (such as temperature, max_tokens, etc).
|
|
32
33
|
response_format: Optional structured output specification. If provided, the LLM will be constrained to return JSON matching this schema.
|
|
33
|
-
group (str, optional): Label used to associate a group of runs. Defaults to
|
|
34
|
+
group (str, optional): Label used to associate a group of runs. Defaults to 'default_group'.
|
|
35
|
+
metadata (dict[str, str], optional): Additional metadata used to label runs. Defaults to None.
|
|
34
36
|
|
|
35
37
|
Returns:
|
|
36
38
|
A dictionary with the response (if non-streaming) or an iterator over response chunks.
|
|
@@ -42,6 +44,7 @@ class AgentInference:
|
|
|
42
44
|
if response_format
|
|
43
45
|
else None,
|
|
44
46
|
group=group,
|
|
47
|
+
metadata=metadata,
|
|
45
48
|
).model_dump()
|
|
46
49
|
endpoint = f"threads/{thread_id}/runs"
|
|
47
50
|
if stream:
|
|
@@ -159,7 +162,8 @@ class AsyncAgentInference:
|
|
|
159
162
|
stream: bool = False,
|
|
160
163
|
model_settings: ModelSettings = ModelSettings(),
|
|
161
164
|
response_format: Optional[Any] = None,
|
|
162
|
-
group: Optional[str] =
|
|
165
|
+
group: Optional[str] = "default_group",
|
|
166
|
+
metadata: Optional[dict[str, str]] = None,
|
|
163
167
|
) -> Union[RunResponse, AsyncGenerator[Any, None]]:
|
|
164
168
|
"""
|
|
165
169
|
Run an inference call on a deployed agent.
|
|
@@ -170,7 +174,8 @@ class AsyncAgentInference:
|
|
|
170
174
|
stream (bool, optional): Whether to stream the response. Defaults to False.
|
|
171
175
|
model_settings (optional): Additional parameters (such as temperature, max_tokens, etc).
|
|
172
176
|
response_format: Optional structured output specification. If provided, the LLM will be constrained to return JSON matching this schema.
|
|
173
|
-
group (str, optional): Label used to associate a group of runs. Defaults to
|
|
177
|
+
group (str, optional): Label used to associate a group of runs. Defaults to 'default_group'.
|
|
178
|
+
metadata (dict[str, str], optional): Additional metadata used to label runs. Defaults to None.
|
|
174
179
|
|
|
175
180
|
Returns:
|
|
176
181
|
A dictionary with the response (if non-streaming) or an iterator over response chunks.
|
|
@@ -182,6 +187,7 @@ class AsyncAgentInference:
|
|
|
182
187
|
if response_format
|
|
183
188
|
else None,
|
|
184
189
|
group=group,
|
|
190
|
+
metadata=metadata,
|
|
185
191
|
).model_dump()
|
|
186
192
|
endpoint = f"threads/{thread_id}/runs"
|
|
187
193
|
if stream:
|
|
@@ -27,6 +27,7 @@ class AgentObservability:
|
|
|
27
27
|
trace_id: Optional[str] = None,
|
|
28
28
|
thread_id: Optional[str] = None,
|
|
29
29
|
group: Optional[str] = None,
|
|
30
|
+
metadata: Optional[dict[str, str]] = None,
|
|
30
31
|
limit: int = 100,
|
|
31
32
|
order: str = "desc",
|
|
32
33
|
offset: int = 0,
|
|
@@ -42,6 +43,7 @@ class AgentObservability:
|
|
|
42
43
|
trace_id=trace_id,
|
|
43
44
|
thread_id=thread_id,
|
|
44
45
|
group=group,
|
|
46
|
+
metadata=metadata,
|
|
45
47
|
limit=limit,
|
|
46
48
|
order=order,
|
|
47
49
|
offset=offset,
|
|
@@ -86,6 +88,7 @@ class AsyncAgentObservability:
|
|
|
86
88
|
trace_id: Optional[str] = None,
|
|
87
89
|
thread_id: Optional[str] = None,
|
|
88
90
|
group: Optional[str] = None,
|
|
91
|
+
metadata: Optional[dict[str, str]] = None,
|
|
89
92
|
limit: int = 100,
|
|
90
93
|
order: str = "desc",
|
|
91
94
|
offset: int = 0,
|
|
@@ -101,6 +104,7 @@ class AsyncAgentObservability:
|
|
|
101
104
|
trace_id=trace_id,
|
|
102
105
|
thread_id=thread_id,
|
|
103
106
|
group=group,
|
|
107
|
+
metadata=metadata,
|
|
104
108
|
limit=limit,
|
|
105
109
|
order=order,
|
|
106
110
|
offset=offset,
|
|
@@ -17,15 +17,12 @@ class CustomFunctions:
|
|
|
17
17
|
client=self._client,
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
-
def create(
|
|
21
|
-
self, file_path: Union[str, Path], description: Union[str, None] = None
|
|
22
|
-
) -> PythonFunctionResponse:
|
|
20
|
+
def create(self, file_path: Union[str, Path]) -> PythonFunctionResponse:
|
|
23
21
|
"""
|
|
24
22
|
Upload a new Python function for the user.
|
|
25
23
|
|
|
26
24
|
Args:
|
|
27
25
|
file_path: Path to the Python function file to upload (can be relative or absolute).
|
|
28
|
-
description: Optional description for the function.
|
|
29
26
|
|
|
30
27
|
Returns:
|
|
31
28
|
The newly created Python function.
|
|
@@ -40,16 +37,12 @@ class CustomFunctions:
|
|
|
40
37
|
|
|
41
38
|
# Prepare multipart form data
|
|
42
39
|
files = {"file": (file_path.name, file_content, "text/plain")}
|
|
43
|
-
params = {}
|
|
44
|
-
if description:
|
|
45
|
-
params["description"] = description
|
|
46
40
|
|
|
47
41
|
response, _, _ = self._requestor.request(
|
|
48
42
|
options=SeekrFlowRequest(
|
|
49
43
|
method="POST",
|
|
50
44
|
url="functions/",
|
|
51
45
|
files=files,
|
|
52
|
-
params=params,
|
|
53
46
|
),
|
|
54
47
|
)
|
|
55
48
|
|
|
@@ -103,10 +96,7 @@ class CustomFunctions:
|
|
|
103
96
|
return functions
|
|
104
97
|
|
|
105
98
|
def update(
|
|
106
|
-
self,
|
|
107
|
-
function_id: str,
|
|
108
|
-
file_path: Union[str, Path, None] = None,
|
|
109
|
-
description: Union[str, None] = None,
|
|
99
|
+
self, function_id: str, file_path: Union[str, Path]
|
|
110
100
|
) -> PythonFunctionResponse:
|
|
111
101
|
"""
|
|
112
102
|
Update an existing Python function.
|
|
@@ -119,30 +109,22 @@ class CustomFunctions:
|
|
|
119
109
|
Returns:
|
|
120
110
|
The updated Python function.
|
|
121
111
|
"""
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if file_path:
|
|
126
|
-
# Convert string to Path if needed
|
|
127
|
-
if isinstance(file_path, str):
|
|
128
|
-
file_path = Path(file_path)
|
|
129
|
-
|
|
130
|
-
# Read the file contents
|
|
131
|
-
with file_path.open("rb") as f:
|
|
132
|
-
file_content = f.read()
|
|
112
|
+
# Convert string to Path if needed
|
|
113
|
+
if isinstance(file_path, str):
|
|
114
|
+
file_path = Path(file_path)
|
|
133
115
|
|
|
134
|
-
|
|
135
|
-
|
|
116
|
+
# Read the file contents
|
|
117
|
+
with file_path.open("rb") as f:
|
|
118
|
+
file_content = f.read()
|
|
136
119
|
|
|
137
|
-
|
|
138
|
-
|
|
120
|
+
# Prepare multipart form data
|
|
121
|
+
files = {"file": (file_path.name, file_content, "text/plain")}
|
|
139
122
|
|
|
140
123
|
response, _, _ = self._requestor.request(
|
|
141
124
|
options=SeekrFlowRequest(
|
|
142
125
|
method="PATCH",
|
|
143
126
|
url=f"functions/{function_id}",
|
|
144
127
|
files=files,
|
|
145
|
-
params=params,
|
|
146
128
|
),
|
|
147
129
|
)
|
|
148
130
|
|
|
@@ -177,15 +159,12 @@ class AsyncCustomFunctions:
|
|
|
177
159
|
client=self._client,
|
|
178
160
|
)
|
|
179
161
|
|
|
180
|
-
async def create(
|
|
181
|
-
self, file_path: Union[str, Path], description: Union[str, None] = None
|
|
182
|
-
) -> PythonFunctionResponse:
|
|
162
|
+
async def create(self, file_path: Union[str, Path]) -> PythonFunctionResponse:
|
|
183
163
|
"""
|
|
184
164
|
Upload a new Python function for the user.
|
|
185
165
|
|
|
186
166
|
Args:
|
|
187
167
|
file_path: Path to the Python function file to upload (can be relative or absolute).
|
|
188
|
-
description: Optional description for the function.
|
|
189
168
|
|
|
190
169
|
Returns:
|
|
191
170
|
The newly created Python function.
|
|
@@ -200,16 +179,12 @@ class AsyncCustomFunctions:
|
|
|
200
179
|
|
|
201
180
|
# Prepare multipart form data
|
|
202
181
|
files = {"file": (file_path.name, file_content, "text/plain")}
|
|
203
|
-
params = {}
|
|
204
|
-
if description:
|
|
205
|
-
params["description"] = description
|
|
206
182
|
|
|
207
183
|
response, _, _ = await self._requestor.arequest(
|
|
208
184
|
options=SeekrFlowRequest(
|
|
209
185
|
method="POST",
|
|
210
186
|
url="functions/",
|
|
211
187
|
files=files,
|
|
212
|
-
params=params,
|
|
213
188
|
),
|
|
214
189
|
)
|
|
215
190
|
|
|
@@ -265,44 +240,34 @@ class AsyncCustomFunctions:
|
|
|
265
240
|
async def update(
|
|
266
241
|
self,
|
|
267
242
|
function_id: str,
|
|
268
|
-
file_path: Union[str, Path
|
|
269
|
-
description: Union[str, None] = None,
|
|
243
|
+
file_path: Union[str, Path],
|
|
270
244
|
) -> PythonFunctionResponse:
|
|
271
245
|
"""
|
|
272
246
|
Update an existing Python function.
|
|
273
247
|
|
|
274
248
|
Args:
|
|
275
249
|
function_id: The ID of the Python function to update.
|
|
276
|
-
file_path:
|
|
277
|
-
description: Optional new description for the function.
|
|
250
|
+
file_path: Path to a new Python function file (can be relative or absolute).
|
|
278
251
|
|
|
279
252
|
Returns:
|
|
280
253
|
The updated Python function.
|
|
281
254
|
"""
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if file_path:
|
|
286
|
-
# Convert string to Path if needed
|
|
287
|
-
if isinstance(file_path, str):
|
|
288
|
-
file_path = Path(file_path)
|
|
289
|
-
|
|
290
|
-
# Read the file contents
|
|
291
|
-
with file_path.open("rb") as f:
|
|
292
|
-
file_content = f.read()
|
|
255
|
+
# Convert string to Path if needed
|
|
256
|
+
if isinstance(file_path, str):
|
|
257
|
+
file_path = Path(file_path)
|
|
293
258
|
|
|
294
|
-
|
|
295
|
-
|
|
259
|
+
# Read the file contents
|
|
260
|
+
with file_path.open("rb") as f:
|
|
261
|
+
file_content = f.read()
|
|
296
262
|
|
|
297
|
-
|
|
298
|
-
|
|
263
|
+
# Prepare multipart form data
|
|
264
|
+
files = {"file": (file_path.name, file_content, "text/plain")}
|
|
299
265
|
|
|
300
266
|
response, _, _ = await self._requestor.arequest(
|
|
301
267
|
options=SeekrFlowRequest(
|
|
302
268
|
method="PATCH",
|
|
303
269
|
url=f"functions/{function_id}",
|
|
304
270
|
files=files,
|
|
305
|
-
params=params,
|
|
306
271
|
),
|
|
307
272
|
)
|
|
308
273
|
|
|
@@ -2,7 +2,6 @@ from typing import Optional
|
|
|
2
2
|
|
|
3
3
|
from seekrai.abstract import api_requestor
|
|
4
4
|
from seekrai.resources.resource_base import ResourceBase
|
|
5
|
-
from seekrai.seekrflow_response import SeekrFlowResponse
|
|
6
5
|
from seekrai.types import (
|
|
7
6
|
SeekrFlowRequest,
|
|
8
7
|
)
|
|
@@ -14,15 +13,19 @@ from seekrai.types.explainability import (
|
|
|
14
13
|
|
|
15
14
|
class Explainability(ResourceBase):
|
|
16
15
|
def get_influential_finetuning_data(
|
|
17
|
-
self,
|
|
16
|
+
self,
|
|
17
|
+
model_id: str,
|
|
18
|
+
question: str,
|
|
19
|
+
system_prompt: Optional[str] = None,
|
|
20
|
+
answer: Optional[str] = None,
|
|
18
21
|
) -> InfluentialFinetuningDataResponse:
|
|
19
22
|
"""
|
|
20
23
|
Retrieve influential QA pair fine tuning data for a specific model.
|
|
21
24
|
Args:
|
|
22
25
|
- model_id (str): ID of the model to explain.
|
|
23
26
|
- question (str): question from user,
|
|
27
|
+
- system_prompt (str | None): System prompt for the user's question.
|
|
24
28
|
- 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
29
|
Returns:
|
|
27
30
|
InfluentialFinetuningDataResponse: Object containing the influential fine tuning data.
|
|
28
31
|
"""
|
|
@@ -31,7 +34,7 @@ class Explainability(ResourceBase):
|
|
|
31
34
|
)
|
|
32
35
|
# Create query parameters dictionary
|
|
33
36
|
parameter_payload = InfluentialFinetuningDataRequest(
|
|
34
|
-
question=question,
|
|
37
|
+
question=question, system_prompt=system_prompt, answer=answer
|
|
35
38
|
).model_dump()
|
|
36
39
|
|
|
37
40
|
# if limit is not None:
|
|
@@ -41,26 +44,29 @@ class Explainability(ResourceBase):
|
|
|
41
44
|
response, _, _ = requestor.request(
|
|
42
45
|
options=SeekrFlowRequest(
|
|
43
46
|
method="GET",
|
|
44
|
-
url=f"
|
|
47
|
+
url=f"flow/explain/models/{model_id}/influential-finetuning-data",
|
|
45
48
|
params=parameter_payload,
|
|
46
49
|
),
|
|
47
50
|
stream=False,
|
|
48
51
|
)
|
|
49
|
-
assert isinstance(response, SeekrFlowResponse)
|
|
50
52
|
return InfluentialFinetuningDataResponse(**response.data)
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
class AsyncExplainability(ResourceBase):
|
|
54
56
|
async def get_influential_finetuning_data(
|
|
55
|
-
self,
|
|
57
|
+
self,
|
|
58
|
+
model_id: str,
|
|
59
|
+
question: str,
|
|
60
|
+
system_prompt: Optional[str] = None,
|
|
61
|
+
answer: Optional[str] = None,
|
|
56
62
|
) -> InfluentialFinetuningDataResponse:
|
|
57
63
|
"""
|
|
58
64
|
Retrieve influential QA pair finetuning data for a specific model asynchronously.
|
|
59
65
|
Args:
|
|
60
66
|
- model_id (str): ID of the model to explain.
|
|
61
67
|
- question (str): question from user,
|
|
68
|
+
- system_prompt (str | None): System prompt for the user's question.
|
|
62
69
|
- 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
70
|
Returns:
|
|
65
71
|
InfluentialFinetuningDataResponse: Object containing the influential finetuning data.
|
|
66
72
|
"""
|
|
@@ -69,16 +75,18 @@ class AsyncExplainability(ResourceBase):
|
|
|
69
75
|
)
|
|
70
76
|
# Create query parameters dictionary
|
|
71
77
|
parameter_payload = InfluentialFinetuningDataRequest(
|
|
72
|
-
model_id=model_id,
|
|
78
|
+
model_id=model_id,
|
|
79
|
+
question=question,
|
|
80
|
+
system_prompt=system_prompt,
|
|
81
|
+
answer=answer,
|
|
73
82
|
).model_dump()
|
|
74
83
|
|
|
75
84
|
response, _, _ = await requestor.arequest(
|
|
76
85
|
options=SeekrFlowRequest(
|
|
77
86
|
method="GET",
|
|
78
|
-
url=f"
|
|
87
|
+
url=f"flow/explain/models/{model_id}/influential-finetuning-data",
|
|
79
88
|
params=parameter_payload,
|
|
80
89
|
),
|
|
81
90
|
stream=False,
|
|
82
91
|
)
|
|
83
|
-
assert isinstance(response, SeekrFlowResponse)
|
|
84
92
|
return InfluentialFinetuningDataResponse(**response.data)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import List
|
|
1
|
+
from typing import List, Optional
|
|
2
2
|
|
|
3
3
|
from seekrai.abstract import api_requestor
|
|
4
4
|
from seekrai.resources.resource_base import ResourceBase
|
|
@@ -13,6 +13,7 @@ class Ingestion(ResourceBase):
|
|
|
13
13
|
def ingest(
|
|
14
14
|
self,
|
|
15
15
|
files: List[str],
|
|
16
|
+
method: Optional[str] = "accuracy-optimized",
|
|
16
17
|
) -> IngestionResponse:
|
|
17
18
|
"""
|
|
18
19
|
Start an ingestion job for the specified files.
|
|
@@ -27,9 +28,7 @@ class Ingestion(ResourceBase):
|
|
|
27
28
|
client=self._client,
|
|
28
29
|
)
|
|
29
30
|
|
|
30
|
-
parameter_payload = IngestionRequest(
|
|
31
|
-
files=files,
|
|
32
|
-
).model_dump()
|
|
31
|
+
parameter_payload = IngestionRequest(files=files, method=method).model_dump()
|
|
33
32
|
|
|
34
33
|
response, _, _ = requestor.request(
|
|
35
34
|
options=SeekrFlowRequest(
|
|
@@ -95,6 +94,7 @@ class AsyncIngestion(ResourceBase):
|
|
|
95
94
|
async def ingest(
|
|
96
95
|
self,
|
|
97
96
|
files: List[str],
|
|
97
|
+
method: Optional[str] = "accuracy-optimized",
|
|
98
98
|
) -> IngestionResponse:
|
|
99
99
|
"""
|
|
100
100
|
Start an ingestion job for the specified files asynchronously.
|
|
@@ -109,9 +109,7 @@ class AsyncIngestion(ResourceBase):
|
|
|
109
109
|
client=self._client,
|
|
110
110
|
)
|
|
111
111
|
|
|
112
|
-
parameter_payload = IngestionRequest(
|
|
113
|
-
files=files,
|
|
114
|
-
).model_dump()
|
|
112
|
+
parameter_payload = IngestionRequest(files=files, method=method).model_dump()
|
|
115
113
|
|
|
116
114
|
response, _, _ = await requestor.arequest(
|
|
117
115
|
options=SeekrFlowRequest(
|
|
@@ -107,7 +107,8 @@ class VectorDatabase(ResourceBase):
|
|
|
107
107
|
self,
|
|
108
108
|
database_id: str,
|
|
109
109
|
files: List[str],
|
|
110
|
-
method: str,
|
|
110
|
+
method: Optional[str] = "accuracy-optimized",
|
|
111
|
+
chunking_method: Optional[str] = "markdown",
|
|
111
112
|
token_count: int = 800,
|
|
112
113
|
overlap_tokens: int = 100,
|
|
113
114
|
) -> VectorDatabaseIngestionResponse:
|
|
@@ -129,6 +130,7 @@ class VectorDatabase(ResourceBase):
|
|
|
129
130
|
parameter_payload = VectorDatabaseIngestionRequest(
|
|
130
131
|
file_ids=files,
|
|
131
132
|
method=method,
|
|
133
|
+
chunking_method=chunking_method,
|
|
132
134
|
token_count=token_count,
|
|
133
135
|
overlap_tokens=overlap_tokens,
|
|
134
136
|
).model_dump()
|
|
@@ -338,7 +340,8 @@ class AsyncVectorDatabase(ResourceBase):
|
|
|
338
340
|
self,
|
|
339
341
|
database_id: str,
|
|
340
342
|
files: List[str],
|
|
341
|
-
method: str,
|
|
343
|
+
method: Optional[str] = "accuracy-optimized",
|
|
344
|
+
chunking_method: Optional[str] = "markdown",
|
|
342
345
|
token_count: int = 800,
|
|
343
346
|
overlap_tokens: int = 100,
|
|
344
347
|
) -> VectorDatabaseIngestionResponse:
|
|
@@ -360,6 +363,7 @@ class AsyncVectorDatabase(ResourceBase):
|
|
|
360
363
|
parameter_payload = VectorDatabaseIngestionRequest(
|
|
361
364
|
file_ids=files,
|
|
362
365
|
method=method,
|
|
366
|
+
chunking_method=chunking_method,
|
|
363
367
|
token_count=token_count,
|
|
364
368
|
overlap_tokens=overlap_tokens,
|
|
365
369
|
).model_dump()
|
|
@@ -59,6 +59,7 @@ class RunRequest(BaseModel):
|
|
|
59
59
|
model_settings: ModelSettings = ModelSettings()
|
|
60
60
|
response_format: Optional[Union[ResponseFormat, Dict[str, Any], type]] = None
|
|
61
61
|
group: Optional[str] = None
|
|
62
|
+
metadata: Optional[Dict[str, str]] = None
|
|
62
63
|
|
|
63
64
|
|
|
64
65
|
class RunResponse(BaseModel):
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, List, Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import Field
|
|
6
|
+
|
|
7
|
+
from seekrai.types.abstract import BaseModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class InfluentialFinetuningDataResponse(BaseModel):
|
|
11
|
+
results: List[Dict[str, Any]] = Field(
|
|
12
|
+
..., description="List of influential training data results"
|
|
13
|
+
)
|
|
14
|
+
version: str = Field(..., description="Version of the explainability service")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InfluentialFinetuningDataRequest(BaseModel):
|
|
18
|
+
question: str = Field(..., description="Question from user")
|
|
19
|
+
system_prompt: Optional[str] = Field(
|
|
20
|
+
None,
|
|
21
|
+
description="System prompt for the user's question.",
|
|
22
|
+
)
|
|
23
|
+
answer: Optional[str] = Field(
|
|
24
|
+
None,
|
|
25
|
+
description="Answer of the finetuned model to the question; if None, the answer is retrieved from the finetuned model",
|
|
26
|
+
)
|
|
@@ -37,7 +37,12 @@ class VectorDatabaseIngestionRequest(BaseModel):
|
|
|
37
37
|
"""Request model for creating a new vector database ingestion job."""
|
|
38
38
|
|
|
39
39
|
file_ids: List[str] = Field(..., description="List of file IDs to ingest")
|
|
40
|
-
method: str = Field(
|
|
40
|
+
method: Optional[str] = Field(
|
|
41
|
+
default="accuracy-optimized", description="Method to use for ingestion"
|
|
42
|
+
)
|
|
43
|
+
chunking_method: Optional[str] = Field(
|
|
44
|
+
default="markdown", description="Configure how your content will be segmented"
|
|
45
|
+
)
|
|
41
46
|
token_count: int = Field(default=800, description="Token count for ingestion")
|
|
42
47
|
overlap_tokens: int = Field(default=100, description="Overlap tokens for ingestion")
|
|
43
48
|
|
|
@@ -1,57 +0,0 @@
|
|
|
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
|
|
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
|
|
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
|