vellum-ai 1.1.0__py3-none-any.whl → 1.1.2__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.
Files changed (76) hide show
  1. vellum/client/README.md +0 -55
  2. vellum/client/__init__.py +159 -873
  3. vellum/client/core/__init__.py +3 -0
  4. vellum/client/core/client_wrapper.py +2 -2
  5. vellum/client/core/http_response.py +47 -0
  6. vellum/client/core/pydantic_utilities.py +10 -3
  7. vellum/client/raw_client.py +1561 -0
  8. vellum/client/reference.md +20 -693
  9. vellum/client/resources/ad_hoc/client.py +55 -161
  10. vellum/client/resources/ad_hoc/raw_client.py +278 -0
  11. vellum/client/resources/container_images/client.py +62 -172
  12. vellum/client/resources/container_images/raw_client.py +400 -0
  13. vellum/client/resources/deployments/client.py +112 -437
  14. vellum/client/resources/deployments/raw_client.py +995 -0
  15. vellum/client/resources/document_indexes/client.py +108 -317
  16. vellum/client/resources/document_indexes/raw_client.py +847 -0
  17. vellum/client/resources/documents/client.py +88 -285
  18. vellum/client/resources/documents/raw_client.py +655 -0
  19. vellum/client/resources/folder_entities/client.py +54 -92
  20. vellum/client/resources/folder_entities/raw_client.py +277 -0
  21. vellum/client/resources/metric_definitions/client.py +48 -95
  22. vellum/client/resources/metric_definitions/raw_client.py +225 -0
  23. vellum/client/resources/ml_models/client.py +36 -40
  24. vellum/client/resources/ml_models/raw_client.py +103 -0
  25. vellum/client/resources/organizations/client.py +34 -39
  26. vellum/client/resources/organizations/raw_client.py +96 -0
  27. vellum/client/resources/prompts/client.py +50 -193
  28. vellum/client/resources/prompts/raw_client.py +346 -0
  29. vellum/client/resources/sandboxes/client.py +68 -141
  30. vellum/client/resources/sandboxes/raw_client.py +393 -0
  31. vellum/client/resources/test_suite_runs/client.py +58 -141
  32. vellum/client/resources/test_suite_runs/raw_client.py +355 -0
  33. vellum/client/resources/test_suites/client.py +73 -141
  34. vellum/client/resources/test_suites/raw_client.py +379 -0
  35. vellum/client/resources/workflow_deployments/client.py +118 -362
  36. vellum/client/resources/workflow_deployments/raw_client.py +931 -0
  37. vellum/client/resources/workflow_executions/client.py +36 -40
  38. vellum/client/resources/workflow_executions/raw_client.py +97 -0
  39. vellum/client/resources/workflow_sandboxes/client.py +60 -108
  40. vellum/client/resources/workflow_sandboxes/raw_client.py +300 -0
  41. vellum/client/resources/workflows/client.py +68 -133
  42. vellum/client/resources/workflows/raw_client.py +307 -0
  43. vellum/client/resources/workspace_secrets/client.py +46 -90
  44. vellum/client/resources/workspace_secrets/raw_client.py +220 -0
  45. vellum/client/resources/workspaces/client.py +34 -39
  46. vellum/client/resources/workspaces/raw_client.py +96 -0
  47. vellum/core/http_response.py +3 -0
  48. vellum/raw_client.py +3 -0
  49. vellum/resources/ad_hoc/raw_client.py +3 -0
  50. vellum/resources/container_images/raw_client.py +3 -0
  51. vellum/resources/deployments/raw_client.py +3 -0
  52. vellum/resources/document_indexes/raw_client.py +3 -0
  53. vellum/resources/documents/raw_client.py +3 -0
  54. vellum/resources/folder_entities/raw_client.py +3 -0
  55. vellum/resources/metric_definitions/raw_client.py +3 -0
  56. vellum/resources/ml_models/raw_client.py +3 -0
  57. vellum/resources/organizations/raw_client.py +3 -0
  58. vellum/resources/prompts/raw_client.py +3 -0
  59. vellum/resources/sandboxes/raw_client.py +3 -0
  60. vellum/resources/test_suite_runs/raw_client.py +3 -0
  61. vellum/resources/test_suites/raw_client.py +3 -0
  62. vellum/resources/workflow_deployments/raw_client.py +3 -0
  63. vellum/resources/workflow_executions/raw_client.py +3 -0
  64. vellum/resources/workflow_sandboxes/raw_client.py +3 -0
  65. vellum/resources/workflows/raw_client.py +3 -0
  66. vellum/resources/workspace_secrets/raw_client.py +3 -0
  67. vellum/resources/workspaces/raw_client.py +3 -0
  68. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/METADATA +1 -1
  69. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/RECORD +76 -33
  70. vellum_ee/workflows/display/exceptions.py +7 -0
  71. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +2 -1
  72. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +53 -2
  73. vellum_ee/workflows/display/workflows/base_workflow_display.py +2 -1
  74. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/LICENSE +0 -0
  75. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/WHEEL +0 -0
  76. {vellum_ai-1.1.0.dist-info → vellum_ai-1.1.2.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,307 @@
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 ...core.request_options import RequestOptions
6
+ from ...core.http_response import HttpResponse
7
+ from ...core.jsonable_encoder import jsonable_encoder
8
+ from ...errors.bad_request_error import BadRequestError
9
+ from ...core.pydantic_utilities import parse_obj_as
10
+ from json.decoder import JSONDecodeError
11
+ from ...core.api_error import ApiError
12
+ from ...types.workflow_push_exec_config import WorkflowPushExecConfig
13
+ from ...types.workflow_push_deployment_config_request import WorkflowPushDeploymentConfigRequest
14
+ from ... import core
15
+ from ...types.workflow_push_response import WorkflowPushResponse
16
+ from ...core.client_wrapper import AsyncClientWrapper
17
+ from ...core.http_response import AsyncHttpResponse
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class RawWorkflowsClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._client_wrapper = client_wrapper
26
+
27
+ def pull(
28
+ self,
29
+ id: str,
30
+ *,
31
+ exclude_code: typing.Optional[bool] = None,
32
+ exclude_display: typing.Optional[bool] = None,
33
+ include_json: typing.Optional[bool] = None,
34
+ include_sandbox: typing.Optional[bool] = None,
35
+ strict: typing.Optional[bool] = None,
36
+ request_options: typing.Optional[RequestOptions] = None,
37
+ ) -> HttpResponse[typing.Iterator[bytes]]:
38
+ """
39
+ Parameters
40
+ ----------
41
+ id : str
42
+ The ID of the Workflow to pull from
43
+
44
+ exclude_code : typing.Optional[bool]
45
+
46
+ exclude_display : typing.Optional[bool]
47
+
48
+ include_json : typing.Optional[bool]
49
+
50
+ include_sandbox : typing.Optional[bool]
51
+
52
+ strict : typing.Optional[bool]
53
+
54
+ request_options : typing.Optional[RequestOptions]
55
+ Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
56
+
57
+ Returns
58
+ -------
59
+ HttpResponse[typing.Iterator[bytes]]
60
+
61
+ """
62
+ with self._client_wrapper.httpx_client.stream(
63
+ f"v1/workflows/{jsonable_encoder(id)}/pull",
64
+ base_url=self._client_wrapper.get_environment().default,
65
+ method="GET",
66
+ params={
67
+ "exclude_code": exclude_code,
68
+ "exclude_display": exclude_display,
69
+ "include_json": include_json,
70
+ "include_sandbox": include_sandbox,
71
+ "strict": strict,
72
+ },
73
+ request_options=request_options,
74
+ ) as _response:
75
+ try:
76
+ if 200 <= _response.status_code < 300:
77
+ _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
78
+ return HttpResponse(
79
+ response=_response, data=(_chunk for _chunk in _response.iter_bytes(chunk_size=_chunk_size))
80
+ )
81
+ _response.read()
82
+ if _response.status_code == 400:
83
+ raise BadRequestError(
84
+ typing.cast(
85
+ typing.Optional[typing.Any],
86
+ parse_obj_as(
87
+ type_=typing.Optional[typing.Any], # type: ignore
88
+ object_=_response.json(),
89
+ ),
90
+ )
91
+ )
92
+ _response_json = _response.json()
93
+ except JSONDecodeError:
94
+ raise ApiError(status_code=_response.status_code, body=_response.text)
95
+ raise ApiError(status_code=_response.status_code, body=_response_json)
96
+
97
+ def push(
98
+ self,
99
+ *,
100
+ exec_config: WorkflowPushExecConfig,
101
+ workflow_sandbox_id: typing.Optional[str] = OMIT,
102
+ deployment_config: typing.Optional[WorkflowPushDeploymentConfigRequest] = OMIT,
103
+ artifact: typing.Optional[core.File] = OMIT,
104
+ dry_run: typing.Optional[bool] = OMIT,
105
+ strict: typing.Optional[bool] = OMIT,
106
+ request_options: typing.Optional[RequestOptions] = None,
107
+ ) -> HttpResponse[WorkflowPushResponse]:
108
+ """
109
+ Parameters
110
+ ----------
111
+ exec_config : WorkflowPushExecConfig
112
+ The execution configuration of the workflow.
113
+
114
+ workflow_sandbox_id : typing.Optional[str]
115
+
116
+ deployment_config : typing.Optional[WorkflowPushDeploymentConfigRequest]
117
+
118
+ artifact : typing.Optional[core.File]
119
+ See core.File for more documentation
120
+
121
+ dry_run : typing.Optional[bool]
122
+
123
+ strict : typing.Optional[bool]
124
+
125
+ request_options : typing.Optional[RequestOptions]
126
+ Request-specific configuration.
127
+
128
+ Returns
129
+ -------
130
+ HttpResponse[WorkflowPushResponse]
131
+
132
+ """
133
+ _response = self._client_wrapper.httpx_client.request(
134
+ "v1/workflows/push",
135
+ base_url=self._client_wrapper.get_environment().default,
136
+ method="POST",
137
+ data={
138
+ "exec_config": exec_config,
139
+ "workflow_sandbox_id": workflow_sandbox_id,
140
+ "deployment_config": deployment_config,
141
+ "dry_run": dry_run,
142
+ "strict": strict,
143
+ },
144
+ files={
145
+ "artifact": artifact,
146
+ },
147
+ request_options=request_options,
148
+ omit=OMIT,
149
+ )
150
+ try:
151
+ if 200 <= _response.status_code < 300:
152
+ _data = typing.cast(
153
+ WorkflowPushResponse,
154
+ parse_obj_as(
155
+ type_=WorkflowPushResponse, # type: ignore
156
+ object_=_response.json(),
157
+ ),
158
+ )
159
+ return HttpResponse(response=_response, data=_data)
160
+ _response_json = _response.json()
161
+ except JSONDecodeError:
162
+ raise ApiError(status_code=_response.status_code, body=_response.text)
163
+ raise ApiError(status_code=_response.status_code, body=_response_json)
164
+
165
+
166
+ class AsyncRawWorkflowsClient:
167
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
168
+ self._client_wrapper = client_wrapper
169
+
170
+ async def pull(
171
+ self,
172
+ id: str,
173
+ *,
174
+ exclude_code: typing.Optional[bool] = None,
175
+ exclude_display: typing.Optional[bool] = None,
176
+ include_json: typing.Optional[bool] = None,
177
+ include_sandbox: typing.Optional[bool] = None,
178
+ strict: typing.Optional[bool] = None,
179
+ request_options: typing.Optional[RequestOptions] = None,
180
+ ) -> AsyncHttpResponse[typing.AsyncIterator[bytes]]:
181
+ """
182
+ Parameters
183
+ ----------
184
+ id : str
185
+ The ID of the Workflow to pull from
186
+
187
+ exclude_code : typing.Optional[bool]
188
+
189
+ exclude_display : typing.Optional[bool]
190
+
191
+ include_json : typing.Optional[bool]
192
+
193
+ include_sandbox : typing.Optional[bool]
194
+
195
+ strict : typing.Optional[bool]
196
+
197
+ request_options : typing.Optional[RequestOptions]
198
+ Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
199
+
200
+ Returns
201
+ -------
202
+ AsyncHttpResponse[typing.AsyncIterator[bytes]]
203
+
204
+ """
205
+ async with self._client_wrapper.httpx_client.stream(
206
+ f"v1/workflows/{jsonable_encoder(id)}/pull",
207
+ base_url=self._client_wrapper.get_environment().default,
208
+ method="GET",
209
+ params={
210
+ "exclude_code": exclude_code,
211
+ "exclude_display": exclude_display,
212
+ "include_json": include_json,
213
+ "include_sandbox": include_sandbox,
214
+ "strict": strict,
215
+ },
216
+ request_options=request_options,
217
+ ) as _response:
218
+ try:
219
+ if 200 <= _response.status_code < 300:
220
+ _chunk_size = request_options.get("chunk_size", None) if request_options is not None else None
221
+ return AsyncHttpResponse(
222
+ response=_response,
223
+ data=(_chunk async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size)),
224
+ )
225
+ await _response.aread()
226
+ if _response.status_code == 400:
227
+ raise BadRequestError(
228
+ typing.cast(
229
+ typing.Optional[typing.Any],
230
+ parse_obj_as(
231
+ type_=typing.Optional[typing.Any], # type: ignore
232
+ object_=_response.json(),
233
+ ),
234
+ )
235
+ )
236
+ _response_json = _response.json()
237
+ except JSONDecodeError:
238
+ raise ApiError(status_code=_response.status_code, body=_response.text)
239
+ raise ApiError(status_code=_response.status_code, body=_response_json)
240
+
241
+ async def push(
242
+ self,
243
+ *,
244
+ exec_config: WorkflowPushExecConfig,
245
+ workflow_sandbox_id: typing.Optional[str] = OMIT,
246
+ deployment_config: typing.Optional[WorkflowPushDeploymentConfigRequest] = OMIT,
247
+ artifact: typing.Optional[core.File] = OMIT,
248
+ dry_run: typing.Optional[bool] = OMIT,
249
+ strict: typing.Optional[bool] = OMIT,
250
+ request_options: typing.Optional[RequestOptions] = None,
251
+ ) -> AsyncHttpResponse[WorkflowPushResponse]:
252
+ """
253
+ Parameters
254
+ ----------
255
+ exec_config : WorkflowPushExecConfig
256
+ The execution configuration of the workflow.
257
+
258
+ workflow_sandbox_id : typing.Optional[str]
259
+
260
+ deployment_config : typing.Optional[WorkflowPushDeploymentConfigRequest]
261
+
262
+ artifact : typing.Optional[core.File]
263
+ See core.File for more documentation
264
+
265
+ dry_run : typing.Optional[bool]
266
+
267
+ strict : typing.Optional[bool]
268
+
269
+ request_options : typing.Optional[RequestOptions]
270
+ Request-specific configuration.
271
+
272
+ Returns
273
+ -------
274
+ AsyncHttpResponse[WorkflowPushResponse]
275
+
276
+ """
277
+ _response = await self._client_wrapper.httpx_client.request(
278
+ "v1/workflows/push",
279
+ base_url=self._client_wrapper.get_environment().default,
280
+ method="POST",
281
+ data={
282
+ "exec_config": exec_config,
283
+ "workflow_sandbox_id": workflow_sandbox_id,
284
+ "deployment_config": deployment_config,
285
+ "dry_run": dry_run,
286
+ "strict": strict,
287
+ },
288
+ files={
289
+ "artifact": artifact,
290
+ },
291
+ request_options=request_options,
292
+ omit=OMIT,
293
+ )
294
+ try:
295
+ if 200 <= _response.status_code < 300:
296
+ _data = typing.cast(
297
+ WorkflowPushResponse,
298
+ parse_obj_as(
299
+ type_=WorkflowPushResponse, # type: ignore
300
+ object_=_response.json(),
301
+ ),
302
+ )
303
+ return AsyncHttpResponse(response=_response, data=_data)
304
+ _response_json = _response.json()
305
+ except JSONDecodeError:
306
+ raise ApiError(status_code=_response.status_code, body=_response.text)
307
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -2,13 +2,11 @@
2
2
 
