vellum-ai 1.0.11__py3-none-any.whl → 1.1.1__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.
- vellum/__init__.py +2 -2
- vellum/client/README.md +0 -55
- vellum/client/__init__.py +159 -877
- vellum/client/core/__init__.py +3 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/core/http_response.py +47 -0
- vellum/client/raw_client.py +1561 -0
- vellum/client/reference.md +22 -696
- vellum/client/resources/__init__.py +0 -2
- vellum/client/resources/ad_hoc/client.py +55 -161
- vellum/client/resources/ad_hoc/raw_client.py +278 -0
- vellum/client/resources/container_images/client.py +62 -172
- vellum/client/resources/container_images/raw_client.py +400 -0
- vellum/client/resources/deployments/client.py +112 -437
- vellum/client/resources/deployments/raw_client.py +995 -0
- vellum/client/resources/document_indexes/client.py +108 -317
- vellum/client/resources/document_indexes/raw_client.py +847 -0
- vellum/client/resources/documents/client.py +88 -285
- vellum/client/resources/documents/raw_client.py +655 -0
- vellum/client/resources/folder_entities/client.py +54 -92
- vellum/client/resources/folder_entities/raw_client.py +277 -0
- vellum/client/resources/metric_definitions/client.py +48 -95
- vellum/client/resources/metric_definitions/raw_client.py +225 -0
- vellum/client/resources/ml_models/client.py +36 -40
- vellum/client/resources/ml_models/raw_client.py +103 -0
- vellum/client/resources/organizations/client.py +34 -39
- vellum/client/resources/organizations/raw_client.py +96 -0
- vellum/client/resources/prompts/client.py +50 -193
- vellum/client/resources/prompts/raw_client.py +346 -0
- vellum/client/resources/sandboxes/client.py +68 -141
- vellum/client/resources/sandboxes/raw_client.py +393 -0
- vellum/client/resources/test_suite_runs/client.py +58 -141
- vellum/client/resources/test_suite_runs/raw_client.py +355 -0
- vellum/client/resources/test_suites/client.py +73 -141
- vellum/client/resources/test_suites/raw_client.py +379 -0
- vellum/client/resources/workflow_deployments/client.py +203 -328
- vellum/client/resources/workflow_deployments/raw_client.py +931 -0
- vellum/client/resources/workflow_executions/client.py +36 -40
- vellum/client/resources/workflow_executions/raw_client.py +97 -0
- vellum/client/resources/workflow_sandboxes/client.py +60 -108
- vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
- vellum/client/resources/workflows/client.py +68 -133
- vellum/client/resources/workflows/raw_client.py +307 -0
- vellum/client/resources/workspace_secrets/client.py +46 -90
- vellum/client/resources/workspace_secrets/raw_client.py +220 -0
- vellum/client/resources/workspaces/client.py +34 -39
- vellum/client/resources/workspaces/raw_client.py +96 -0
- vellum/client/types/__init__.py +2 -0
- vellum/client/types/api_request_parent_context.py +1 -0
- vellum/client/types/external_parent_context.py +36 -0
- vellum/client/types/node_execution_fulfilled_event.py +1 -0
- vellum/client/types/node_execution_initiated_event.py +1 -0
- vellum/client/types/node_execution_paused_event.py +1 -0
- vellum/client/types/node_execution_rejected_event.py +1 -0
- vellum/client/types/node_execution_resumed_event.py +1 -0
- vellum/client/types/node_execution_span.py +1 -0
- vellum/client/types/node_execution_span_attributes.py +1 -0
- vellum/client/types/node_execution_streaming_event.py +1 -0
- vellum/client/types/node_parent_context.py +1 -0
- vellum/client/types/parent_context.py +2 -0
- vellum/client/types/prompt_deployment_parent_context.py +1 -0
- vellum/client/types/slim_workflow_execution_read.py +1 -0
- vellum/client/types/span_link.py +1 -0
- vellum/client/types/workflow_deployment_event_executions_response.py +1 -0
- vellum/client/types/workflow_deployment_parent_context.py +1 -0
- vellum/client/types/workflow_event_execution_read.py +1 -0
- vellum/client/types/workflow_execution_detail.py +1 -0
- vellum/client/types/workflow_execution_fulfilled_event.py +1 -0
- vellum/client/types/workflow_execution_initiated_event.py +1 -0
- vellum/client/types/workflow_execution_paused_event.py +1 -0
- vellum/client/types/workflow_execution_rejected_event.py +1 -0
- vellum/client/types/workflow_execution_resumed_event.py +1 -0
- vellum/client/types/workflow_execution_snapshotted_event.py +1 -0
- vellum/client/types/workflow_execution_span.py +1 -0
- vellum/client/types/workflow_execution_span_attributes.py +1 -0
- vellum/client/types/workflow_execution_streaming_event.py +1 -0
- vellum/client/types/workflow_parent_context.py +1 -0
- vellum/client/types/workflow_sandbox_parent_context.py +1 -0
- vellum/{resources/release_reviews/__init__.py → core/http_response.py} +1 -1
- vellum/{resources/release_reviews/client.py → raw_client.py} +1 -1
- vellum/resources/ad_hoc/raw_client.py +3 -0
- vellum/resources/container_images/raw_client.py +3 -0
- vellum/resources/deployments/raw_client.py +3 -0
- vellum/resources/document_indexes/raw_client.py +3 -0
- vellum/resources/documents/raw_client.py +3 -0
- vellum/resources/folder_entities/raw_client.py +3 -0
- vellum/resources/metric_definitions/raw_client.py +3 -0
- vellum/resources/ml_models/raw_client.py +3 -0
- vellum/resources/organizations/raw_client.py +3 -0
- vellum/resources/prompts/raw_client.py +3 -0
- vellum/resources/sandboxes/raw_client.py +3 -0
- vellum/resources/test_suite_runs/raw_client.py +3 -0
- vellum/resources/test_suites/raw_client.py +3 -0
- vellum/resources/workflow_deployments/raw_client.py +3 -0
- vellum/resources/workflow_executions/raw_client.py +3 -0
- vellum/resources/workflow_sandboxes/raw_client.py +3 -0
- vellum/resources/workflows/raw_client.py +3 -0
- vellum/resources/workspace_secrets/raw_client.py +3 -0
- vellum/resources/workspaces/raw_client.py +3 -0
- vellum/types/external_parent_context.py +3 -0
- vellum/workflows/emitters/vellum_emitter.py +3 -2
- vellum/workflows/events/types.py +6 -0
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +5 -15
- vellum/workflows/nodes/displayable/tool_calling_node/node.py +6 -0
- vellum/workflows/nodes/displayable/tool_calling_node/utils.py +75 -0
- vellum/workflows/state/context.py +13 -2
- vellum/workflows/types/definition.py +2 -2
- vellum/workflows/types/tests/test_definition.py +2 -3
- vellum/workflows/utils/functions.py +1 -1
- vellum/workflows/utils/tests/test_functions.py +3 -3
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/METADATA +1 -1
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/RECORD +123 -81
- vellum_ee/workflows/display/exceptions.py +7 -0
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +93 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +98 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_workflow_deployment_serialization.py +1 -1
- vellum_ee/workflows/display/utils/expressions.py +1 -1
- vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
- vellum/client/resources/release_reviews/__init__.py +0 -2
- vellum/client/resources/release_reviews/client.py +0 -139
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/LICENSE +0 -0
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/WHEEL +0 -0
- {vellum_ai-1.0.11.dist-info → vellum_ai-1.1.1.dist-info}/entry_points.txt +0 -0
@@ -2,14 +2,12 @@
|
|
2
2
|
|
3
3
|
import typing
|
4
4
|
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .raw_client import RawFolderEntitiesClient
|
5
6
|
from .types.folder_entities_list_request_entity_status import FolderEntitiesListRequestEntityStatus
|
6
7
|
from ...core.request_options import RequestOptions
|
7
8
|
from ...types.paginated_folder_entity_list import PaginatedFolderEntityList
|
8
|
-
from ...core.pydantic_utilities import parse_obj_as
|
9
|
-
from json.decoder import JSONDecodeError
|
10
|
-
from ...core.api_error import ApiError
|
11
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
12
9
|
from ...core.client_wrapper import AsyncClientWrapper
|
10
|
+
from .raw_client import AsyncRawFolderEntitiesClient
|
13
11
|
|
14
12
|
# this is used as the default value for optional parameters
|
15
13
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -17,9 +15,24 @@ OMIT = typing.cast(typing.Any, ...)
|
|
17
15
|
|
18
16
|
class FolderEntitiesClient:
|
19
17
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
20
|
-
self.
|
18
|
+
self._raw_client = RawFolderEntitiesClient(client_wrapper=client_wrapper)
|
21
19
|
|
22
|
-
|
20
|
+
@property
|
21
|
+
def _client_wrapper(self) -> SyncClientWrapper:
|
22
|
+
return self._raw_client._client_wrapper
|
23
|
+
|
24
|
+
@property
|
25
|
+
def with_raw_response(self) -> RawFolderEntitiesClient:
|
26
|
+
"""
|
27
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
28
|
+
|
29
|
+
Returns
|
30
|
+
-------
|
31
|
+
RawFolderEntitiesClient
|
32
|
+
"""
|
33
|
+
return self._raw_client
|
34
|
+
|
35
|
+
def list_(
|
23
36
|
self,
|
24
37
|
*,
|
25
38
|
parent_folder_id: str,
|
@@ -79,32 +92,15 @@ class FolderEntitiesClient:
|
|
79
92
|
parent_folder_id="parent_folder_id",
|
80
93
|
)
|
81
94
|
"""
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
"limit": limit,
|
89
|
-
"offset": offset,
|
90
|
-
"ordering": ordering,
|
91
|
-
"parent_folder_id": parent_folder_id,
|
92
|
-
},
|
95
|
+
response = self._raw_client.list(
|
96
|
+
parent_folder_id=parent_folder_id,
|
97
|
+
entity_status=entity_status,
|
98
|
+
limit=limit,
|
99
|
+
offset=offset,
|
100
|
+
ordering=ordering,
|
93
101
|
request_options=request_options,
|
94
102
|
)
|
95
|
-
|
96
|
-
if 200 <= _response.status_code < 300:
|
97
|
-
return typing.cast(
|
98
|
-
PaginatedFolderEntityList,
|
99
|
-
parse_obj_as(
|
100
|
-
type_=PaginatedFolderEntityList, # type: ignore
|
101
|
-
object_=_response.json(),
|
102
|
-
),
|
103
|
-
)
|
104
|
-
_response_json = _response.json()
|
105
|
-
except JSONDecodeError:
|
106
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
107
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
103
|
+
return response.data
|
108
104
|
|
109
105
|
def add_entity_to_folder(
|
110
106
|
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
@@ -147,33 +143,30 @@ class FolderEntitiesClient:
|
|
147
143
|
entity_id="entity_id",
|
148
144
|
)
|
149
145
|
"""
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
method="POST",
|
154
|
-
json={
|
155
|
-
"entity_id": entity_id,
|
156
|
-
},
|
157
|
-
headers={
|
158
|
-
"content-type": "application/json",
|
159
|
-
},
|
146
|
+
response = self._raw_client.add_entity_to_folder(
|
147
|
+
folder_id,
|
148
|
+
entity_id=entity_id,
|
160
149
|
request_options=request_options,
|
161
|
-
omit=OMIT,
|
162
150
|
)
|
163
|
-
|
164
|
-
if 200 <= _response.status_code < 300:
|
165
|
-
return
|
166
|
-
_response_json = _response.json()
|
167
|
-
except JSONDecodeError:
|
168
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
169
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
151
|
+
return response.data
|
170
152
|
|
171
153
|
|
172
154
|
class AsyncFolderEntitiesClient:
|
173
155
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
174
|
-
self.
|
156
|
+
self._raw_client = AsyncRawFolderEntitiesClient(client_wrapper=client_wrapper)
|
157
|
+
|
158
|
+
@property
|
159
|
+
def with_raw_response(self) -> AsyncRawFolderEntitiesClient:
|
160
|
+
"""
|
161
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
162
|
+
|
163
|
+
Returns
|
164
|
+
-------
|
165
|
+
AsyncRawFolderEntitiesClient
|
166
|
+
"""
|
167
|
+
return self._raw_client
|
175
168
|
|
176
|
-
async def
|
169
|
+
async def list_(
|
177
170
|
self,
|
178
171
|
*,
|
179
172
|
parent_folder_id: str,
|
@@ -241,32 +234,15 @@ class AsyncFolderEntitiesClient:
|
|
241
234
|
|
242
235
|
asyncio.run(main())
|
243
236
|
"""
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
"limit": limit,
|
251
|
-
"offset": offset,
|
252
|
-
"ordering": ordering,
|
253
|
-
"parent_folder_id": parent_folder_id,
|
254
|
-
},
|
237
|
+
response = await self._raw_client.list(
|
238
|
+
parent_folder_id=parent_folder_id,
|
239
|
+
entity_status=entity_status,
|
240
|
+
limit=limit,
|
241
|
+
offset=offset,
|
242
|
+
ordering=ordering,
|
255
243
|
request_options=request_options,
|
256
244
|
)
|
257
|
-
|
258
|
-
if 200 <= _response.status_code < 300:
|
259
|
-
return typing.cast(
|
260
|
-
PaginatedFolderEntityList,
|
261
|
-
parse_obj_as(
|
262
|
-
type_=PaginatedFolderEntityList, # type: ignore
|
263
|
-
object_=_response.json(),
|
264
|
-
),
|
265
|
-
)
|
266
|
-
_response_json = _response.json()
|
267
|
-
except JSONDecodeError:
|
268
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
269
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
245
|
+
return response.data
|
270
246
|
|
271
247
|
async def add_entity_to_folder(
|
272
248
|
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
@@ -317,23 +293,9 @@ class AsyncFolderEntitiesClient:
|
|
317
293
|
|
318
294
|
asyncio.run(main())
|
319
295
|
"""
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
method="POST",
|
324
|
-
json={
|
325
|
-
"entity_id": entity_id,
|
326
|
-
},
|
327
|
-
headers={
|
328
|
-
"content-type": "application/json",
|
329
|
-
},
|
296
|
+
response = await self._raw_client.add_entity_to_folder(
|
297
|
+
folder_id,
|
298
|
+
entity_id=entity_id,
|
330
299
|
request_options=request_options,
|
331
|
-
omit=OMIT,
|
332
300
|
)
|
333
|
-
|
334
|
-
if 200 <= _response.status_code < 300:
|
335
|
-
return
|
336
|
-
_response_json = _response.json()
|
337
|
-
except JSONDecodeError:
|
338
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
339
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
301
|
+
return response.data
|
@@ -0,0 +1,277 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .types.folder_entities_list_request_entity_status import FolderEntitiesListRequestEntityStatus
|
6
|
+
from ...core.request_options import RequestOptions
|
7
|
+
from ...core.http_response import HttpResponse
|
8
|
+
from ...types.paginated_folder_entity_list import PaginatedFolderEntityList
|
9
|
+
from ...core.pydantic_utilities import parse_obj_as
|
10
|
+
from json.decoder import JSONDecodeError
|
11
|
+
from ...core.api_error import ApiError
|
12
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
13
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
14
|
+
from ...core.http_response import AsyncHttpResponse
|
15
|
+
|
16
|
+
# this is used as the default value for optional parameters
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
18
|
+
|
19
|
+
|
20
|
+
class RawFolderEntitiesClient:
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
22
|
+
self._client_wrapper = client_wrapper
|
23
|
+
|
24
|
+
def list(
|
25
|
+
self,
|
26
|
+
*,
|
27
|
+
parent_folder_id: str,
|
28
|
+
entity_status: typing.Optional[FolderEntitiesListRequestEntityStatus] = None,
|
29
|
+
limit: typing.Optional[int] = None,
|
30
|
+
offset: typing.Optional[int] = None,
|
31
|
+
ordering: typing.Optional[str] = None,
|
32
|
+
request_options: typing.Optional[RequestOptions] = None,
|
33
|
+
) -> HttpResponse[PaginatedFolderEntityList]:
|
34
|
+
"""
|
35
|
+
List all folder entities within a specified folder.
|
36
|
+
|
37
|
+
Parameters
|
38
|
+
----------
|
39
|
+
parent_folder_id : str
|
40
|
+
Filter down to only those entities whose parent folder has the specified ID.
|
41
|
+
|
42
|
+
To filter by an entity's parent folder, provide the ID of the parent folder. To filter by the root directory, provide
|
43
|
+
a string representing the entity type of the root directory. Supported root directories include:
|
44
|
+
- PROMPT_SANDBOX
|
45
|
+
- WORKFLOW_SANDBOX
|
46
|
+
- DOCUMENT_INDEX
|
47
|
+
- TEST_SUITE
|
48
|
+
|
49
|
+
entity_status : typing.Optional[FolderEntitiesListRequestEntityStatus]
|
50
|
+
Filter down to only those objects whose entities have a status matching the status specified.
|
51
|
+
|
52
|
+
* `ACTIVE` - Active
|
53
|
+
* `ARCHIVED` - Archived
|
54
|
+
|
55
|
+
limit : typing.Optional[int]
|
56
|
+
Number of results to return per page.
|
57
|
+
|
58
|
+
offset : typing.Optional[int]
|
59
|
+
The initial index from which to return the results.
|
60
|
+
|
61
|
+
ordering : typing.Optional[str]
|
62
|
+
Which field to use when ordering the results.
|
63
|
+
|
64
|
+
request_options : typing.Optional[RequestOptions]
|
65
|
+
Request-specific configuration.
|
66
|
+
|
67
|
+
Returns
|
68
|
+
-------
|
69
|
+
HttpResponse[PaginatedFolderEntityList]
|
70
|
+
|
71
|
+
"""
|
72
|
+
_response = self._client_wrapper.httpx_client.request(
|
73
|
+
"v1/folder-entities",
|
74
|
+
base_url=self._client_wrapper.get_environment().default,
|
75
|
+
method="GET",
|
76
|
+
params={
|
77
|
+
"entity_status": entity_status,
|
78
|
+
"limit": limit,
|
79
|
+
"offset": offset,
|
80
|
+
"ordering": ordering,
|
81
|
+
"parent_folder_id": parent_folder_id,
|
82
|
+
},
|
83
|
+
request_options=request_options,
|
84
|
+
)
|
85
|
+
try:
|
86
|
+
if 200 <= _response.status_code < 300:
|
87
|
+
_data = typing.cast(
|
88
|
+
PaginatedFolderEntityList,
|
89
|
+
parse_obj_as(
|
90
|
+
type_=PaginatedFolderEntityList, # type: ignore
|
91
|
+
object_=_response.json(),
|
92
|
+
),
|
93
|
+
)
|
94
|
+
return HttpResponse(response=_response, data=_data)
|
95
|
+
_response_json = _response.json()
|
96
|
+
except JSONDecodeError:
|
97
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
98
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
99
|
+
|
100
|
+
def add_entity_to_folder(
|
101
|
+
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
102
|
+
) -> HttpResponse[None]:
|
103
|
+
"""
|
104
|
+
Add an entity to a specific folder or root directory.
|
105
|
+
|
106
|
+
Adding an entity to a folder will remove it from any other folders it might have been a member of.
|
107
|
+
|
108
|
+
Parameters
|
109
|
+
----------
|
110
|
+
folder_id : str
|
111
|
+
The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root
|
112
|
+
directory. Supported root directories include:
|
113
|
+
- PROMPT_SANDBOX
|
114
|
+
- WORKFLOW_SANDBOX
|
115
|
+
- DOCUMENT_INDEX
|
116
|
+
- TEST_SUITE
|
117
|
+
|
118
|
+
entity_id : str
|
119
|
+
The ID of the entity you would like to move.
|
120
|
+
|
121
|
+
request_options : typing.Optional[RequestOptions]
|
122
|
+
Request-specific configuration.
|
123
|
+
|
124
|
+
Returns
|
125
|
+
-------
|
126
|
+
HttpResponse[None]
|
127
|
+
"""
|
128
|
+
_response = self._client_wrapper.httpx_client.request(
|
129
|
+
f"v1/folders/{jsonable_encoder(folder_id)}/add-entity",
|
130
|
+
base_url=self._client_wrapper.get_environment().default,
|
131
|
+
method="POST",
|
132
|
+
json={
|
133
|
+
"entity_id": entity_id,
|
134
|
+
},
|
135
|
+
headers={
|
136
|
+
"content-type": "application/json",
|
137
|
+
},
|
138
|
+
request_options=request_options,
|
139
|
+
omit=OMIT,
|
140
|
+
)
|
141
|
+
try:
|
142
|
+
if 200 <= _response.status_code < 300:
|
143
|
+
return HttpResponse(response=_response, data=None)
|
144
|
+
_response_json = _response.json()
|
145
|
+
except JSONDecodeError:
|
146
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
147
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
148
|
+
|
149
|
+
|
150
|
+
class AsyncRawFolderEntitiesClient:
|
151
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
152
|
+
self._client_wrapper = client_wrapper
|
153
|
+
|
154
|
+
async def list(
|
155
|
+
self,
|
156
|
+
*,
|
157
|
+
parent_folder_id: str,
|
158
|
+
entity_status: typing.Optional[FolderEntitiesListRequestEntityStatus] = None,
|
159
|
+
limit: typing.Optional[int] = None,
|
160
|
+
offset: typing.Optional[int] = None,
|
161
|
+
ordering: typing.Optional[str] = None,
|
162
|
+
request_options: typing.Optional[RequestOptions] = None,
|
163
|
+
) -> AsyncHttpResponse[PaginatedFolderEntityList]:
|
164
|
+
"""
|
165
|
+
List all folder entities within a specified folder.
|
166
|
+
|
167
|
+
Parameters
|
168
|
+
----------
|
169
|
+
parent_folder_id : str
|
170
|
+
Filter down to only those entities whose parent folder has the specified ID.
|
171
|
+
|
172
|
+
To filter by an entity's parent folder, provide the ID of the parent folder. To filter by the root directory, provide
|
173
|
+
a string representing the entity type of the root directory. Supported root directories include:
|
174
|
+
- PROMPT_SANDBOX
|
175
|
+
- WORKFLOW_SANDBOX
|
176
|
+
- DOCUMENT_INDEX
|
177
|
+
- TEST_SUITE
|
178
|
+
|
179
|
+
entity_status : typing.Optional[FolderEntitiesListRequestEntityStatus]
|
180
|
+
Filter down to only those objects whose entities have a status matching the status specified.
|
181
|
+
|
182
|
+
* `ACTIVE` - Active
|
183
|
+
* `ARCHIVED` - Archived
|
184
|
+
|
185
|
+
limit : typing.Optional[int]
|
186
|
+
Number of results to return per page.
|
187
|
+
|
188
|
+
offset : typing.Optional[int]
|
189
|
+
The initial index from which to return the results.
|
190
|
+
|
191
|
+
ordering : typing.Optional[str]
|
192
|
+
Which field to use when ordering the results.
|
193
|
+
|
194
|
+
request_options : typing.Optional[RequestOptions]
|
195
|
+
Request-specific configuration.
|
196
|
+
|
197
|
+
Returns
|
198
|
+
-------
|
199
|
+
AsyncHttpResponse[PaginatedFolderEntityList]
|
200
|
+
|
201
|
+
"""
|
202
|
+
_response = await self._client_wrapper.httpx_client.request(
|
203
|
+
"v1/folder-entities",
|
204
|
+
base_url=self._client_wrapper.get_environment().default,
|
205
|
+
method="GET",
|
206
|
+
params={
|
207
|
+
"entity_status": entity_status,
|
208
|
+
"limit": limit,
|
209
|
+
"offset": offset,
|
210
|
+
"ordering": ordering,
|
211
|
+
"parent_folder_id": parent_folder_id,
|
212
|
+
},
|
213
|
+
request_options=request_options,
|
214
|
+
)
|
215
|
+
try:
|
216
|
+
if 200 <= _response.status_code < 300:
|
217
|
+
_data = typing.cast(
|
218
|
+
PaginatedFolderEntityList,
|
219
|
+
parse_obj_as(
|
220
|
+
type_=PaginatedFolderEntityList, # type: ignore
|
221
|
+
object_=_response.json(),
|
222
|
+
),
|
223
|
+
)
|
224
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
225
|
+
_response_json = _response.json()
|
226
|
+
except JSONDecodeError:
|
227
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
228
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
229
|
+
|
230
|
+
async def add_entity_to_folder(
|
231
|
+
self, folder_id: str, *, entity_id: str, request_options: typing.Optional[RequestOptions] = None
|
232
|
+
) -> AsyncHttpResponse[None]:
|
233
|
+
"""
|
234
|
+
Add an entity to a specific folder or root directory.
|
235
|
+
|
236
|
+
Adding an entity to a folder will remove it from any other folders it might have been a member of.
|
237
|
+
|
238
|
+
Parameters
|
239
|
+
----------
|
240
|
+
folder_id : str
|
241
|
+
The ID of the folder to which the entity should be added. This can be a UUID of a folder, or the name of a root
|
242
|
+
directory. Supported root directories include:
|
243
|
+
- PROMPT_SANDBOX
|
244
|
+
- WORKFLOW_SANDBOX
|
245
|
+
- DOCUMENT_INDEX
|
246
|
+
- TEST_SUITE
|
247
|
+
|
248
|
+
entity_id : str
|
249
|
+
The ID of the entity you would like to move.
|
250
|
+
|
251
|
+
request_options : typing.Optional[RequestOptions]
|
252
|
+
Request-specific configuration.
|
253
|
+
|
254
|
+
Returns
|
255
|
+
-------
|
256
|
+
AsyncHttpResponse[None]
|
257
|
+
"""
|
258
|
+
_response = await self._client_wrapper.httpx_client.request(
|
259
|
+
f"v1/folders/{jsonable_encoder(folder_id)}/add-entity",
|
260
|
+
base_url=self._client_wrapper.get_environment().default,
|
261
|
+
method="POST",
|
262
|
+
json={
|
263
|
+
"entity_id": entity_id,
|
264
|
+
},
|
265
|
+
headers={
|
266
|
+
"content-type": "application/json",
|
267
|
+
},
|
268
|
+
request_options=request_options,
|
269
|
+
omit=OMIT,
|
270
|
+
)
|
271
|
+
try:
|
272
|
+
if 200 <= _response.status_code < 300:
|
273
|
+
return AsyncHttpResponse(response=_response, data=None)
|
274
|
+
_response_json = _response.json()
|
275
|
+
except JSONDecodeError:
|
276
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
277
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
@@ -2,16 +2,13 @@
|
|
2
2
|
|
3
3
|
import typing
|
4
4
|
from ...core.client_wrapper import SyncClientWrapper
|
5
|
+
from .raw_client import RawMetricDefinitionsClient
|
5
6
|
from ...types.metric_definition_input import MetricDefinitionInput
|
6
7
|
from ...core.request_options import RequestOptions
|
7
8
|
from ...types.metric_definition_execution import MetricDefinitionExecution
|
8
|
-
from ...core.jsonable_encoder import jsonable_encoder
|
9
|
-
from ...core.serialization import convert_and_respect_annotation_metadata
|
10
|
-
from ...core.pydantic_utilities import parse_obj_as
|
11
|
-
from json.decoder import JSONDecodeError
|
12
|
-
from ...core.api_error import ApiError
|
13
9
|
from ...types.metric_definition_history_item import MetricDefinitionHistoryItem
|
14
10
|
from ...core.client_wrapper import AsyncClientWrapper
|
11
|
+
from .raw_client import AsyncRawMetricDefinitionsClient
|
15
12
|
|
16
13
|
# this is used as the default value for optional parameters
|
17
14
|
OMIT = typing.cast(typing.Any, ...)
|
@@ -19,7 +16,22 @@ OMIT = typing.cast(typing.Any, ...)
|
|
19
16
|
|
20
17
|
class MetricDefinitionsClient:
|
21
18
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
22
|
-
self.
|
19
|
+
self._raw_client = RawMetricDefinitionsClient(client_wrapper=client_wrapper)
|
20
|
+
|
21
|
+
@property
|
22
|
+
def _client_wrapper(self) -> SyncClientWrapper:
|
23
|
+
return self._raw_client._client_wrapper
|
24
|
+
|
25
|
+
@property
|
26
|
+
def with_raw_response(self) -> RawMetricDefinitionsClient:
|
27
|
+
"""
|
28
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
29
|
+
|
30
|
+
Returns
|
31
|
+
-------
|
32
|
+
RawMetricDefinitionsClient
|
33
|
+
"""
|
34
|
+
return self._raw_client
|
23
35
|
|
24
36
|
def execute_metric_definition(
|
25
37
|
self,
|
@@ -69,35 +81,13 @@ class MetricDefinitionsClient:
|
|
69
81
|
],
|
70
82
|
)
|
71
83
|
"""
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
json={
|
77
|
-
"inputs": convert_and_respect_annotation_metadata(
|
78
|
-
object_=inputs, annotation=typing.Sequence[MetricDefinitionInput], direction="write"
|
79
|
-
),
|
80
|
-
"release_tag": release_tag,
|
81
|
-
},
|
82
|
-
headers={
|
83
|
-
"content-type": "application/json",
|
84
|
-
},
|
84
|
+
response = self._raw_client.execute_metric_definition(
|
85
|
+
id,
|
86
|
+
inputs=inputs,
|
87
|
+
release_tag=release_tag,
|
85
88
|
request_options=request_options,
|
86
|
-
omit=OMIT,
|
87
89
|
)
|
88
|
-
|
89
|
-
if 200 <= _response.status_code < 300:
|
90
|
-
return typing.cast(
|
91
|
-
MetricDefinitionExecution,
|
92
|
-
parse_obj_as(
|
93
|
-
type_=MetricDefinitionExecution, # type: ignore
|
94
|
-
object_=_response.json(),
|
95
|
-
),
|
96
|
-
)
|
97
|
-
_response_json = _response.json()
|
98
|
-
except JSONDecodeError:
|
99
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
100
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
90
|
+
return response.data
|
101
91
|
|
102
92
|
def metric_definition_history_item_retrieve(
|
103
93
|
self, history_id_or_release_tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
@@ -132,30 +122,28 @@ class MetricDefinitionsClient:
|
|
132
122
|
id="id",
|
133
123
|
)
|
134
124
|
"""
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
method="GET",
|
125
|
+
response = self._raw_client.metric_definition_history_item_retrieve(
|
126
|
+
history_id_or_release_tag,
|
127
|
+
id,
|
139
128
|
request_options=request_options,
|
140
129
|
)
|
141
|
-
|
142
|
-
if 200 <= _response.status_code < 300:
|
143
|
-
return typing.cast(
|
144
|
-
MetricDefinitionHistoryItem,
|
145
|
-
parse_obj_as(
|
146
|
-
type_=MetricDefinitionHistoryItem, # type: ignore
|
147
|
-
object_=_response.json(),
|
148
|
-
),
|
149
|
-
)
|
150
|
-
_response_json = _response.json()
|
151
|
-
except JSONDecodeError:
|
152
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
153
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
130
|
+
return response.data
|
154
131
|
|
155
132
|
|
156
133
|
class AsyncMetricDefinitionsClient:
|
157
134
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
158
|
-
self.
|
135
|
+
self._raw_client = AsyncRawMetricDefinitionsClient(client_wrapper=client_wrapper)
|
136
|
+
|
137
|
+
@property
|
138
|
+
def with_raw_response(self) -> AsyncRawMetricDefinitionsClient:
|
139
|
+
"""
|
140
|
+
Retrieves a raw implementation of this client that returns raw responses.
|
141
|
+
|
142
|
+
Returns
|
143
|
+
-------
|
144
|
+
AsyncRawMetricDefinitionsClient
|
145
|
+
"""
|
146
|
+
return self._raw_client
|
159
147
|
|
160
148
|
async def execute_metric_definition(
|
161
149
|
self,
|
@@ -213,35 +201,13 @@ class AsyncMetricDefinitionsClient:
|
|
213
201
|
|
214
202
|
asyncio.run(main())
|
215
203
|
"""
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
json={
|
221
|
-
"inputs": convert_and_respect_annotation_metadata(
|
222
|
-
object_=inputs, annotation=typing.Sequence[MetricDefinitionInput], direction="write"
|
223
|
-
),
|
224
|
-
"release_tag": release_tag,
|
225
|
-
},
|
226
|
-
headers={
|
227
|
-
"content-type": "application/json",
|
228
|
-
},
|
204
|
+
response = await self._raw_client.execute_metric_definition(
|
205
|
+
id,
|
206
|
+
inputs=inputs,
|
207
|
+
release_tag=release_tag,
|
229
208
|
request_options=request_options,
|
230
|
-
omit=OMIT,
|
231
209
|
)
|
232
|
-
|
233
|
-
if 200 <= _response.status_code < 300:
|
234
|
-
return typing.cast(
|
235
|
-
MetricDefinitionExecution,
|
236
|
-
parse_obj_as(
|
237
|
-
type_=MetricDefinitionExecution, # type: ignore
|
238
|
-
object_=_response.json(),
|
239
|
-
),
|
240
|
-
)
|
241
|
-
_response_json = _response.json()
|
242
|
-
except JSONDecodeError:
|
243
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
244
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
210
|
+
return response.data
|
245
211
|
|
246
212
|
async def metric_definition_history_item_retrieve(
|
247
213
|
self, history_id_or_release_tag: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
@@ -284,22 +250,9 @@ class AsyncMetricDefinitionsClient:
|
|
284
250
|
|
285
251
|
asyncio.run(main())
|
286
252
|
"""
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
method="GET",
|
253
|
+
response = await self._raw_client.metric_definition_history_item_retrieve(
|
254
|
+
history_id_or_release_tag,
|
255
|
+
id,
|
291
256
|
request_options=request_options,
|
292
257
|
)
|
293
|
-
|
294
|
-
if 200 <= _response.status_code < 300:
|
295
|
-
return typing.cast(
|
296
|
-
MetricDefinitionHistoryItem,
|
297
|
-
parse_obj_as(
|
298
|
-
type_=MetricDefinitionHistoryItem, # type: ignore
|
299
|
-
object_=_response.json(),
|
300
|
-
),
|
301
|
-
)
|
302
|
-
_response_json = _response.json()
|
303
|
-
except JSONDecodeError:
|
304
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
305
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
258
|
+
return response.data
|