seekrai 0.5.24__tar.gz → 0.5.25__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.24 → seekrai-0.5.25}/PKG-INFO +7 -3
- {seekrai-0.5.24 → seekrai-0.5.25}/pyproject.toml +2 -1
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/client.py +2 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/__init__.py +8 -3
- seekrai-0.5.25/src/seekrai/resources/tools.py +384 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/__init__.py +40 -3
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/__init__.py +7 -6
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/agent.py +18 -15
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/__init__.py +4 -4
- seekrai-0.5.25/src/seekrai/types/agents/tools/schemas/file_search.py +16 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/schemas/file_search_env.py +6 -0
- seekrai-0.5.25/src/seekrai/types/agents/tools/schemas/run_python.py +16 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/schemas/run_python_env.py +6 -0
- seekrai-0.5.25/src/seekrai/types/agents/tools/schemas/web_search.py +16 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/schemas/web_search_env.py +6 -0
- seekrai-0.5.25/src/seekrai/types/agents/tools/tool.py +23 -0
- seekrai-0.5.25/src/seekrai/types/enums.py +30 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/files.py +1 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/finetune.py +1 -1
- seekrai-0.5.25/src/seekrai/types/tools.py +141 -0
- seekrai-0.5.24/src/seekrai/types/agents/tools/schemas/file_search.py +0 -9
- seekrai-0.5.24/src/seekrai/types/agents/tools/schemas/run_python.py +0 -9
- seekrai-0.5.24/src/seekrai/types/agents/tools/schemas/web_search.py +0 -9
- seekrai-0.5.24/src/seekrai/types/agents/tools/tool.py +0 -20
- {seekrai-0.5.24 → seekrai-0.5.25}/LICENSE +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/README.md +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/abstract/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/abstract/api_requestor.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/abstract/response_parsing.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/constants.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/error.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/filemanager.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/agents/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/agents/agent_inference.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/agents/agent_observability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/agents/agents.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/agents/python_functions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/agents/threads.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/alignment.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/chat/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/chat/completions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/completions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/deployments.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/embeddings.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/explainability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/files.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/finetune.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/images.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/ingestion.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/models.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/projects.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/resource_base.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/resources/vectordb.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/seekrflow_response.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/abstract.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/observability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/python_functions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/runs.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/threads.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/env_model_config.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/schemas/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/agents/tools/tool_types.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/alignment.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/chat_completions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/common.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/completions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/deployments.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/embeddings.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/error.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/explainability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/images.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/ingestion.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/models.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/projects.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/types/vectordb.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/utils/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/utils/_log.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/utils/api_helpers.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/utils/files.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/utils/tools.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.25}/src/seekrai/version.py +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: seekrai
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.25
|
|
4
4
|
Summary: Python client for SeekrAI
|
|
5
|
-
Home-page: https://www.seekr.com
|
|
6
5
|
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
7
|
Author: SeekrFlow
|
|
8
8
|
Author-email: support@seekr.com
|
|
9
9
|
Requires-Python: >=3.9,<4.0
|
|
@@ -13,6 +13,9 @@ Classifier: Programming Language :: Python :: 3
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
19
|
Requires-Dist: click (>=8.1.7,<9.0.0)
|
|
17
20
|
Requires-Dist: eval-type-backport (>=0.1.3,<0.3.0)
|
|
18
21
|
Requires-Dist: filelock (>=3.13.1,<4.0.0)
|
|
@@ -26,6 +29,7 @@ Requires-Dist: requests (>=2.31.0,<3.0.0)
|
|
|
26
29
|
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
|
27
30
|
Requires-Dist: tqdm (>=4.66.2,<5.0.0)
|
|
28
31
|
Requires-Dist: typer (>=0.9,<0.13)
|
|
32
|
+
Project-URL: Homepage, https://www.seekr.com
|
|
29
33
|
Description-Content-Type: text/markdown
|
|
30
34
|
|
|
31
35
|
The Seekr Python Library is the official Python client for SeekrFlow's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.9+ applications with easy to use synchronous and asynchronous clients.
|
|
@@ -13,7 +13,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
13
13
|
|
|
14
14
|
[tool.poetry]
|
|
15
15
|
name = "seekrai"
|
|
16
|
-
version = "0.5.
|
|
16
|
+
version = "0.5.25"
|
|
17
17
|
authors = [
|
|
18
18
|
"SeekrFlow <support@seekr.com>"
|
|
19
19
|
]
|
|
@@ -65,6 +65,7 @@ pytest = ">=7.4.2,<9.0.0"
|
|
|
65
65
|
pytest-watch = "^4.2.0"
|
|
66
66
|
tox = "^4.14.1"
|
|
67
67
|
pytest-asyncio = "^0.26.0"
|
|
68
|
+
tenacity = "^8.5.0"
|
|
68
69
|
|
|
69
70
|
[tool.poetry.group.dev.dependencies]
|
|
70
71
|
ipdb = "^0.13.13"
|
|
@@ -91,6 +91,7 @@ class SeekrFlow:
|
|
|
91
91
|
self.deployments = resources.Deployments(self.client)
|
|
92
92
|
self.vector_database = resources.VectorDatabase(self.client)
|
|
93
93
|
self.agents = resources.Agents(self.client)
|
|
94
|
+
self.tools = resources.Tools(self.client)
|
|
94
95
|
self.observability = resources.AgentObservability(self.client)
|
|
95
96
|
self.explainability = resources.Explainability(self.client)
|
|
96
97
|
|
|
@@ -176,6 +177,7 @@ class AsyncSeekrFlow:
|
|
|
176
177
|
self.deployments = resources.AsyncDeployments(self.client)
|
|
177
178
|
self.vector_database = resources.AsyncVectorDatabase(self.client)
|
|
178
179
|
self.agents = resources.AsyncAgents(self.client)
|
|
180
|
+
self.tools = resources.AsyncTools(self.client)
|
|
179
181
|
self.observability = resources.AsyncAgentObservability(self.client)
|
|
180
182
|
self.explainability = resources.AsyncExplainability(self.client)
|
|
181
183
|
|
|
@@ -2,6 +2,7 @@ from seekrai.resources.agents import (
|
|
|
2
2
|
AgentInference,
|
|
3
3
|
AgentObservability,
|
|
4
4
|
Agents,
|
|
5
|
+
AsyncAgentInference,
|
|
5
6
|
AsyncAgentObservability,
|
|
6
7
|
AsyncAgents,
|
|
7
8
|
)
|
|
@@ -22,6 +23,7 @@ from seekrai.resources.images import AsyncImages, Images
|
|
|
22
23
|
from seekrai.resources.ingestion import AsyncIngestion, Ingestion
|
|
23
24
|
from seekrai.resources.models import AsyncModels, Models
|
|
24
25
|
from seekrai.resources.projects import AsyncProjects, Projects
|
|
26
|
+
from seekrai.resources.tools import AsyncTools, Tools
|
|
25
27
|
from seekrai.resources.vectordb import AsyncVectorDatabase, VectorDatabase
|
|
26
28
|
|
|
27
29
|
|
|
@@ -42,8 +44,8 @@ __all__ = [
|
|
|
42
44
|
"Files",
|
|
43
45
|
"AsyncImages",
|
|
44
46
|
"Images",
|
|
45
|
-
"Ingestion",
|
|
46
47
|
"AsyncIngestion",
|
|
48
|
+
"Ingestion",
|
|
47
49
|
"AsyncModels",
|
|
48
50
|
"Models",
|
|
49
51
|
"AsyncProjects",
|
|
@@ -52,11 +54,14 @@ __all__ = [
|
|
|
52
54
|
"Deployments",
|
|
53
55
|
"AsyncAgents",
|
|
54
56
|
"Agents",
|
|
55
|
-
"AgentObservability",
|
|
56
57
|
"AsyncAgentObservability",
|
|
57
|
-
"
|
|
58
|
+
"AgentObservability",
|
|
58
59
|
"AsyncVectorDatabase",
|
|
60
|
+
"VectorDatabase",
|
|
61
|
+
"AsyncAgentInference",
|
|
59
62
|
"AgentInference",
|
|
60
63
|
"AsyncExplainability",
|
|
61
64
|
"Explainability",
|
|
65
|
+
"AsyncTools",
|
|
66
|
+
"Tools",
|
|
62
67
|
]
|
|
@@ -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)
|
|
@@ -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
|
)
|
|
@@ -90,6 +88,7 @@ from seekrai.types.deployments import (
|
|
|
90
88
|
NewDeploymentRequest,
|
|
91
89
|
)
|
|
92
90
|
from seekrai.types.embeddings import EmbeddingRequest, EmbeddingResponse
|
|
91
|
+
from seekrai.types.enums import AgentStatus, ReasoningEffort, ToolStatus, ToolType
|
|
93
92
|
from seekrai.types.files import (
|
|
94
93
|
FileDeleteResponse,
|
|
95
94
|
FileList,
|
|
@@ -120,6 +119,25 @@ from seekrai.types.projects import (
|
|
|
120
119
|
Project,
|
|
121
120
|
ProjectWithRuns,
|
|
122
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
|
+
)
|
|
123
141
|
|
|
124
142
|
|
|
125
143
|
__all__ = [
|
|
@@ -209,12 +227,31 @@ __all__ = [
|
|
|
209
227
|
"Agent",
|
|
210
228
|
"AgentStatus",
|
|
211
229
|
"CreateAgentRequest",
|
|
230
|
+
"UpdateAgentRequest",
|
|
212
231
|
"ReasoningEffort",
|
|
213
232
|
"AgentDeleteResponse",
|
|
214
233
|
"ToolBase",
|
|
215
234
|
"ToolType",
|
|
216
235
|
"EnvConfig",
|
|
217
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",
|
|
218
255
|
"FileSearch",
|
|
219
256
|
"FileSearchEnv",
|
|
220
257
|
"RunPython",
|
|
@@ -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",
|
|
@@ -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",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from seekrai.types.agents.tools.schemas.file_search_env import FileSearchEnv
|
|
4
|
+
from seekrai.types.agents.tools.tool import ToolBase
|
|
5
|
+
from seekrai.types.enums import ToolType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class FileSearch(ToolBase[Literal["file_search"], FileSearchEnv]):
|
|
9
|
+
name: Literal["file_search"] = ToolType.FILE_SEARCH.value
|
|
10
|
+
tool_env: FileSearchEnv
|
|
11
|
+
|
|
12
|
+
model_config = {
|
|
13
|
+
"json_schema_extra": {
|
|
14
|
+
"deprecated": True,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from seekrai.types.agents.tools.schemas.run_python_env import RunPythonEnv
|
|
4
|
+
from seekrai.types.agents.tools.tool import ToolBase
|
|
5
|
+
from seekrai.types.enums import ToolType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RunPython(ToolBase[Literal["run_python"], RunPythonEnv]):
|
|
9
|
+
name: Literal["run_python"] = ToolType.RUN_PYTHON.value
|
|
10
|
+
tool_env: RunPythonEnv
|
|
11
|
+
|
|
12
|
+
model_config = {
|
|
13
|
+
"json_schema_extra": {
|
|
14
|
+
"deprecated": True,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -6,3 +6,9 @@ from seekrai.types.agents.tools.env_model_config import EnvConfig
|
|
|
6
6
|
class RunPythonEnv(EnvConfig):
|
|
7
7
|
run_python_tool_desc: Optional[str] = None
|
|
8
8
|
function_ids: Optional[list[str]] = None
|
|
9
|
+
|
|
10
|
+
model_config = {
|
|
11
|
+
"json_schema_extra": {
|
|
12
|
+
"deprecated": True,
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from seekrai.types.agents.tools.schemas.web_search_env import WebSearchEnv
|
|
4
|
+
from seekrai.types.agents.tools.tool import ToolBase
|
|
5
|
+
from seekrai.types.enums import ToolType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class WebSearch(ToolBase[Literal["web_search"], WebSearchEnv]):
|
|
9
|
+
name: Literal["web_search"] = ToolType.WEB_SEARCH.value
|
|
10
|
+
tool_env: WebSearchEnv
|
|
11
|
+
|
|
12
|
+
model_config = {
|
|
13
|
+
"json_schema_extra": {
|
|
14
|
+
"deprecated": True,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from typing import Generic, TypeVar
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
from seekrai.types.agents.tools.env_model_config import EnvConfig
|
|
6
|
+
from seekrai.types.enums import ToolType as SeekrToolType
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
TName = TypeVar("TName", bound=str)
|
|
10
|
+
TEnv = TypeVar("TEnv", bound=EnvConfig)
|
|
11
|
+
|
|
12
|
+
ToolType = SeekrToolType
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ToolBase(BaseModel, Generic[TName, TEnv]):
|
|
16
|
+
name: TName
|
|
17
|
+
tool_env: TEnv
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"ToolBase",
|
|
22
|
+
"ToolType",
|
|
23
|
+
] # explicitly re-export ToolType from old namespace to keep backward compatibility
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AgentStatus(str, Enum):
|
|
5
|
+
INACTIVE = "Inactive"
|
|
6
|
+
PENDING = "Pending"
|
|
7
|
+
ACTIVE = "Active"
|
|
8
|
+
UPDATING = "Updating"
|
|
9
|
+
FAILED = "Failed"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ReasoningEffort(str, Enum):
|
|
13
|
+
PERFORMANCE_OPTIMIZED = "performance_optimized"
|
|
14
|
+
SPEED_OPTIMIZED = "speed_optimized"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ToolStatus(str, Enum):
|
|
18
|
+
"""Tool status enumeration."""
|
|
19
|
+
|
|
20
|
+
ACTIVE = "Active"
|
|
21
|
+
INACTIVE = "Inactive"
|
|
22
|
+
DEPRECATED = "Deprecated"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ToolType(str, Enum):
|
|
26
|
+
"""Tool type enumeration used to discriminate the union."""
|
|
27
|
+
|
|
28
|
+
FILE_SEARCH = "file_search"
|
|
29
|
+
WEB_SEARCH = "web_search"
|
|
30
|
+
RUN_PYTHON = "run_python"
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Annotated, Literal, Optional, Union
|
|
3
|
+
|
|
4
|
+
from pydantic import AfterValidator, ConfigDict, Field
|
|
5
|
+
from pydantic_core.core_schema import ValidationInfo
|
|
6
|
+
|
|
7
|
+
from seekrai.types.abstract import BaseModel
|
|
8
|
+
from seekrai.types.enums import AgentStatus, ToolType
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def validate_length(value: str, info: ValidationInfo) -> str:
|
|
12
|
+
"""Validate that string fields have meaningful content."""
|
|
13
|
+
if len(value) <= 0:
|
|
14
|
+
raise ValueError(f"{info.field_name} needs to have a length of at least 1")
|
|
15
|
+
if len(value.strip()) <= 0:
|
|
16
|
+
raise ValueError(f"{info.field_name} cannot be only whitespace")
|
|
17
|
+
return value
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ToolConfig(BaseModel):
|
|
21
|
+
model_config = ConfigDict(
|
|
22
|
+
alias_generator=lambda k: k.upper(), populate_by_name=True
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CreateTool(BaseModel):
|
|
27
|
+
model_config = ConfigDict(from_attributes=True, extra="forbid")
|
|
28
|
+
|
|
29
|
+
type: ToolType
|
|
30
|
+
name: Annotated[str, AfterValidator(validate_length)]
|
|
31
|
+
description: Annotated[str, AfterValidator(validate_length)]
|
|
32
|
+
config: ToolConfig
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class FileSearchConfig(ToolConfig):
|
|
36
|
+
file_search_index: str = Field(min_length=1)
|
|
37
|
+
embedding_model: Union[str, None] = None
|
|
38
|
+
top_k: int = Field(
|
|
39
|
+
default=10, ge=1, le=100, description="Top K must be >= 1 and <= 100"
|
|
40
|
+
)
|
|
41
|
+
score_threshold: float = Field(
|
|
42
|
+
default=0, ge=0, lt=1.0, description="Score must be ≥ 0.0 and < 1.0"
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CreateFileSearch(CreateTool):
|
|
47
|
+
type: Literal[ToolType.FILE_SEARCH] = ToolType.FILE_SEARCH
|
|
48
|
+
config: FileSearchConfig
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class CreateWebSearch(CreateTool):
|
|
52
|
+
type: Literal[ToolType.WEB_SEARCH] = ToolType.WEB_SEARCH
|
|
53
|
+
config: ToolConfig = ToolConfig()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class RunPythonConfig(ToolConfig):
|
|
57
|
+
function_ids: Union[list[str], None] = None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class CreateRunPython(CreateTool):
|
|
61
|
+
type: Literal[ToolType.RUN_PYTHON] = ToolType.RUN_PYTHON
|
|
62
|
+
config: RunPythonConfig
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class Tool(BaseModel):
|
|
66
|
+
type: ToolType
|
|
67
|
+
name: Annotated[str, AfterValidator(validate_length)]
|
|
68
|
+
description: Union[str, None]
|
|
69
|
+
config: ToolConfig
|
|
70
|
+
id: str
|
|
71
|
+
version: int
|
|
72
|
+
created_at: datetime
|
|
73
|
+
updated_at: datetime
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class FileSearchTool(Tool):
|
|
77
|
+
type: Literal[ToolType.FILE_SEARCH] = ToolType.FILE_SEARCH
|
|
78
|
+
config: FileSearchConfig
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class WebSearchTool(Tool):
|
|
82
|
+
type: Literal[ToolType.WEB_SEARCH] = ToolType.WEB_SEARCH
|
|
83
|
+
config: ToolConfig = ToolConfig()
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class RunPythonTool(Tool):
|
|
87
|
+
type: Literal[ToolType.RUN_PYTHON] = ToolType.RUN_PYTHON
|
|
88
|
+
config: RunPythonConfig
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
CreateToolRequest = Annotated[
|
|
92
|
+
Union[CreateFileSearch, CreateRunPython, CreateWebSearch],
|
|
93
|
+
Field(discriminator="type"),
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
ToolResponse = Annotated[
|
|
97
|
+
Union[FileSearchTool, WebSearchTool, RunPythonTool], Field(discriminator="type")
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class UpdateFileSearch(CreateFileSearch):
|
|
102
|
+
pass
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class UpdateWebSearch(CreateWebSearch):
|
|
106
|
+
pass
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class UpdateRunPython(CreateRunPython):
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
UpdateToolRequest = Annotated[
|
|
114
|
+
Union[UpdateFileSearch, UpdateWebSearch, UpdateRunPython],
|
|
115
|
+
Field(discriminator="type"),
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class GetToolsResponse(BaseModel):
|
|
120
|
+
"""Response schema for paginated tool list."""
|
|
121
|
+
|
|
122
|
+
data: list[ToolResponse]
|
|
123
|
+
total: Optional[int] = None
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class ToolAgentSummaryResponse(BaseModel):
|
|
127
|
+
"""Schema for the summary for agents linked to a given tool."""
|
|
128
|
+
|
|
129
|
+
model_config = ConfigDict(from_attributes=True)
|
|
130
|
+
|
|
131
|
+
id: str
|
|
132
|
+
name: str
|
|
133
|
+
status: AgentStatus
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class ToolDeleteResponse(BaseModel):
|
|
137
|
+
"""Response schema for tool deletion."""
|
|
138
|
+
|
|
139
|
+
id: str
|
|
140
|
+
deleted: bool
|
|
141
|
+
message: str
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from typing import Literal
|
|
2
|
-
|
|
3
|
-
from seekrai.types.agents.tools.schemas.file_search_env import FileSearchEnv
|
|
4
|
-
from seekrai.types.agents.tools.tool import ToolBase, ToolType
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class FileSearch(ToolBase[FileSearchEnv]):
|
|
8
|
-
name: Literal[ToolType.FILE_SEARCH] = ToolType.FILE_SEARCH
|
|
9
|
-
tool_env: FileSearchEnv
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from typing import Literal
|
|
2
|
-
|
|
3
|
-
from seekrai.types.agents.tools.schemas.run_python_env import RunPythonEnv
|
|
4
|
-
from seekrai.types.agents.tools.tool import ToolBase, ToolType
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class RunPython(ToolBase[RunPythonEnv]):
|
|
8
|
-
name: Literal[ToolType.RUN_PYTHON] = ToolType.RUN_PYTHON
|
|
9
|
-
tool_env: RunPythonEnv
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from typing import Literal
|
|
2
|
-
|
|
3
|
-
from seekrai.types.agents.tools.schemas.web_search_env import WebSearchEnv
|
|
4
|
-
from seekrai.types.agents.tools.tool import ToolBase, ToolType
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class WebSearch(ToolBase[WebSearchEnv]):
|
|
8
|
-
name: Literal[ToolType.WEB_SEARCH] = ToolType.WEB_SEARCH
|
|
9
|
-
tool_env: WebSearchEnv
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
from typing import Generic, TypeVar
|
|
3
|
-
|
|
4
|
-
from pydantic import BaseModel
|
|
5
|
-
|
|
6
|
-
from seekrai.types.agents.tools.env_model_config import EnvConfig
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ToolType(str, enum.Enum):
|
|
10
|
-
FILE_SEARCH = "file_search"
|
|
11
|
-
WEB_SEARCH = "web_search"
|
|
12
|
-
RUN_PYTHON = "run_python"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
TEnv = TypeVar("TEnv", bound=EnvConfig)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class ToolBase(BaseModel, Generic[TEnv]):
|
|
19
|
-
name: ToolType
|
|
20
|
-
tool_env: TEnv
|
|
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
|