3
3
  import typing
4
4
  from ...core.client_wrapper import SyncClientWrapper
5
+ from .raw_client import RawWorkspaceSecretsClient
5
6
  from ...core.request_options import RequestOptions
6
7
  from ...types.workspace_secret_read import WorkspaceSecretRead
7
- from ...core.jsonable_encoder import jsonable_encoder
8
- from ...core.pydantic_utilities import parse_obj_as
9
- from json.decoder import JSONDecodeError
10
- from ...core.api_error import ApiError
11
8
  from ...core.client_wrapper import AsyncClientWrapper
9
+ from .raw_client import AsyncRawWorkspaceSecretsClient
12
10
 
13
11
  # this is used as the default value for optional parameters
14
12
  OMIT = typing.cast(typing.Any, ...)
@@ -16,7 +14,22 @@ OMIT = typing.cast(typing.Any, ...)
16
14
 
17
15
  class WorkspaceSecretsClient:
18
16
  def __init__(self, *, client_wrapper: SyncClientWrapper):
19
- self._client_wrapper = client_wrapper
17
+ self._raw_client = RawWorkspaceSecretsClient(client_wrapper=client_wrapper)
18
+
19
+ @property
20
+ def _client_wrapper(self) -> SyncClientWrapper:
21
+ return self._raw_client._client_wrapper
22
+
23
+ @property
24
+ def with_raw_response(self) -> RawWorkspaceSecretsClient:
25
+ """
26
+ Retrieves a raw implementation of this client that returns raw responses.
27
+
28
+ Returns
29
+ -------
30
+ RawWorkspaceSecretsClient
31
+ """
32
+ return self._raw_client
20
33
 
