seekrai 0.5.17__py3-none-any.whl → 0.5.25__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/client.py +2 -0
- seekrai/resources/__init__.py +16 -4
- seekrai/resources/alignment.py +460 -1
- seekrai/resources/finetune.py +44 -0
- seekrai/resources/tools.py +384 -0
- seekrai/resources/vectordb.py +30 -0
- seekrai/types/__init__.py +50 -3
- seekrai/types/agents/__init__.py +7 -6
- seekrai/types/agents/agent.py +18 -15
- seekrai/types/agents/tools/__init__.py +4 -4
- seekrai/types/agents/tools/schemas/file_search.py +10 -3
- seekrai/types/agents/tools/schemas/file_search_env.py +6 -0
- seekrai/types/agents/tools/schemas/run_python.py +10 -3
- seekrai/types/agents/tools/schemas/run_python_env.py +6 -0
- seekrai/types/agents/tools/schemas/web_search.py +10 -3
- seekrai/types/agents/tools/schemas/web_search_env.py +6 -0
- seekrai/types/agents/tools/tool.py +12 -9
- seekrai/types/alignment.py +36 -0
- seekrai/types/deployments.py +1 -0
- seekrai/types/enums.py +30 -0
- seekrai/types/files.py +2 -1
- seekrai/types/finetune.py +24 -7
- seekrai/types/tools.py +141 -0
- {seekrai-0.5.17.dist-info → seekrai-0.5.25.dist-info}/METADATA +7 -5
- {seekrai-0.5.17.dist-info → seekrai-0.5.25.dist-info}/RECORD +28 -25
- {seekrai-0.5.17.dist-info → seekrai-0.5.25.dist-info}/WHEEL +1 -1
- {seekrai-0.5.17.dist-info → seekrai-0.5.25.dist-info}/entry_points.txt +0 -0
- {seekrai-0.5.17.dist-info → seekrai-0.5.25.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Tool management resource for SeekrAI SDK.
|
|
3
|
+
|
|
4
|
+
This module provides functionality to manage tools independently of agents,
|
|
5
|
+
including creation, listing, retrieval, updating, deletion, and duplication.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Any, List, Optional
|
|
9
|
+
|
|
10
|
+
from pydantic import TypeAdapter
|
|
11
|
+
|
|
12
|
+
from seekrai.abstract import api_requestor
|
|
13
|
+
from seekrai.seekrflow_response import SeekrFlowResponse
|
|
14
|
+
from seekrai.types import (
|
|
15
|
+
GetToolsResponse,
|
|
16
|
+
SeekrFlowClient,
|
|
17
|
+
SeekrFlowRequest,
|
|
18
|
+
ToolAgentSummaryResponse,
|
|
19
|
+
ToolDeleteResponse,
|
|
20
|
+
ToolResponse,
|
|
21
|
+
)
|
|
22
|
+
from seekrai.types.enums import ToolStatus, ToolType
|
|
23
|
+
from seekrai.types.tools import CreateToolRequest, UpdateToolRequest
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
TOOL_RESPONSE_ADAPTER: TypeAdapter[ToolResponse] = TypeAdapter(ToolResponse)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Tools:
|
|
30
|
+
"""Tool management resource for managing tools independently of agents."""
|
|
31
|
+
|
|
32
|
+
def __init__(self, client: SeekrFlowClient) -> None:
|
|
33
|
+
self._client = client
|
|
34
|
+
self._requestor = api_requestor.APIRequestor(client=self._client)
|
|
35
|
+
|
|
36
|
+
def create(self, request: CreateToolRequest) -> ToolResponse:
|
|
37
|
+
"""
|
|
38
|
+
Create a new tool.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
request: Tool creation request containing name and typed tool object
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
Created tool response
|
|
45
|
+
"""
|
|
46
|
+
response, _, _ = self._requestor.request(
|
|
47
|
+
options=SeekrFlowRequest(
|
|
48
|
+
method="POST",
|
|
49
|
+
url="flow/tools",
|
|
50
|
+
params=request.model_dump(by_alias=True),
|
|
51
|
+
),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
55
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
56
|
+
|
|
57
|
+
def list(
|
|
58
|
+
self,
|
|
59
|
+
offset: int = 0,
|
|
60
|
+
limit: int = 100,
|
|
61
|
+
tool_type: Optional[ToolType] = None,
|
|
62
|
+
tool_status: Optional[ToolStatus] = None,
|
|
63
|
+
) -> GetToolsResponse:
|
|
64
|
+
"""
|
|
65
|
+
List tools with pagination and filtering.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
offset: Number of records to skip
|
|
69
|
+
limit: Maximum number of records to return (1-1000)
|
|
70
|
+
tool_type: Filter by tool type
|
|
71
|
+
tool_status: Filter by tool status
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Paginated list of tools
|
|
75
|
+
"""
|
|
76
|
+
params: dict[str, Any] = {
|
|
77
|
+
"offset": offset,
|
|
78
|
+
"limit": limit,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if tool_type is not None:
|
|
82
|
+
params["tool_type"] = tool_type.value
|
|
83
|
+
if tool_status is not None:
|
|
84
|
+
params["tool_status"] = tool_status.value
|
|
85
|
+
|
|
86
|
+
response, _, _ = self._requestor.request(
|
|
87
|
+
options=SeekrFlowRequest(
|
|
88
|
+
method="GET",
|
|
89
|
+
url="flow/tools",
|
|
90
|
+
params=params,
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
95
|
+
return GetToolsResponse(**response.data)
|
|
96
|
+
|
|
97
|
+
def list_agents(self, tool_id: str) -> List[ToolAgentSummaryResponse]:
|
|
98
|
+
"""
|
|
99
|
+
List agent summaries linked to this tool.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
tool_id: Tool ID linked to agents
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
List of agent summaries
|
|
106
|
+
"""
|
|
107
|
+
response, _, _ = self._requestor.request(
|
|
108
|
+
options=SeekrFlowRequest(
|
|
109
|
+
method="GET",
|
|
110
|
+
url=f"flow/tools/{tool_id}/agents",
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
115
|
+
assert isinstance(response.data, list)
|
|
116
|
+
return [ToolAgentSummaryResponse(**agent_tool) for agent_tool in response.data]
|
|
117
|
+
|
|
118
|
+
def retrieve(self, tool_id: str) -> ToolResponse:
|
|
119
|
+
"""
|
|
120
|
+
Retrieve a specific tool by ID.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
tool_id: Tool ID to retrieve
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
Tool response
|
|
127
|
+
"""
|
|
128
|
+
response, _, _ = self._requestor.request(
|
|
129
|
+
options=SeekrFlowRequest(
|
|
130
|
+
method="GET",
|
|
131
|
+
url=f"flow/tools/{tool_id}",
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
136
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
137
|
+
|
|
138
|
+
def update(self, tool_id: str, request: UpdateToolRequest) -> ToolResponse:
|
|
139
|
+
"""
|
|
140
|
+
Update an existing tool.
|
|
141
|
+
|
|
142
|
+
Args:
|
|
143
|
+
tool_id: Tool ID to update
|
|
144
|
+
request: Tool update request containing updated fields
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Updated tool response
|
|
148
|
+
"""
|
|
149
|
+
response, _, _ = self._requestor.request(
|
|
150
|
+
options=SeekrFlowRequest(
|
|
151
|
+
method="PUT",
|
|
152
|
+
url=f"flow/tools/{tool_id}",
|
|
153
|
+
params=request.model_dump(by_alias=True),
|
|
154
|
+
),
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
158
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
159
|
+
|
|
160
|
+
def delete(self, tool_id: str) -> ToolDeleteResponse:
|
|
161
|
+
"""
|
|
162
|
+
Delete a tool if it's not referenced by active agents.
|
|
163
|
+
|
|
164
|
+
Args:
|
|
165
|
+
tool_id: Tool ID to delete
|
|
166
|
+
|
|
167
|
+
Returns:
|
|
168
|
+
Deletion response indicating success/failure
|
|
169
|
+
"""
|
|
170
|
+
response, _, _ = self._requestor.request(
|
|
171
|
+
options=SeekrFlowRequest(
|
|
172
|
+
method="DELETE",
|
|
173
|
+
url=f"flow/tools/{tool_id}",
|
|
174
|
+
),
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
178
|
+
return ToolDeleteResponse(**response.data)
|
|
179
|
+
|
|
180
|
+
def duplicate(self, tool_id: str, name: Optional[str]) -> ToolResponse:
|
|
181
|
+
"""
|
|
182
|
+
Duplicate an existing tool with a new name.
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
tool_id: Tool ID to duplicate
|
|
186
|
+
name (optional): Name for duplicated tool
|
|
187
|
+
|
|
188
|
+
Returns:
|
|
189
|
+
New tool response
|
|
190
|
+
"""
|
|
191
|
+
params = {}
|
|
192
|
+
if name is not None:
|
|
193
|
+
params["name"] = name
|
|
194
|
+
|
|
195
|
+
response, _, _ = self._requestor.request(
|
|
196
|
+
options=SeekrFlowRequest(
|
|
197
|
+
method="POST",
|
|
198
|
+
url=f"flow/tools/{tool_id}/duplicate",
|
|
199
|
+
params=params,
|
|
200
|
+
),
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
204
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class AsyncTools:
|
|
208
|
+
"""Async tool management resource for managing tools independently of agents."""
|
|
209
|
+
|
|
210
|
+
def __init__(self, client: SeekrFlowClient) -> None:
|
|
211
|
+
self._client = client
|
|
212
|
+
self._requestor = api_requestor.APIRequestor(client=self._client)
|
|
213
|
+
|
|
214
|
+
async def create(self, request: CreateToolRequest) -> ToolResponse:
|
|
215
|
+
"""
|
|
216
|
+
Create a new tool.
|
|
217
|
+
|
|
218
|
+
Args:
|
|
219
|
+
request: Tool creation request containing name and typed tool object
|
|
220
|
+
|
|
221
|
+
Returns:
|
|
222
|
+
Created tool response
|
|
223
|
+
"""
|
|
224
|
+
response, _, _ = await self._requestor.arequest(
|
|
225
|
+
options=SeekrFlowRequest(
|
|
226
|
+
method="POST",
|
|
227
|
+
url="flow/tools",
|
|
228
|
+
params=request.model_dump(by_alias=True),
|
|
229
|
+
),
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
233
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
234
|
+
|
|
235
|
+
async def list(
|
|
236
|
+
self,
|
|
237
|
+
offset: int = 0,
|
|
238
|
+
limit: int = 100,
|
|
239
|
+
tool_type: Optional[ToolType] = None,
|
|
240
|
+
tool_status: Optional[ToolStatus] = None,
|
|
241
|
+
) -> GetToolsResponse:
|
|
242
|
+
"""
|
|
243
|
+
List tools with pagination and filtering.
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
offset: Number of records to skip
|
|
247
|
+
limit: Maximum number of records to return (1-1000)
|
|
248
|
+
tool_type: Filter by tool type
|
|
249
|
+
tool_status: Filter by tool status
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
Paginated list of tools
|
|
253
|
+
"""
|
|
254
|
+
params: dict[str, Any] = {
|
|
255
|
+
"offset": offset,
|
|
256
|
+
"limit": limit,
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if tool_type is not None:
|
|
260
|
+
params["tool_type"] = tool_type.value
|
|
261
|
+
if tool_status is not None:
|
|
262
|
+
params["tool_status"] = tool_status.value
|
|
263
|
+
|
|
264
|
+
response, _, _ = await self._requestor.arequest(
|
|
265
|
+
options=SeekrFlowRequest(
|
|
266
|
+
method="GET",
|
|
267
|
+
url="flow/tools",
|
|
268
|
+
params=params,
|
|
269
|
+
),
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
273
|
+
return GetToolsResponse(**response.data)
|
|
274
|
+
|
|
275
|
+
async def list_agents(self, tool_id: str) -> List[ToolAgentSummaryResponse]:
|
|
276
|
+
"""
|
|
277
|
+
List agent summaries linked to this tool.
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
tool_id: Tool ID linked to agents
|
|
281
|
+
|
|
282
|
+
Returns:
|
|
283
|
+
List of agent summaries
|
|
284
|
+
"""
|
|
285
|
+
response, _, _ = await self._requestor.arequest(
|
|
286
|
+
options=SeekrFlowRequest(
|
|
287
|
+
method="GET",
|
|
288
|
+
url=f"flow/tools/{tool_id}/agents",
|
|
289
|
+
),
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
293
|
+
assert isinstance(response.data, list)
|
|
294
|
+
return [ToolAgentSummaryResponse(**agent_tool) for agent_tool in response.data]
|
|
295
|
+
|
|
296
|
+
async def retrieve(self, tool_id: str) -> ToolResponse:
|
|
297
|
+
"""
|
|
298
|
+
Retrieve a specific tool by ID.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
tool_id: Tool ID to retrieve
|
|
302
|
+
|
|
303
|
+
Returns:
|
|
304
|
+
Tool response
|
|
305
|
+
"""
|
|
306
|
+
response, _, _ = await self._requestor.arequest(
|
|
307
|
+
options=SeekrFlowRequest(
|
|
308
|
+
method="GET",
|
|
309
|
+
url=f"flow/tools/{tool_id}",
|
|
310
|
+
),
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
314
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
315
|
+
|
|
316
|
+
async def update(self, tool_id: str, request: UpdateToolRequest) -> ToolResponse:
|
|
317
|
+
"""
|
|
318
|
+
Update an existing tool.
|
|
319
|
+
|
|
320
|
+
Args:
|
|
321
|
+
tool_id: Tool ID to update
|
|
322
|
+
request: Tool update request containing updated fields
|
|
323
|
+
|
|
324
|
+
Returns:
|
|
325
|
+
Updated tool response
|
|
326
|
+
"""
|
|
327
|
+
response, _, _ = await self._requestor.arequest(
|
|
328
|
+
options=SeekrFlowRequest(
|
|
329
|
+
method="PUT",
|
|
330
|
+
url=f"flow/tools/{tool_id}",
|
|
331
|
+
params=request.model_dump(by_alias=True),
|
|
332
|
+
),
|
|
333
|
+
)
|
|
334
|
+
|
|
335
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
336
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
|
337
|
+
|
|
338
|
+
async def delete(self, tool_id: str) -> ToolDeleteResponse:
|
|
339
|
+
"""
|
|
340
|
+
Delete a tool if it's not referenced by active agents.
|
|
341
|
+
|
|
342
|
+
Args:
|
|
343
|
+
tool_id: Tool ID to delete
|
|
344
|
+
|
|
345
|
+
Returns:
|
|
346
|
+
Deletion response indicating success/failure
|
|
347
|
+
"""
|
|
348
|
+
response, _, _ = await self._requestor.arequest(
|
|
349
|
+
options=SeekrFlowRequest(
|
|
350
|
+
method="DELETE",
|
|
351
|
+
url=f"flow/tools/{tool_id}",
|
|
352
|
+
),
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
356
|
+
return ToolDeleteResponse(**response.data)
|
|
357
|
+
|
|
358
|
+
async def duplicate(
|
|
359
|
+
self,
|
|
360
|
+
tool_id: str,
|
|
361
|
+
name: Optional[str],
|
|
362
|
+
) -> ToolResponse:
|
|
363
|
+
"""
|
|
364
|
+
Duplicate an existing tool with a new name.
|
|
365
|
+
|
|
366
|
+
Args:
|
|
367
|
+
tool_id: Tool ID to duplicate
|
|
368
|
+
name (optional): Name for duplicated tool
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
New tool response
|
|
372
|
+
"""
|
|
373
|
+
params = {}
|
|
374
|
+
if name is not None:
|
|
375
|
+
params["name"] = name
|
|
376
|
+
|
|
377
|
+
response, _, _ = await self._requestor.arequest(
|
|
378
|
+
options=SeekrFlowRequest(
|
|
379
|
+
method="POST", url=f"flow/tools/{tool_id}/duplicate", params=params
|
|
380
|
+
),
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
assert isinstance(response, SeekrFlowResponse)
|
|
384
|
+
return TOOL_RESPONSE_ADAPTER.validate_python(response.data)
|
seekrai/resources/vectordb.py
CHANGED
|
@@ -250,6 +250,21 @@ class VectorDatabase(ResourceBase):
|
|
|
250
250
|
# The endpoint returns 204 No Content
|
|
251
251
|
return None
|
|
252
252
|
|
|
253
|
+
def delete_file(self, database_id: str, file_id: str) -> None:
|
|
254
|
+
"""Delete a file from a vector database."""
|
|
255
|
+
requestor = api_requestor.APIRequestor(client=self._client)
|
|
256
|
+
|
|
257
|
+
response, _, _ = requestor.request(
|
|
258
|
+
options=SeekrFlowRequest(
|
|
259
|
+
method="DELETE",
|
|
260
|
+
url=f"flow/vectordb/{database_id}/files/{file_id}",
|
|
261
|
+
),
|
|
262
|
+
stream=False,
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
# The endpoint returns 204 No Content
|
|
266
|
+
return None
|
|
267
|
+
|
|
253
268
|
|
|
254
269
|
class AsyncVectorDatabase(ResourceBase):
|
|
255
270
|
async def create(
|
|
@@ -484,3 +499,18 @@ class AsyncVectorDatabase(ResourceBase):
|
|
|
484
499
|
|
|
485
500
|
# The endpoint returns 204 No Content
|
|
486
501
|
return None
|
|
502
|
+
|
|
503
|
+
async def delete_file(self, database_id: str, file_id: str) -> None:
|
|
504
|
+
"""Delete a file from a vector database asynchronously."""
|
|
505
|
+
requestor = api_requestor.APIRequestor(client=self._client)
|
|
506
|
+
|
|
507
|
+
response, _, _ = await requestor.arequest(
|
|
508
|
+
options=SeekrFlowRequest(
|
|
509
|
+
method="DELETE",
|
|
510
|
+
url=f"flow/vectordb/{database_id}/files/{file_id}",
|
|
511
|
+
),
|
|
512
|
+
stream=False,
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
# The endpoint returns 204 No Content
|
|
516
|
+
return None
|
seekrai/types/__init__.py
CHANGED
|
@@ -2,7 +2,6 @@ from seekrai.types.abstract import SeekrFlowClient
|
|
|
2
2
|
from seekrai.types.agents import (
|
|
3
3
|
Agent,
|
|
4
4
|
AgentDeleteResponse,
|
|
5
|
-
AgentStatus,
|
|
6
5
|
CreateAgentRequest,
|
|
7
6
|
EnvConfig,
|
|
8
7
|
FileSearch,
|
|
@@ -16,7 +15,6 @@ from seekrai.types.agents import (
|
|
|
16
15
|
OutputGuardrail,
|
|
17
16
|
OutputMessage,
|
|
18
17
|
OutputText,
|
|
19
|
-
ReasoningEffort,
|
|
20
18
|
Run,
|
|
21
19
|
RunPython,
|
|
22
20
|
RunPythonEnv,
|
|
@@ -44,7 +42,7 @@ from seekrai.types.agents import (
|
|
|
44
42
|
ThreadStatus,
|
|
45
43
|
Tool,
|
|
46
44
|
ToolBase,
|
|
47
|
-
|
|
45
|
+
UpdateAgentRequest,
|
|
48
46
|
WebSearch,
|
|
49
47
|
WebSearchEnv,
|
|
50
48
|
)
|
|
@@ -61,9 +59,13 @@ from seekrai.types.alignment import (
|
|
|
61
59
|
AlignmentEstimationResponse,
|
|
62
60
|
AlignmentJobStatus,
|
|
63
61
|
AlignmentList,
|
|
62
|
+
AlignmentOutput,
|
|
64
63
|
AlignmentRequest,
|
|
65
64
|
AlignmentResponse,
|
|
66
65
|
AlignmentType,
|
|
66
|
+
SystemPrompt,
|
|
67
|
+
SystemPromptCreateRequest,
|
|
68
|
+
SystemPromptUpdateRequest,
|
|
67
69
|
)
|
|
68
70
|
from seekrai.types.chat_completions import (
|
|
69
71
|
ChatCompletionChunk,
|
|
@@ -86,6 +88,7 @@ from seekrai.types.deployments import (
|
|
|
86
88
|
NewDeploymentRequest,
|
|
87
89
|
)
|
|
88
90
|
from seekrai.types.embeddings import EmbeddingRequest, EmbeddingResponse
|
|
91
|
+
from seekrai.types.enums import AgentStatus, ReasoningEffort, ToolStatus, ToolType
|
|
89
92
|
from seekrai.types.files import (
|
|
90
93
|
FileDeleteResponse,
|
|
91
94
|
FileList,
|
|
@@ -102,6 +105,7 @@ from seekrai.types.finetune import (
|
|
|
102
105
|
FinetuneRequest,
|
|
103
106
|
FinetuneResponse,
|
|
104
107
|
InfrastructureConfig,
|
|
108
|
+
LoRAConfig,
|
|
105
109
|
TrainingConfig,
|
|
106
110
|
)
|
|
107
111
|
from seekrai.types.images import (
|
|
@@ -115,6 +119,25 @@ from seekrai.types.projects import (
|
|
|
115
119
|
Project,
|
|
116
120
|
ProjectWithRuns,
|
|
117
121
|
)
|
|
122
|
+
from seekrai.types.tools import (
|
|
123
|
+
CreateFileSearch,
|
|
124
|
+
CreateRunPython,
|
|
125
|
+
CreateToolRequest,
|
|
126
|
+
CreateWebSearch,
|
|
127
|
+
FileSearchConfig,
|
|
128
|
+
FileSearchTool,
|
|
129
|
+
GetToolsResponse,
|
|
130
|
+
RunPythonConfig,
|
|
131
|
+
RunPythonTool,
|
|
132
|
+
ToolAgentSummaryResponse,
|
|
133
|
+
ToolDeleteResponse,
|
|
134
|
+
ToolResponse,
|
|
135
|
+
UpdateFileSearch,
|
|
136
|
+
UpdateRunPython,
|
|
137
|
+
UpdateToolRequest,
|
|
138
|
+
UpdateWebSearch,
|
|
139
|
+
WebSearchTool,
|
|
140
|
+
)
|
|
118
141
|
|
|
119
142
|
|
|
120
143
|
__all__ = [
|
|
@@ -135,6 +158,7 @@ __all__ = [
|
|
|
135
158
|
"FinetuneDownloadResult",
|
|
136
159
|
"InfrastructureConfig",
|
|
137
160
|
"TrainingConfig",
|
|
161
|
+
"LoRAConfig",
|
|
138
162
|
"FileRequest",
|
|
139
163
|
"FileResponse",
|
|
140
164
|
"FileList",
|
|
@@ -151,8 +175,12 @@ __all__ = [
|
|
|
151
175
|
"AlignmentEstimationResponse",
|
|
152
176
|
"AlignmentResponse",
|
|
153
177
|
"AlignmentJobStatus",
|
|
178
|
+
"AlignmentOutput",
|
|
154
179
|
"AlignmentList",
|
|
155
180
|
"AlignmentType",
|
|
181
|
+
"SystemPrompt",
|
|
182
|
+
"SystemPromptCreateRequest",
|
|
183
|
+
"SystemPromptUpdateRequest",
|
|
156
184
|
"Project",
|
|
157
185
|
"ProjectWithRuns",
|
|
158
186
|
"GetProjectsResponse",
|
|
@@ -199,12 +227,31 @@ __all__ = [
|
|
|
199
227
|
"Agent",
|
|
200
228
|
"AgentStatus",
|
|
201
229
|
"CreateAgentRequest",
|
|
230
|
+
"UpdateAgentRequest",
|
|
202
231
|
"ReasoningEffort",
|
|
203
232
|
"AgentDeleteResponse",
|
|
204
233
|
"ToolBase",
|
|
205
234
|
"ToolType",
|
|
206
235
|
"EnvConfig",
|
|
207
236
|
"Tool",
|
|
237
|
+
"ToolStatus",
|
|
238
|
+
"FileSearchConfig",
|
|
239
|
+
"RunPythonConfig",
|
|
240
|
+
"CreateFileSearch",
|
|
241
|
+
"CreateWebSearch",
|
|
242
|
+
"CreateRunPython",
|
|
243
|
+
"CreateToolRequest",
|
|
244
|
+
"UpdateWebSearch",
|
|
245
|
+
"UpdateFileSearch",
|
|
246
|
+
"UpdateRunPython",
|
|
247
|
+
"UpdateToolRequest",
|
|
248
|
+
"ToolResponse",
|
|
249
|
+
"FileSearchTool",
|
|
250
|
+
"WebSearchTool",
|
|
251
|
+
"RunPythonTool",
|
|
252
|
+
"GetToolsResponse",
|
|
253
|
+
"ToolAgentSummaryResponse",
|
|
254
|
+
"ToolDeleteResponse",
|
|
208
255
|
"FileSearch",
|
|
209
256
|
"FileSearchEnv",
|
|
210
257
|
"RunPython",
|
seekrai/types/agents/__init__.py
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
from seekrai.types.agents.agent import (
|
|
2
2
|
Agent,
|
|
3
3
|
AgentDeleteResponse,
|
|
4
|
-
AgentStatus,
|
|
5
4
|
CreateAgentRequest,
|
|
6
|
-
|
|
5
|
+
UpdateAgentRequest,
|
|
7
6
|
)
|
|
8
7
|
from seekrai.types.agents.python_functions import (
|
|
9
8
|
DeletePythonFunctionResponse,
|
|
@@ -46,7 +45,11 @@ from seekrai.types.agents.threads import (
|
|
|
46
45
|
ThreadMessageContentType,
|
|
47
46
|
ThreadStatus,
|
|
48
47
|
)
|
|
49
|
-
from seekrai.types.agents.tools import
|
|
48
|
+
from seekrai.types.agents.tools import (
|
|
49
|
+
EnvConfig,
|
|
50
|
+
Tool,
|
|
51
|
+
ToolBase,
|
|
52
|
+
)
|
|
50
53
|
from seekrai.types.agents.tools.schemas import (
|
|
51
54
|
FileSearch,
|
|
52
55
|
FileSearchEnv,
|
|
@@ -91,12 +94,10 @@ __all__ = [
|
|
|
91
94
|
"ThreadMessage",
|
|
92
95
|
"ThreadMessageContentType",
|
|
93
96
|
"Agent",
|
|
94
|
-
"AgentStatus",
|
|
95
97
|
"CreateAgentRequest",
|
|
96
|
-
"
|
|
98
|
+
"UpdateAgentRequest",
|
|
97
99
|
"AgentDeleteResponse",
|
|
98
100
|
"ToolBase",
|
|
99
|
-
"ToolType",
|
|
100
101
|
"EnvConfig",
|
|
101
102
|
"Tool",
|
|
102
103
|
"FileSearch",
|
seekrai/types/agents/agent.py
CHANGED
|
@@ -1,31 +1,34 @@
|
|
|
1
|
-
import enum
|
|
2
1
|
from datetime import datetime
|
|
3
2
|
from typing import Optional
|
|
4
3
|
|
|
5
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
6
5
|
|
|
7
6
|
from seekrai.types.agents.tools.tool_types import Tool
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class AgentStatus(str, enum.Enum):
|
|
11
|
-
INACTIVE = "Inactive"
|
|
12
|
-
PENDING = "Pending"
|
|
13
|
-
ACTIVE = "Active"
|
|
14
|
-
FAILED = "Failed"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class ReasoningEffort(str, enum.Enum):
|
|
18
|
-
PERFORMANCE_OPTIMIZED = "performance_optimized"
|
|
19
|
-
SPEED_OPTIMIZED = "speed_optimized"
|
|
7
|
+
from seekrai.types.enums import AgentStatus, ReasoningEffort
|
|
20
8
|
|
|
21
9
|
|
|
22
10
|
class CreateAgentRequest(BaseModel):
|
|
11
|
+
model_config = ConfigDict(extra="forbid")
|
|
12
|
+
|
|
23
13
|
name: str
|
|
24
14
|
instructions: str
|
|
25
|
-
tools: list[Tool]
|
|
15
|
+
tools: Optional[list[Tool]] = Field(
|
|
16
|
+
deprecated="This field is deprecated. Use tool_ids instead.",
|
|
17
|
+
default=None,
|
|
18
|
+
)
|
|
19
|
+
tool_ids: Optional[list[str]] = None
|
|
26
20
|
model_id: str
|
|
27
21
|
reasoning_effort: Optional[ReasoningEffort] = None
|
|
28
22
|
|
|
23
|
+
@model_validator(mode="after")
|
|
24
|
+
def validate_tools_or_tool_ids(self) -> "CreateAgentRequest":
|
|
25
|
+
"""Validate that either tools or tool_ids is provided, but not both."""
|
|
26
|
+
if self.tools is not None and self.tool_ids is not None:
|
|
27
|
+
raise ValueError(
|
|
28
|
+
"Only one of 'tools' or 'tool_ids' can be provided, but both were provided."
|
|
29
|
+
)
|
|
30
|
+
return self
|
|
31
|
+
|
|
29
32
|
|
|
30
33
|
class Agent(BaseModel):
|
|
31
34
|
model_config = ConfigDict(from_attributes=True)
|
|
@@ -7,15 +7,15 @@ from seekrai.types.agents.tools.schemas import (
|
|
|
7
7
|
WebSearch,
|
|
8
8
|
WebSearchEnv,
|
|
9
9
|
)
|
|
10
|
-
from seekrai.types.agents.tools.tool import ToolBase
|
|
11
|
-
from seekrai.types.agents.tools.tool_types import
|
|
10
|
+
from seekrai.types.agents.tools.tool import ToolBase
|
|
11
|
+
from seekrai.types.agents.tools.tool_types import (
|
|
12
|
+
Tool,
|
|
13
|
+
)
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
__all__ = [
|
|
15
17
|
"ToolBase",
|
|
16
|
-
"ToolType",
|
|
17
18
|
"EnvConfig",
|
|
18
|
-
"Env",
|
|
19
19
|
"Tool",
|
|
20
20
|
"FileSearch",
|
|
21
21
|
"FileSearchEnv",
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
from typing import Literal
|
|
2
2
|
|
|
3
3
|
from seekrai.types.agents.tools.schemas.file_search_env import FileSearchEnv
|
|
4
|
-
from seekrai.types.agents.tools.tool import ToolBase
|
|
4
|
+
from seekrai.types.agents.tools.tool import ToolBase
|
|
5
|
+
from seekrai.types.enums import ToolType
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
class FileSearch(ToolBase[FileSearchEnv]):
|
|
8
|
-
name: Literal[
|
|
8
|
+
class FileSearch(ToolBase[Literal["file_search"], FileSearchEnv]):
|
|
9
|
+
name: Literal["file_search"] = ToolType.FILE_SEARCH.value
|
|
9
10
|
tool_env: FileSearchEnv
|
|
11
|
+
|
|
12
|
+
model_config = {
|
|
13
|
+
"json_schema_extra": {
|
|
14
|
+
"deprecated": True,
|
|
15
|
+
}
|
|
16
|
+
}
|