vellum-ai 0.6.9__py3-none-any.whl → 0.7.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +56 -0
- vellum/client.py +73 -40
- vellum/core/client_wrapper.py +1 -1
- vellum/lib/test_suites/resources.py +5 -5
- vellum/resources/document_indexes/client.py +114 -0
- vellum/resources/test_suites/client.py +19 -51
- vellum/types/__init__.py +58 -0
- vellum/types/array_vellum_value_item_request.py +82 -0
- vellum/types/code_execution_node_json_result.py +1 -1
- vellum/types/error_vellum_value_request.py +30 -0
- vellum/types/execution_json_vellum_value.py +1 -1
- vellum/types/function_call_vellum_value_request.py +30 -0
- vellum/types/image_vellum_value_request.py +30 -0
- vellum/types/json_variable_value.py +1 -1
- vellum/types/json_vellum_value.py +1 -1
- vellum/types/json_vellum_value_request.py +29 -0
- vellum/types/merge_node_result.py +3 -0
- vellum/types/merge_node_result_data.py +25 -0
- vellum/types/named_test_case_array_variable_value.py +31 -0
- vellum/types/named_test_case_array_variable_value_request.py +31 -0
- vellum/types/named_test_case_json_variable_value.py +1 -1
- vellum/types/named_test_case_json_variable_value_request.py +1 -1
- vellum/types/named_test_case_variable_value.py +12 -0
- vellum/types/named_test_case_variable_value_request.py +12 -0
- vellum/types/node_input_compiled_json_value.py +1 -1
- vellum/types/node_output_compiled_json_value.py +1 -1
- vellum/types/number_vellum_value_request.py +29 -0
- vellum/types/prompt_deployment_expand_meta_request_request.py +11 -11
- vellum/types/prompt_execution_meta.py +1 -1
- vellum/types/prompt_node_execution_meta.py +30 -0
- vellum/types/prompt_node_result_data.py +3 -0
- vellum/types/string_vellum_value_request.py +29 -0
- vellum/types/templating_node_json_result.py +1 -1
- vellum/types/terminal_node_json_result.py +1 -1
- vellum/types/test_case_array_variable_value.py +32 -0
- vellum/types/test_case_variable_value.py +12 -0
- vellum/types/test_suite_run_execution_array_output.py +32 -0
- vellum/types/test_suite_run_execution_json_output.py +1 -1
- vellum/types/test_suite_run_execution_output.py +12 -0
- vellum/types/test_suite_run_metric_number_output.py +1 -1
- vellum/types/test_suite_run_metric_string_output.py +1 -1
- vellum/types/test_suite_test_case_bulk_operation_request.py +12 -0
- vellum/types/test_suite_test_case_rejected_bulk_result.py +1 -1
- vellum/types/test_suite_test_case_upsert_bulk_operation_request.py +35 -0
- vellum/types/upsert_enum.py +5 -0
- vellum/types/upsert_test_suite_test_case_request.py +49 -0
- vellum/types/workflow_expand_meta_request.py +28 -0
- vellum/types/workflow_output_json.py +1 -1
- vellum/types/workflow_request_json_input_request.py +1 -1
- vellum/types/workflow_result_event_output_data_json.py +1 -1
- {vellum_ai-0.6.9.dist-info → vellum_ai-0.7.2.dist-info}/METADATA +1 -1
- {vellum_ai-0.6.9.dist-info → vellum_ai-0.7.2.dist-info}/RECORD +54 -37
- {vellum_ai-0.6.9.dist-info → vellum_ai-0.7.2.dist-info}/LICENSE +0 -0
- {vellum_ai-0.6.9.dist-info → vellum_ai-0.7.2.dist-info}/WHEEL +0 -0
vellum/client.py
CHANGED
@@ -42,6 +42,7 @@ from .types.search_response import SearchResponse
|
|
42
42
|
from .types.submit_completion_actual_request import SubmitCompletionActualRequest
|
43
43
|
from .types.submit_workflow_execution_actual_request import SubmitWorkflowExecutionActualRequest
|
44
44
|
from .types.workflow_execution_event_type import WorkflowExecutionEventType
|
45
|
+
from .types.workflow_expand_meta_request import WorkflowExpandMetaRequest
|
45
46
|
from .types.workflow_request_input_request import WorkflowRequestInputRequest
|
46
47
|
from .types.workflow_stream_event import WorkflowStreamEvent
|
47
48
|
|
@@ -121,23 +122,23 @@ class Vellum:
|
|
121
122
|
Executes a deployed Prompt and returns the result.
|
122
123
|
|
123
124
|
Parameters:
|
124
|
-
- inputs: typing.Sequence[PromptDeploymentInputRequest].
|
125
|
+
- inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
|
125
126
|
|
126
127
|
- prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
|
127
128
|
|
128
|
-
- prompt_deployment_name: typing.Optional[str]. The name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
129
|
+
- prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
129
130
|
|
130
131
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
|
131
132
|
|
132
|
-
- external_id: typing.Optional[str].
|
133
|
+
- external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
133
134
|
|
134
|
-
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest].
|
135
|
+
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
|
135
136
|
|
136
|
-
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest].
|
137
|
+
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
|
137
138
|
|
138
|
-
- expand_raw: typing.Optional[typing.Sequence[str]].
|
139
|
+
- expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
|
139
140
|
|
140
|
-
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
141
|
+
- metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
|
141
142
|
|
142
143
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
143
144
|
---
|
@@ -164,11 +165,11 @@ class Vellum:
|
|
164
165
|
external_id="string",
|
165
166
|
expand_meta=PromptDeploymentExpandMetaRequestRequest(
|
166
167
|
model_name=True,
|
168
|
+
usage=True,
|
169
|
+
finish_reason=True,
|
167
170
|
latency=True,
|
168
171
|
deployment_release_tag=True,
|
169
172
|
prompt_version_id=True,
|
170
|
-
finish_reason=True,
|
171
|
-
usage=True,
|
172
173
|
),
|
173
174
|
raw_overrides=RawPromptExecutionOverridesRequest(
|
174
175
|
body={"string": {"key": "value"}},
|
@@ -256,23 +257,23 @@ class Vellum:
|
|
256
257
|
Executes a deployed Prompt and streams back the results.
|
257
258
|
|
258
259
|
Parameters:
|
259
|
-
- inputs: typing.Sequence[PromptDeploymentInputRequest].
|
260
|
+
- inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
|
260
261
|
|
261
262
|
- prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
|
262
263
|
|
263
|
-
- prompt_deployment_name: typing.Optional[str]. The name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
264
|
+
- prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
264
265
|
|
265
266
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
|
266
267
|
|
267
|
-
- external_id: typing.Optional[str].
|
268
|
+
- external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
268
269
|
|
269
|
-
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest].
|
270
|
+
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
|
270
271
|
|
271
|
-
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest].
|
272
|
+
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
|
272
273
|
|
273
|
-
- expand_raw: typing.Optional[typing.Sequence[str]].
|
274
|
+
- expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
|
274
275
|
|
275
|
-
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
276
|
+
- metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
|
276
277
|
|
277
278
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
278
279
|
---
|
@@ -299,11 +300,11 @@ class Vellum:
|
|
299
300
|
external_id="string",
|
300
301
|
expand_meta=PromptDeploymentExpandMetaRequestRequest(
|
301
302
|
model_name=True,
|
303
|
+
usage=True,
|
304
|
+
finish_reason=True,
|
302
305
|
latency=True,
|
303
306
|
deployment_release_tag=True,
|
304
307
|
prompt_version_id=True,
|
305
|
-
finish_reason=True,
|
306
|
-
usage=True,
|
307
308
|
),
|
308
309
|
raw_overrides=RawPromptExecutionOverridesRequest(
|
309
310
|
body={"string": {"key": "value"}},
|
@@ -382,6 +383,7 @@ class Vellum:
|
|
382
383
|
self,
|
383
384
|
*,
|
384
385
|
inputs: typing.Sequence[WorkflowRequestInputRequest],
|
386
|
+
expand_meta: typing.Optional[WorkflowExpandMetaRequest] = OMIT,
|
385
387
|
workflow_deployment_id: typing.Optional[str] = OMIT,
|
386
388
|
workflow_deployment_name: typing.Optional[str] = OMIT,
|
387
389
|
release_tag: typing.Optional[str] = OMIT,
|
@@ -394,6 +396,8 @@ class Vellum:
|
|
394
396
|
Parameters:
|
395
397
|
- inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
|
396
398
|
|
399
|
+
- expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
|
400
|
+
|
397
401
|
- workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
|
398
402
|
|
399
403
|
- workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
|
@@ -404,7 +408,7 @@ class Vellum:
|
|
404
408
|
|
405
409
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
406
410
|
---
|
407
|
-
from vellum import WorkflowRequestInputRequest_String
|
411
|
+
from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
|
408
412
|
from vellum.client import Vellum
|
409
413
|
|
410
414
|
client = Vellum(
|
@@ -417,6 +421,9 @@ class Vellum:
|
|
417
421
|
value="string",
|
418
422
|
)
|
419
423
|
],
|
424
|
+
expand_meta=WorkflowExpandMetaRequest(
|
425
|
+
usage=True,
|
426
|
+
),
|
420
427
|
workflow_deployment_id="string",
|
421
428
|
workflow_deployment_name="string",
|
422
429
|
release_tag="string",
|
@@ -424,6 +431,8 @@ class Vellum:
|
|
424
431
|
)
|
425
432
|
"""
|
426
433
|
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
434
|
+
if expand_meta is not OMIT:
|
435
|
+
_request["expand_meta"] = expand_meta
|
427
436
|
if workflow_deployment_id is not OMIT:
|
428
437
|
_request["workflow_deployment_id"] = workflow_deployment_id
|
429
438
|
if workflow_deployment_name is not OMIT:
|
@@ -476,6 +485,7 @@ class Vellum:
|
|
476
485
|
self,
|
477
486
|
*,
|
478
487
|
inputs: typing.Sequence[WorkflowRequestInputRequest],
|
488
|
+
expand_meta: typing.Optional[WorkflowExpandMetaRequest] = OMIT,
|
479
489
|
workflow_deployment_id: typing.Optional[str] = OMIT,
|
480
490
|
workflow_deployment_name: typing.Optional[str] = OMIT,
|
481
491
|
release_tag: typing.Optional[str] = OMIT,
|
@@ -489,6 +499,8 @@ class Vellum:
|
|
489
499
|
Parameters:
|
490
500
|
- inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
|
491
501
|
|
502
|
+
- expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
|
503
|
+
|
492
504
|
- workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
|
493
505
|
|
494
506
|
- workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
|
@@ -501,7 +513,7 @@ class Vellum:
|
|
501
513
|
|
502
514
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
503
515
|
---
|
504
|
-
from vellum import WorkflowRequestInputRequest_String
|
516
|
+
from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
|
505
517
|
from vellum.client import Vellum
|
506
518
|
|
507
519
|
client = Vellum(
|
@@ -514,6 +526,9 @@ class Vellum:
|
|
514
526
|
value="string",
|
515
527
|
)
|
516
528
|
],
|
529
|
+
expand_meta=WorkflowExpandMetaRequest(
|
530
|
+
usage=True,
|
531
|
+
),
|
517
532
|
workflow_deployment_id="string",
|
518
533
|
workflow_deployment_name="string",
|
519
534
|
release_tag="string",
|
@@ -522,6 +537,8 @@ class Vellum:
|
|
522
537
|
)
|
523
538
|
"""
|
524
539
|
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
540
|
+
if expand_meta is not OMIT:
|
541
|
+
_request["expand_meta"] = expand_meta
|
525
542
|
if workflow_deployment_id is not OMIT:
|
526
543
|
_request["workflow_deployment_id"] = workflow_deployment_id
|
527
544
|
if workflow_deployment_name is not OMIT:
|
@@ -1082,23 +1099,23 @@ class AsyncVellum:
|
|
1082
1099
|
Executes a deployed Prompt and returns the result.
|
1083
1100
|
|
1084
1101
|
Parameters:
|
1085
|
-
- inputs: typing.Sequence[PromptDeploymentInputRequest].
|
1102
|
+
- inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
|
1086
1103
|
|
1087
1104
|
- prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
|
1088
1105
|
|
1089
|
-
- prompt_deployment_name: typing.Optional[str]. The name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
1106
|
+
- prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
1090
1107
|
|
1091
1108
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
|
1092
1109
|
|
1093
|
-
- external_id: typing.Optional[str].
|
1110
|
+
- external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
1094
1111
|
|
1095
|
-
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest].
|
1112
|
+
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
|
1096
1113
|
|
1097
|
-
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest].
|
1114
|
+
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
|
1098
1115
|
|
1099
|
-
- expand_raw: typing.Optional[typing.Sequence[str]].
|
1116
|
+
- expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
|
1100
1117
|
|
1101
|
-
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
1118
|
+
- metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
|
1102
1119
|
|
1103
1120
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
1104
1121
|
---
|
@@ -1125,11 +1142,11 @@ class AsyncVellum:
|
|
1125
1142
|
external_id="string",
|
1126
1143
|
expand_meta=PromptDeploymentExpandMetaRequestRequest(
|
1127
1144
|
model_name=True,
|
1145
|
+
usage=True,
|
1146
|
+
finish_reason=True,
|
1128
1147
|
latency=True,
|
1129
1148
|
deployment_release_tag=True,
|
1130
1149
|
prompt_version_id=True,
|
1131
|
-
finish_reason=True,
|
1132
|
-
usage=True,
|
1133
1150
|
),
|
1134
1151
|
raw_overrides=RawPromptExecutionOverridesRequest(
|
1135
1152
|
body={"string": {"key": "value"}},
|
@@ -1217,23 +1234,23 @@ class AsyncVellum:
|
|
1217
1234
|
Executes a deployed Prompt and streams back the results.
|
1218
1235
|
|
1219
1236
|
Parameters:
|
1220
|
-
- inputs: typing.Sequence[PromptDeploymentInputRequest].
|
1237
|
+
- inputs: typing.Sequence[PromptDeploymentInputRequest]. A list consisting of the Prompt Deployment's input variables and their values.
|
1221
1238
|
|
1222
1239
|
- prompt_deployment_id: typing.Optional[str]. The ID of the Prompt Deployment. Must provide either this or prompt_deployment_name.
|
1223
1240
|
|
1224
|
-
- prompt_deployment_name: typing.Optional[str]. The name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
1241
|
+
- prompt_deployment_name: typing.Optional[str]. The unique name of the Prompt Deployment. Must provide either this or prompt_deployment_id.
|
1225
1242
|
|
1226
1243
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Prompt Deployment
|
1227
1244
|
|
1228
|
-
- external_id: typing.Optional[str].
|
1245
|
+
- external_id: typing.Optional[str]. Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
1229
1246
|
|
1230
|
-
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest].
|
1247
|
+
- expand_meta: typing.Optional[PromptDeploymentExpandMetaRequestRequest]. An optionally specified configuration used to opt in to including additional metadata about this prompt execution in the API response. Corresponding values will be returned under the `meta` key of the API response.
|
1231
1248
|
|
1232
|
-
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest].
|
1249
|
+
- raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest]. Overrides for the raw API request sent to the model host. Combined with `expand_raw`, it can be used to access new features from models.
|
1233
1250
|
|
1234
|
-
- expand_raw: typing.Optional[typing.Sequence[str]].
|
1251
|
+
- expand_raw: typing.Optional[typing.Sequence[str]]. A list of keys whose values you'd like to directly return from the JSON response of the model provider. Useful if you need lower-level info returned by model providers that Vellum would otherwise omit. Corresponding key/value pairs will be returned under the `raw` key of the API response.
|
1235
1252
|
|
1236
|
-
- metadata: typing.Optional[typing.Dict[str, typing.Any]].
|
1253
|
+
- metadata: typing.Optional[typing.Dict[str, typing.Any]]. Arbitrary JSON metadata associated with this request. Can be used to capture additional monitoring data such as user id, session id, etc. for future analysis.
|
1237
1254
|
|
1238
1255
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
1239
1256
|
---
|
@@ -1260,11 +1277,11 @@ class AsyncVellum:
|
|
1260
1277
|
external_id="string",
|
1261
1278
|
expand_meta=PromptDeploymentExpandMetaRequestRequest(
|
1262
1279
|
model_name=True,
|
1280
|
+
usage=True,
|
1281
|
+
finish_reason=True,
|
1263
1282
|
latency=True,
|
1264
1283
|
deployment_release_tag=True,
|
1265
1284
|
prompt_version_id=True,
|
1266
|
-
finish_reason=True,
|
1267
|
-
usage=True,
|
1268
1285
|
),
|
1269
1286
|
raw_overrides=RawPromptExecutionOverridesRequest(
|
1270
1287
|
body={"string": {"key": "value"}},
|
@@ -1343,6 +1360,7 @@ class AsyncVellum:
|
|
1343
1360
|
self,
|
1344
1361
|
*,
|
1345
1362
|
inputs: typing.Sequence[WorkflowRequestInputRequest],
|
1363
|
+
expand_meta: typing.Optional[WorkflowExpandMetaRequest] = OMIT,
|
1346
1364
|
workflow_deployment_id: typing.Optional[str] = OMIT,
|
1347
1365
|
workflow_deployment_name: typing.Optional[str] = OMIT,
|
1348
1366
|
release_tag: typing.Optional[str] = OMIT,
|
@@ -1355,6 +1373,8 @@ class AsyncVellum:
|
|
1355
1373
|
Parameters:
|
1356
1374
|
- inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
|
1357
1375
|
|
1376
|
+
- expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
|
1377
|
+
|
1358
1378
|
- workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
|
1359
1379
|
|
1360
1380
|
- workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
|
@@ -1365,7 +1385,7 @@ class AsyncVellum:
|
|
1365
1385
|
|
1366
1386
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
1367
1387
|
---
|
1368
|
-
from vellum import WorkflowRequestInputRequest_String
|
1388
|
+
from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
|
1369
1389
|
from vellum.client import AsyncVellum
|
1370
1390
|
|
1371
1391
|
client = AsyncVellum(
|
@@ -1378,6 +1398,9 @@ class AsyncVellum:
|
|
1378
1398
|
value="string",
|
1379
1399
|
)
|
1380
1400
|
],
|
1401
|
+
expand_meta=WorkflowExpandMetaRequest(
|
1402
|
+
usage=True,
|
1403
|
+
),
|
1381
1404
|
workflow_deployment_id="string",
|
1382
1405
|
workflow_deployment_name="string",
|
1383
1406
|
release_tag="string",
|
@@ -1385,6 +1408,8 @@ class AsyncVellum:
|
|
1385
1408
|
)
|
1386
1409
|
"""
|
1387
1410
|
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
1411
|
+
if expand_meta is not OMIT:
|
1412
|
+
_request["expand_meta"] = expand_meta
|
1388
1413
|
if workflow_deployment_id is not OMIT:
|
1389
1414
|
_request["workflow_deployment_id"] = workflow_deployment_id
|
1390
1415
|
if workflow_deployment_name is not OMIT:
|
@@ -1437,6 +1462,7 @@ class AsyncVellum:
|
|
1437
1462
|
self,
|
1438
1463
|
*,
|
1439
1464
|
inputs: typing.Sequence[WorkflowRequestInputRequest],
|
1465
|
+
expand_meta: typing.Optional[WorkflowExpandMetaRequest] = OMIT,
|
1440
1466
|
workflow_deployment_id: typing.Optional[str] = OMIT,
|
1441
1467
|
workflow_deployment_name: typing.Optional[str] = OMIT,
|
1442
1468
|
release_tag: typing.Optional[str] = OMIT,
|
@@ -1450,6 +1476,8 @@ class AsyncVellum:
|
|
1450
1476
|
Parameters:
|
1451
1477
|
- inputs: typing.Sequence[WorkflowRequestInputRequest]. The list of inputs defined in the Workflow's Deployment with their corresponding values.
|
1452
1478
|
|
1479
|
+
- expand_meta: typing.Optional[WorkflowExpandMetaRequest]. An optionally specified configuration used to opt in to including additional metadata about this workflow execution in the API response. Corresponding values will be returned under the `execution_meta` key within NODE events in the response stream.
|
1480
|
+
|
1453
1481
|
- workflow_deployment_id: typing.Optional[str]. The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
|
1454
1482
|
|
1455
1483
|
- workflow_deployment_name: typing.Optional[str]. The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
|
@@ -1462,7 +1490,7 @@ class AsyncVellum:
|
|
1462
1490
|
|
1463
1491
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
1464
1492
|
---
|
1465
|
-
from vellum import WorkflowRequestInputRequest_String
|
1493
|
+
from vellum import WorkflowExpandMetaRequest, WorkflowRequestInputRequest_String
|
1466
1494
|
from vellum.client import AsyncVellum
|
1467
1495
|
|
1468
1496
|
client = AsyncVellum(
|
@@ -1475,6 +1503,9 @@ class AsyncVellum:
|
|
1475
1503
|
value="string",
|
1476
1504
|
)
|
1477
1505
|
],
|
1506
|
+
expand_meta=WorkflowExpandMetaRequest(
|
1507
|
+
usage=True,
|
1508
|
+
),
|
1478
1509
|
workflow_deployment_id="string",
|
1479
1510
|
workflow_deployment_name="string",
|
1480
1511
|
release_tag="string",
|
@@ -1483,6 +1514,8 @@ class AsyncVellum:
|
|
1483
1514
|
)
|
1484
1515
|
"""
|
1485
1516
|
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
1517
|
+
if expand_meta is not OMIT:
|
1518
|
+
_request["expand_meta"] = expand_meta
|
1486
1519
|
if workflow_deployment_id is not OMIT:
|
1487
1520
|
_request["workflow_deployment_id"] = workflow_deployment_id
|
1488
1521
|
if workflow_deployment_name is not OMIT:
|
vellum/core/client_wrapper.py
CHANGED
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
3
3
|
import logging
|
4
4
|
import time
|
5
5
|
from functools import cached_property
|
6
|
-
from typing import Callable, Generator, List,
|
6
|
+
from typing import Callable, Generator, List, cast, Iterable
|
7
7
|
|
8
8
|
from vellum import TestSuiteRunRead, TestSuiteRunMetricOutput_Number
|
9
9
|
from vellum.client import Vellum
|
@@ -174,7 +174,7 @@ class VellumTestSuiteRunResults:
|
|
174
174
|
self,
|
175
175
|
metric_identifier: str | None = None,
|
176
176
|
output_identifier: str | None = None,
|
177
|
-
) -> List[float]:
|
177
|
+
) -> List[float | None]:
|
178
178
|
"""Returns the values of a numeric metric output that match the given criteria."""
|
179
179
|
|
180
180
|
metric_outputs: list[TestSuiteRunMetricOutput_Number] = []
|
@@ -198,7 +198,7 @@ class VellumTestSuiteRunResults:
|
|
198
198
|
output_values = self.get_numeric_metric_output_values(
|
199
199
|
metric_identifier=metric_identifier, output_identifier=output_identifier
|
200
200
|
)
|
201
|
-
return sum(output_values) / len(output_values)
|
201
|
+
return sum(cast(Iterable[float], filter(lambda o: isinstance(o, float), output_values))) / len(output_values)
|
202
202
|
|
203
203
|
def get_min_metric_output(
|
204
204
|
self, metric_identifier: str | None = None, output_identifier: str | None = None
|
@@ -207,7 +207,7 @@ class VellumTestSuiteRunResults:
|
|
207
207
|
output_values = self.get_numeric_metric_output_values(
|
208
208
|
metric_identifier=metric_identifier, output_identifier=output_identifier
|
209
209
|
)
|
210
|
-
return min(output_values)
|
210
|
+
return min(cast(Iterable[float], filter(lambda o: isinstance(o, float), output_values)))
|
211
211
|
|
212
212
|
def get_max_metric_output(
|
213
213
|
self, metric_identifier: str | None = None, output_identifier: str | None = None
|
@@ -216,7 +216,7 @@ class VellumTestSuiteRunResults:
|
|
216
216
|
output_values = self.get_numeric_metric_output_values(
|
217
217
|
metric_identifier=metric_identifier, output_identifier=output_identifier
|
218
218
|
)
|
219
|
-
return max(output_values)
|
219
|
+
return max(cast(Iterable[float], filter(lambda o: isinstance(o, float), output_values)))
|
220
220
|
|
221
221
|
def wait_until_complete(self) -> None:
|
222
222
|
"""Wait until the Test Suite Run is no longer in a QUEUED or RUNNING state."""
|
@@ -458,6 +458,63 @@ class DocumentIndexesClient:
|
|
458
458
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
459
459
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
460
460
|
|
461
|
+
def add_document(
|
462
|
+
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
463
|
+
) -> None:
|
464
|
+
"""
|
465
|
+
Adds a previously uploaded Document to the specified Document Index.
|
466
|
+
|
467
|
+
Parameters:
|
468
|
+
- document_id: str. Either the Vellum-generated ID or the originally supplied external_id that uniquely identifies the Document you'd like to add.
|
469
|
+
|
470
|
+
- id: str. Either the Vellum-generated ID or the originally specified name that uniquely identifies the Document Index to which you'd like to add the Document.
|
471
|
+
|
472
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
473
|
+
---
|
474
|
+
from vellum.client import Vellum
|
475
|
+
|
476
|
+
client = Vellum(
|
477
|
+
api_key="YOUR_API_KEY",
|
478
|
+
)
|
479
|
+
client.document_indexes.add_document(
|
480
|
+
document_id="document_id",
|
481
|
+
id="id",
|
482
|
+
)
|
483
|
+
"""
|
484
|
+
_response = self._client_wrapper.httpx_client.request(
|
485
|
+
method="POST",
|
486
|
+
url=urllib.parse.urljoin(
|
487
|
+
f"{self._client_wrapper.get_environment().default}/",
|
488
|
+
f"v1/document-indexes/{jsonable_encoder(id)}/documents/{jsonable_encoder(document_id)}",
|
489
|
+
),
|
490
|
+
params=jsonable_encoder(
|
491
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
492
|
+
),
|
493
|
+
json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
|
494
|
+
if request_options is not None
|
495
|
+
else None,
|
496
|
+
headers=jsonable_encoder(
|
497
|
+
remove_none_from_dict(
|
498
|
+
{
|
499
|
+
**self._client_wrapper.get_headers(),
|
500
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
501
|
+
}
|
502
|
+
)
|
503
|
+
),
|
504
|
+
timeout=request_options.get("timeout_in_seconds")
|
505
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
506
|
+
else self._client_wrapper.get_timeout(),
|
507
|
+
retries=0,
|
508
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
509
|
+
)
|
510
|
+
if 200 <= _response.status_code < 300:
|
511
|
+
return
|
512
|
+
try:
|
513
|
+
_response_json = _response.json()
|
514
|
+
except JSONDecodeError:
|
515
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
516
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
517
|
+
|
461
518
|
def remove_document(
|
462
519
|
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
463
520
|
) -> None:
|
@@ -950,6 +1007,63 @@ class AsyncDocumentIndexesClient:
|
|
950
1007
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
951
1008
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
952
1009
|
|
1010
|
+
async def add_document(
|
1011
|
+
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
1012
|
+
) -> None:
|
1013
|
+
"""
|
1014
|
+
Adds a previously uploaded Document to the specified Document Index.
|
1015
|
+
|
1016
|
+
Parameters:
|
1017
|
+
- document_id: str. Either the Vellum-generated ID or the originally supplied external_id that uniquely identifies the Document you'd like to add.
|
1018
|
+
|
1019
|
+
- id: str. Either the Vellum-generated ID or the originally specified name that uniquely identifies the Document Index to which you'd like to add the Document.
|
1020
|
+
|
1021
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
1022
|
+
---
|
1023
|
+
from vellum.client import AsyncVellum
|
1024
|
+
|
1025
|
+
client = AsyncVellum(
|
1026
|
+
api_key="YOUR_API_KEY",
|
1027
|
+
)
|
1028
|
+
await client.document_indexes.add_document(
|
1029
|
+
document_id="document_id",
|
1030
|
+
id="id",
|
1031
|
+
)
|
1032
|
+
"""
|
1033
|
+
_response = await self._client_wrapper.httpx_client.request(
|
1034
|
+
method="POST",
|
1035
|
+
url=urllib.parse.urljoin(
|
1036
|
+
f"{self._client_wrapper.get_environment().default}/",
|
1037
|
+
f"v1/document-indexes/{jsonable_encoder(id)}/documents/{jsonable_encoder(document_id)}",
|
1038
|
+
),
|
1039
|
+
params=jsonable_encoder(
|
1040
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
1041
|
+
),
|
1042
|
+
json=jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))
|
1043
|
+
if request_options is not None
|
1044
|
+
else None,
|
1045
|
+
headers=jsonable_encoder(
|
1046
|
+
remove_none_from_dict(
|
1047
|
+
{
|
1048
|
+
**self._client_wrapper.get_headers(),
|
1049
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
1050
|
+
}
|
1051
|
+
)
|
1052
|
+
),
|
1053
|
+
timeout=request_options.get("timeout_in_seconds")
|
1054
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
1055
|
+
else self._client_wrapper.get_timeout(),
|
1056
|
+
retries=0,
|
1057
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
1058
|
+
)
|
1059
|
+
if 200 <= _response.status_code < 300:
|
1060
|
+
return
|
1061
|
+
try:
|
1062
|
+
_response_json = _response.json()
|
1063
|
+
except JSONDecodeError:
|
1064
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
1065
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
1066
|
+
|
953
1067
|
async def remove_document(
|
954
1068
|
self, document_id: str, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
955
1069
|
) -> None:
|