21
34
  def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> WorkspaceSecretRead:
22
35
  """
@@ -47,25 +60,11 @@ class WorkspaceSecretsClient:
47
60
  id="id",
48
61
  )
49
62
  """
50
- _response = self._client_wrapper.httpx_client.request(
51
- f"v1/workspace-secrets/{jsonable_encoder(id)}",
52
- base_url=self._client_wrapper.get_environment().default,
53
- method="GET",
63
+ response = self._raw_client.retrieve(
64
+ id,
54
65
  request_options=request_options,
55
66
  )
56
- try:
57
- if 200 <= _response.status_code < 300:
58
- return typing.cast(
59
- WorkspaceSecretRead,
60
- parse_obj_as(
61
- type_=WorkspaceSecretRead, # type: ignore
62
- object_=_response.json(),
63
- ),
64
- )
65
- _response_json = _response.json()
66
- except JSONDecodeError:
67
- raise ApiError(status_code=_response.status_code, body=_response.text)
68
- raise ApiError(status_code=_response.status_code, body=_response_json)
67
+ return response.data
69
68
 
70
69
  def partial_update(
71
70
  self,
@@ -107,38 +106,29 @@ class WorkspaceSecretsClient:
107
106
  id="id",
108
107
  )
109
108
  """
110
- _response = self._client_wrapper.httpx_client.request(
111
- f"v1/workspace-secrets/{jsonable_encoder(id)}",
112
- base_url=self._client_wrapper.get_environment().default,
113
- method="PATCH",
114
- json={
115
- "label": label,
116
- "value": value,
117
- },
118
- headers={
119
- "content-type": "application/json",
120
- },
109
+ response = self._raw_client.partial_update(
110
+ id,
111
+ label=label,
112
+ value=value,
121
113
  request_options=request_options,
122
- omit=OMIT,
123
114
  )
124
- try:
125
- if 200 <= _response.status_code < 300:
126
- return typing.cast(
127
- WorkspaceSecretRead,
128
- parse_obj_as(
129
- type_=WorkspaceSecretRead, # type: ignore
130
- object_=_response.json(),
131
- ),
132
- )
133
- _response_json = _response.json()
134
- except JSONDecodeError:
135
- raise ApiError(status_code=_response.status_code, body=_response.text)
136
- raise ApiError(status_code=_response.status_code, body=_response_json)
115
+ return response.data
137
116
 
138
117
 
139
118
  class AsyncWorkspaceSecretsClient:
140
119
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
141
- self._client_wrapper = client_wrapper
120
+ self._raw_client = AsyncRawWorkspaceSecretsClient(client_wrapper=client_wrapper)
121
+
122
+ @property
123
+ def with_raw_response(self) -> AsyncRawWorkspaceSecretsClient:
124
+ """
125
+ Retrieves a raw implementation of this client that returns raw responses.
126
+
127
+ Returns
128
+ -------
129
+ AsyncRawWorkspaceSecretsClient
130
+ """
131
+ return self._raw_client
142
132
 
143
133
  async def retrieve(
144
134
  self, id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -179,25 +169,11 @@ class AsyncWorkspaceSecretsClient:
179
169
 
180
170
  asyncio.run(main())
181
171
  """
182
- _response = await self._client_wrapper.httpx_client.request(
183
- f"v1/workspace-secrets/{jsonable_encoder(id)}",
184
- base_url=self._client_wrapper.get_environment().default,
185
- method="GET",
172
+ response = await self._raw_client.retrieve(
173
+ id,
186
174
  request_options=request_options,
187
175
  )
188
- try:
189
- if 200 <= _response.status_code < 300:
190
- return typing.cast(
191
- WorkspaceSecretRead,
192
- parse_obj_as(
193
- type_=WorkspaceSecretRead, # type: ignore
194
- object_=_response.json(),
195
- ),
196
- )
197
- _response_json = _response.json()
198
- except JSONDecodeError:
199
- raise ApiError(status_code=_response.status_code, body=_response.text)
200
- raise ApiError(status_code=_response.status_code, body=_response_json)
176
+ return response.data
201
177
 
202
178
  async def partial_update(
203
179
  self,
@@ -247,30 +223,10 @@ class AsyncWorkspaceSecretsClient:
247
223
 
248
224
  asyncio.run(main())
249
225
  """
250
- _response = await self._client_wrapper.httpx_client.request(
251
- f"v1/workspace-secrets/{jsonable_encoder(id)}",
252
- base_url=self._client_wrapper.get_environment().default,
253
- method="PATCH",
254
- json={
255
- "label": label,
256
- "value": value,
257
- },
258
- headers={
259
- "content-type": "application/json",
260
- },
226
+ response = await self._raw_client.partial_update(
227
+ id,
228
+ label=label,
229
+ value=value,
261
230
  request_options=request_options,
262
- omit=OMIT,
263
231
  )
264
- try:
265
- if 200 <= _response.status_code < 300:
266
- return typing.cast(
267
- WorkspaceSecretRead,
268
- parse_obj_as(
269
- type_=WorkspaceSecretRead, # type: ignore
270
- object_=_response.json(),
271
- ),
272
- )
273
- _response_json = _response.json()
274
- except JSONDecodeError:
275
- raise ApiError(status_code=_response.status_code, body=_response.text)
276
- raise ApiError(status_code=_response.status_code, body=_response_json)
232
+ return response.data