seekrai 0.5.24__tar.gz → 0.5.26__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.26}/PKG-INFO +7 -3
- {seekrai-0.5.24 → seekrai-0.5.26}/pyproject.toml +2 -1
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/client.py +2 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/__init__.py +8 -3
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/chat/completions.py +12 -6
- seekrai-0.5.26/src/seekrai/resources/tools.py +384 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/__init__.py +40 -3
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/__init__.py +7 -6
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/agent.py +18 -15
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/__init__.py +4 -4
- seekrai-0.5.26/src/seekrai/types/agents/tools/schemas/file_search.py +16 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/schemas/file_search_env.py +6 -0
- seekrai-0.5.26/src/seekrai/types/agents/tools/schemas/run_python.py +16 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/schemas/run_python_env.py +6 -0
- seekrai-0.5.26/src/seekrai/types/agents/tools/schemas/web_search.py +16 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/schemas/web_search_env.py +6 -0
- seekrai-0.5.26/src/seekrai/types/agents/tools/tool.py +23 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/chat_completions.py +1 -1
- seekrai-0.5.26/src/seekrai/types/enums.py +30 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/files.py +1 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/finetune.py +1 -1
- seekrai-0.5.26/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.26}/LICENSE +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/README.md +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/abstract/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/abstract/api_requestor.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/abstract/response_parsing.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/constants.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/error.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/filemanager.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/agents/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/agents/agent_inference.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/agents/agent_observability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/agents/agents.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/agents/python_functions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/agents/threads.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/alignment.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/chat/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/completions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/deployments.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/embeddings.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/explainability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/files.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/finetune.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/images.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/ingestion.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/models.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/projects.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/resource_base.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/resources/vectordb.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/seekrflow_response.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/abstract.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/observability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/python_functions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/runs.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/threads.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/env_model_config.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/schemas/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/agents/tools/tool_types.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/alignment.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/common.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/completions.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/deployments.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/embeddings.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/error.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/explainability.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/images.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/ingestion.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/models.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/projects.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/types/vectordb.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/utils/__init__.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/utils/_log.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/utils/api_helpers.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/utils/files.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/src/seekrai/utils/tools.py +0 -0
- {seekrai-0.5.24 → seekrai-0.5.26}/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.26
|
|
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.26"
|
|
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
|
]
|
|
@@ -20,7 +20,7 @@ class ChatCompletions:
|
|
|
20
20
|
def create(
|
|
21
21
|
self,
|
|
22
22
|
*,
|
|
23
|
-
messages: List[Dict[str,
|
|
23
|
+
messages: List[Dict[str, Any]],
|
|
24
24
|
model: str,
|
|
25
25
|
max_completion_tokens: int | None = None,
|
|
26
26
|
max_tokens: int | None = 512,
|
|
@@ -43,8 +43,11 @@ class ChatCompletions:
|
|
|
43
43
|
Method to generate completions based on a given prompt using a specified model.
|
|
44
44
|
|
|
45
45
|
Args:
|
|
46
|
-
messages (List[Dict[str,
|
|
47
|
-
`[{"role": seekrai.types.chat_completions.MessageRole, "content": TEXT}, ...]`
|
|
46
|
+
messages (List[Dict[str, Any]]): A list of messages in the format
|
|
47
|
+
`[{"role": seekrai.types.chat_completions.MessageRole, "content": TEXT}, ...]` or
|
|
48
|
+
`[{"role": seekrai.types.chat_completions.MessageRole, "content": PARTS}, ...]`
|
|
49
|
+
where PARTS is a list of content dicts, e.g. {"type": "text", "text": "..."} or
|
|
50
|
+
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}
|
|
48
51
|
model (str): The name of the model to query.
|
|
49
52
|
max_completion_tokens (int, optional): The maximum number of tokens the output can contain.
|
|
50
53
|
max_tokens (int, optional): The maximum number of tokens to generate.
|
|
@@ -141,7 +144,7 @@ class AsyncChatCompletions:
|
|
|
141
144
|
async def create(
|
|
142
145
|
self,
|
|
143
146
|
*,
|
|
144
|
-
messages: List[Dict[str,
|
|
147
|
+
messages: List[Dict[str, Any]],
|
|
145
148
|
model: str,
|
|
146
149
|
max_completion_tokens: int | None = None,
|
|
147
150
|
max_tokens: int | None = 512,
|
|
@@ -164,8 +167,11 @@ class AsyncChatCompletions:
|
|
|
164
167
|
Async method to generate completions based on a given prompt using a specified model.
|
|
165
168
|
|
|
166
169
|
Args:
|
|
167
|
-
messages (List[Dict[str,
|
|
168
|
-
`[{"role": seekrai.types.chat_completions.MessageRole, "content": TEXT}, ...]`
|
|
170
|
+
messages (List[Dict[str, Any]]): A list of messages in the format
|
|
171
|
+
`[{"role": seekrai.types.chat_completions.MessageRole, "content": TEXT}, ...]` or
|
|
172
|
+
`[{"role": seekrai.types.chat_completions.MessageRole, "content": PARTS}, ...]`
|
|
173
|
+
where PARTS is a list of content dicts, e.g. {"type": "text", "text": "..."} or
|
|
174
|
+
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}
|
|
169
175
|
model (str): The name of the model to query.
|
|
170
176
|
max_completion_tokens (int, optional): The maximum number of tokens the output can contain.
|
|
171
177
|
max_tokens (int, optional): The maximum number of tokens to generate.
|
|
@@ -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",
|