vellum-ai 0.8.5__py3-none-any.whl → 0.8.7__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +64 -104
- vellum/client.py +39 -17
- vellum/core/client_wrapper.py +1 -1
- vellum/resources/__init__.py +2 -2
- vellum/resources/ad_hoc/client.py +372 -0
- vellum/types/__init__.py +62 -102
- vellum/types/ad_hoc_execute_prompt_event.py +14 -0
- vellum/types/ad_hoc_expand_meta_request.py +33 -0
- vellum/types/ad_hoc_fulfilled_prompt_execution_meta.py +27 -0
- vellum/types/{open_api_const_property_request.py → ad_hoc_initiated_prompt_execution_meta.py} +4 -6
- vellum/types/{open_api_boolean_property_request.py → ad_hoc_rejected_prompt_execution_meta.py} +5 -6
- vellum/types/{tik_token_tokenizer_config_request.py → ad_hoc_streaming_prompt_execution_meta.py} +3 -4
- vellum/types/{open_api_one_of_property.py → chat_message_prompt_block_properties_request.py} +10 -9
- vellum/types/chat_message_prompt_block_request.py +36 -0
- vellum/types/{ml_model_developer_enum_value_label.py → ephemeral_prompt_cache_config_request.py} +4 -5
- vellum/types/ephemeral_prompt_cache_config_type_enum.py +5 -0
- vellum/types/fulfilled_ad_hoc_execute_prompt_event.py +28 -0
- vellum/types/function_definition_prompt_block_properties_request.py +42 -0
- vellum/types/function_definition_prompt_block_request.py +30 -0
- vellum/types/{hugging_face_tokenizer_config.py → initiated_ad_hoc_execute_prompt_event.py} +6 -5
- vellum/types/{ml_model_display_tag_enum_value_label.py → jinja_prompt_block_properties_request.py} +5 -5
- vellum/types/jinja_prompt_block_request.py +30 -0
- vellum/types/ml_model_usage.py +2 -0
- vellum/types/plain_text_prompt_block_request.py +29 -0
- vellum/types/prompt_block_request.py +19 -0
- vellum/types/prompt_block_state.py +5 -0
- vellum/types/{prompt_deployment_expand_meta_request_request.py → prompt_deployment_expand_meta_request.py} +1 -1
- vellum/types/prompt_parameters_request.py +27 -0
- vellum/types/{open_api_boolean_property.py → prompt_request_chat_history_input_request.py} +7 -7
- vellum/types/prompt_request_input_request.py +10 -0
- vellum/types/{hugging_face_tokenizer_config_request.py → prompt_request_json_input_request.py} +6 -6
- vellum/types/{tik_token_tokenizer_config.py → prompt_request_string_input_request.py} +6 -5
- vellum/types/rejected_ad_hoc_execute_prompt_event.py +28 -0
- vellum/types/rich_text_child_block_request.py +7 -0
- vellum/types/rich_text_prompt_block_request.py +30 -0
- vellum/types/streaming_ad_hoc_execute_prompt_event.py +33 -0
- vellum/types/variable_prompt_block_request.py +29 -0
- vellum/types/{ml_model_family_enum_value_label.py → vellum_variable_request.py} +5 -4
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/METADATA +1 -1
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/RECORD +43 -63
- vellum/resources/ml_models/client.py +0 -948
- vellum/types/hosted_by_enum.py +0 -26
- vellum/types/ml_model_developer.py +0 -27
- vellum/types/ml_model_display_config_labelled.py +0 -26
- vellum/types/ml_model_display_config_request.py +0 -26
- vellum/types/ml_model_display_tag.py +0 -7
- vellum/types/ml_model_exec_config.py +0 -34
- vellum/types/ml_model_exec_config_request.py +0 -34
- vellum/types/ml_model_family.py +0 -29
- vellum/types/ml_model_feature.py +0 -18
- vellum/types/ml_model_parameter_config.py +0 -32
- vellum/types/ml_model_parameter_config_request.py +0 -32
- vellum/types/ml_model_read.py +0 -92
- vellum/types/ml_model_request_authorization_config.py +0 -20
- vellum/types/ml_model_request_authorization_config_request.py +0 -20
- vellum/types/ml_model_request_authorization_config_type_enum.py +0 -5
- vellum/types/ml_model_request_config.py +0 -22
- vellum/types/ml_model_request_config_request.py +0 -22
- vellum/types/ml_model_response_config.py +0 -21
- vellum/types/ml_model_response_config_request.py +0 -21
- vellum/types/ml_model_tokenizer_config.py +0 -7
- vellum/types/ml_model_tokenizer_config_request.py +0 -7
- vellum/types/open_api_array_property.py +0 -41
- vellum/types/open_api_array_property_request.py +0 -41
- vellum/types/open_api_const_property.py +0 -26
- vellum/types/open_api_integer_property.py +0 -30
- vellum/types/open_api_integer_property_request.py +0 -30
- vellum/types/open_api_number_property.py +0 -31
- vellum/types/open_api_number_property_request.py +0 -31
- vellum/types/open_api_object_property.py +0 -40
- vellum/types/open_api_object_property_request.py +0 -40
- vellum/types/open_api_one_of_property_request.py +0 -33
- vellum/types/open_api_property.py +0 -27
- vellum/types/open_api_property_request.py +0 -27
- vellum/types/open_api_ref_property.py +0 -26
- vellum/types/open_api_ref_property_request.py +0 -26
- vellum/types/open_api_string_property.py +0 -30
- vellum/types/open_api_string_property_request.py +0 -30
- vellum/types/paginated_ml_model_read_list.py +0 -23
- vellum/types/visibility_enum.py +0 -5
- /vellum/resources/{ml_models → ad_hoc}/__init__.py +0 -0
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/LICENSE +0 -0
- {vellum_ai-0.8.5.dist-info → vellum_ai-0.8.7.dist-info}/WHEEL +0 -0
vellum/client.py
CHANGED
@@ -4,18 +4,18 @@ import typing
|
|
4
4
|
from .environment import VellumEnvironment
|
5
5
|
import httpx
|
6
6
|
from .core.client_wrapper import SyncClientWrapper
|
7
|
+
from .resources.ad_hoc.client import AdHocClient
|
7
8
|
from .resources.deployments.client import DeploymentsClient
|
8
9
|
from .resources.document_indexes.client import DocumentIndexesClient
|
9
10
|
from .resources.documents.client import DocumentsClient
|
10
11
|
from .resources.folder_entities.client import FolderEntitiesClient
|
11
|
-
from .resources.ml_models.client import MlModelsClient
|
12
12
|
from .resources.sandboxes.client import SandboxesClient
|
13
13
|
from .resources.test_suite_runs.client import TestSuiteRunsClient
|
14
14
|
from .resources.test_suites.client import TestSuitesClient
|
15
15
|
from .resources.workflow_deployments.client import WorkflowDeploymentsClient
|
16
16
|
from .resources.workflow_sandboxes.client import WorkflowSandboxesClient
|
17
17
|
from .types.prompt_deployment_input_request import PromptDeploymentInputRequest
|
18
|
-
from .types.
|
18
|
+
from .types.prompt_deployment_expand_meta_request import PromptDeploymentExpandMetaRequest
|
19
19
|
from .types.raw_prompt_execution_overrides_request import RawPromptExecutionOverridesRequest
|
20
20
|
from .core.request_options import RequestOptions
|
21
21
|
from .types.execute_prompt_response import ExecutePromptResponse
|
@@ -42,11 +42,11 @@ 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 .core.client_wrapper import AsyncClientWrapper
|
45
|
+
from .resources.ad_hoc.client import AsyncAdHocClient
|
45
46
|
from .resources.deployments.client import AsyncDeploymentsClient
|
46
47
|
from .resources.document_indexes.client import AsyncDocumentIndexesClient
|
47
48
|
from .resources.documents.client import AsyncDocumentsClient
|
48
49
|
from .resources.folder_entities.client import AsyncFolderEntitiesClient
|
49
|
-
from .resources.ml_models.client import AsyncMlModelsClient
|
50
50
|
from .resources.sandboxes.client import AsyncSandboxesClient
|
51
51
|
from .resources.test_suite_runs.client import AsyncTestSuiteRunsClient
|
52
52
|
from .resources.test_suites.client import AsyncTestSuitesClient
|
@@ -111,11 +111,11 @@ class Vellum:
|
|
111
111
|
else httpx.Client(timeout=_defaulted_timeout),
|
112
112
|
timeout=_defaulted_timeout,
|
113
113
|
)
|
114
|
+
self.ad_hoc = AdHocClient(client_wrapper=self._client_wrapper)
|
114
115
|
self.deployments = DeploymentsClient(client_wrapper=self._client_wrapper)
|
115
116
|
self.document_indexes = DocumentIndexesClient(client_wrapper=self._client_wrapper)
|
116
117
|
self.documents = DocumentsClient(client_wrapper=self._client_wrapper)
|
117
118
|
self.folder_entities = FolderEntitiesClient(client_wrapper=self._client_wrapper)
|
118
|
-
self.ml_models = MlModelsClient(client_wrapper=self._client_wrapper)
|
119
119
|
self.sandboxes = SandboxesClient(client_wrapper=self._client_wrapper)
|
120
120
|
self.test_suite_runs = TestSuiteRunsClient(client_wrapper=self._client_wrapper)
|
121
121
|
self.test_suites = TestSuitesClient(client_wrapper=self._client_wrapper)
|
@@ -130,7 +130,7 @@ class Vellum:
|
|
130
130
|
prompt_deployment_name: typing.Optional[str] = OMIT,
|
131
131
|
release_tag: typing.Optional[str] = OMIT,
|
132
132
|
external_id: typing.Optional[str] = OMIT,
|
133
|
-
expand_meta: typing.Optional[
|
133
|
+
expand_meta: typing.Optional[PromptDeploymentExpandMetaRequest] = OMIT,
|
134
134
|
raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
|
135
135
|
expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
|
136
136
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
@@ -156,7 +156,7 @@ class Vellum:
|
|
156
156
|
external_id : typing.Optional[str]
|
157
157
|
Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
158
158
|
|
159
|
-
expand_meta : typing.Optional[
|
159
|
+
expand_meta : typing.Optional[PromptDeploymentExpandMetaRequest]
|
160
160
|
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.
|
161
161
|
|
162
162
|
raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
|
@@ -272,7 +272,7 @@ class Vellum:
|
|
272
272
|
prompt_deployment_name: typing.Optional[str] = OMIT,
|
273
273
|
release_tag: typing.Optional[str] = OMIT,
|
274
274
|
external_id: typing.Optional[str] = OMIT,
|
275
|
-
expand_meta: typing.Optional[
|
275
|
+
expand_meta: typing.Optional[PromptDeploymentExpandMetaRequest] = OMIT,
|
276
276
|
raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
|
277
277
|
expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
|
278
278
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
@@ -298,7 +298,7 @@ class Vellum:
|
|
298
298
|
external_id : typing.Optional[str]
|
299
299
|
Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
300
300
|
|
301
|
-
expand_meta : typing.Optional[
|
301
|
+
expand_meta : typing.Optional[PromptDeploymentExpandMetaRequest]
|
302
302
|
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.
|
303
303
|
|
304
304
|
raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
|
@@ -321,7 +321,7 @@ class Vellum:
|
|
321
321
|
Examples
|
322
322
|
--------
|
323
323
|
from vellum import (
|
324
|
-
|
324
|
+
PromptDeploymentExpandMetaRequest,
|
325
325
|
RawPromptExecutionOverridesRequest,
|
326
326
|
StringInputRequest,
|
327
327
|
Vellum,
|
@@ -341,7 +341,7 @@ class Vellum:
|
|
341
341
|
prompt_deployment_name="string",
|
342
342
|
release_tag="string",
|
343
343
|
external_id="string",
|
344
|
-
expand_meta=
|
344
|
+
expand_meta=PromptDeploymentExpandMetaRequest(
|
345
345
|
model_name=True,
|
346
346
|
usage=True,
|
347
347
|
finish_reason=True,
|
@@ -449,6 +449,7 @@ class Vellum:
|
|
449
449
|
workflow_deployment_name: typing.Optional[str] = OMIT,
|
450
450
|
release_tag: typing.Optional[str] = OMIT,
|
451
451
|
external_id: typing.Optional[str] = OMIT,
|
452
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
452
453
|
request_options: typing.Optional[RequestOptions] = None,
|
453
454
|
) -> ExecuteWorkflowResponse:
|
454
455
|
"""
|
@@ -474,6 +475,9 @@ class Vellum:
|
|
474
475
|
external_id : typing.Optional[str]
|
475
476
|
Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
|
476
477
|
|
478
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
479
|
+
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.
|
480
|
+
|
477
481
|
request_options : typing.Optional[RequestOptions]
|
478
482
|
Request-specific configuration.
|
479
483
|
|
@@ -509,6 +513,7 @@ class Vellum:
|
|
509
513
|
"workflow_deployment_name": workflow_deployment_name,
|
510
514
|
"release_tag": release_tag,
|
511
515
|
"external_id": external_id,
|
516
|
+
"metadata": metadata,
|
512
517
|
},
|
513
518
|
request_options=request_options,
|
514
519
|
omit=OMIT,
|
@@ -567,6 +572,7 @@ class Vellum:
|
|
567
572
|
release_tag: typing.Optional[str] = OMIT,
|
568
573
|
external_id: typing.Optional[str] = OMIT,
|
569
574
|
event_types: typing.Optional[typing.Sequence[WorkflowExecutionEventType]] = OMIT,
|
575
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
570
576
|
request_options: typing.Optional[RequestOptions] = None,
|
571
577
|
) -> typing.Iterator[WorkflowStreamEvent]:
|
572
578
|
"""
|
@@ -595,6 +601,9 @@ class Vellum:
|
|
595
601
|
event_types : typing.Optional[typing.Sequence[WorkflowExecutionEventType]]
|
596
602
|
Optionally specify which events you want to receive. Defaults to only WORKFLOW events. Note that the schema of non-WORKFLOW events is unstable and should be used with caution.
|
597
603
|
|
604
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
605
|
+
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.
|
606
|
+
|
598
607
|
request_options : typing.Optional[RequestOptions]
|
599
608
|
Request-specific configuration.
|
600
609
|
|
@@ -629,6 +638,7 @@ class Vellum:
|
|
629
638
|
release_tag="string",
|
630
639
|
external_id="string",
|
631
640
|
event_types=["NODE"],
|
641
|
+
metadata={"string": {"key": "value"}},
|
632
642
|
)
|
633
643
|
for chunk in response:
|
634
644
|
yield chunk
|
@@ -645,6 +655,7 @@ class Vellum:
|
|
645
655
|
"release_tag": release_tag,
|
646
656
|
"external_id": external_id,
|
647
657
|
"event_types": event_types,
|
658
|
+
"metadata": metadata,
|
648
659
|
},
|
649
660
|
request_options=request_options,
|
650
661
|
omit=OMIT,
|
@@ -1278,11 +1289,11 @@ class AsyncVellum:
|
|
1278
1289
|
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
1279
1290
|
timeout=_defaulted_timeout,
|
1280
1291
|
)
|
1292
|
+
self.ad_hoc = AsyncAdHocClient(client_wrapper=self._client_wrapper)
|
1281
1293
|
self.deployments = AsyncDeploymentsClient(client_wrapper=self._client_wrapper)
|
1282
1294
|
self.document_indexes = AsyncDocumentIndexesClient(client_wrapper=self._client_wrapper)
|
1283
1295
|
self.documents = AsyncDocumentsClient(client_wrapper=self._client_wrapper)
|
1284
1296
|
self.folder_entities = AsyncFolderEntitiesClient(client_wrapper=self._client_wrapper)
|
1285
|
-
self.ml_models = AsyncMlModelsClient(client_wrapper=self._client_wrapper)
|
1286
1297
|
self.sandboxes = AsyncSandboxesClient(client_wrapper=self._client_wrapper)
|
1287
1298
|
self.test_suite_runs = AsyncTestSuiteRunsClient(client_wrapper=self._client_wrapper)
|
1288
1299
|
self.test_suites = AsyncTestSuitesClient(client_wrapper=self._client_wrapper)
|
@@ -1297,7 +1308,7 @@ class AsyncVellum:
|
|
1297
1308
|
prompt_deployment_name: typing.Optional[str] = OMIT,
|
1298
1309
|
release_tag: typing.Optional[str] = OMIT,
|
1299
1310
|
external_id: typing.Optional[str] = OMIT,
|
1300
|
-
expand_meta: typing.Optional[
|
1311
|
+
expand_meta: typing.Optional[PromptDeploymentExpandMetaRequest] = OMIT,
|
1301
1312
|
raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
|
1302
1313
|
expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
|
1303
1314
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
@@ -1323,7 +1334,7 @@ class AsyncVellum:
|
|
1323
1334
|
external_id : typing.Optional[str]
|
1324
1335
|
Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
1325
1336
|
|
1326
|
-
expand_meta : typing.Optional[
|
1337
|
+
expand_meta : typing.Optional[PromptDeploymentExpandMetaRequest]
|
1327
1338
|
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.
|
1328
1339
|
|
1329
1340
|
raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
|
@@ -1447,7 +1458,7 @@ class AsyncVellum:
|
|
1447
1458
|
prompt_deployment_name: typing.Optional[str] = OMIT,
|
1448
1459
|
release_tag: typing.Optional[str] = OMIT,
|
1449
1460
|
external_id: typing.Optional[str] = OMIT,
|
1450
|
-
expand_meta: typing.Optional[
|
1461
|
+
expand_meta: typing.Optional[PromptDeploymentExpandMetaRequest] = OMIT,
|
1451
1462
|
raw_overrides: typing.Optional[RawPromptExecutionOverridesRequest] = OMIT,
|
1452
1463
|
expand_raw: typing.Optional[typing.Sequence[str]] = OMIT,
|
1453
1464
|
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
@@ -1473,7 +1484,7 @@ class AsyncVellum:
|
|
1473
1484
|
external_id : typing.Optional[str]
|
1474
1485
|
Optionally include a unique identifier for tracking purposes. Must be unique within a given Prompt Deployment.
|
1475
1486
|
|
1476
|
-
expand_meta : typing.Optional[
|
1487
|
+
expand_meta : typing.Optional[PromptDeploymentExpandMetaRequest]
|
1477
1488
|
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.
|
1478
1489
|
|
1479
1490
|
raw_overrides : typing.Optional[RawPromptExecutionOverridesRequest]
|
@@ -1499,7 +1510,7 @@ class AsyncVellum:
|
|
1499
1510
|
|
1500
1511
|
from vellum import (
|
1501
1512
|
AsyncVellum,
|
1502
|
-
|
1513
|
+
PromptDeploymentExpandMetaRequest,
|
1503
1514
|
RawPromptExecutionOverridesRequest,
|
1504
1515
|
StringInputRequest,
|
1505
1516
|
)
|
@@ -1521,7 +1532,7 @@ class AsyncVellum:
|
|
1521
1532
|
prompt_deployment_name="string",
|
1522
1533
|
release_tag="string",
|
1523
1534
|
external_id="string",
|
1524
|
-
expand_meta=
|
1535
|
+
expand_meta=PromptDeploymentExpandMetaRequest(
|
1525
1536
|
model_name=True,
|
1526
1537
|
usage=True,
|
1527
1538
|
finish_reason=True,
|
@@ -1632,6 +1643,7 @@ class AsyncVellum:
|
|
1632
1643
|
workflow_deployment_name: typing.Optional[str] = OMIT,
|
1633
1644
|
release_tag: typing.Optional[str] = OMIT,
|
1634
1645
|
external_id: typing.Optional[str] = OMIT,
|
1646
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
1635
1647
|
request_options: typing.Optional[RequestOptions] = None,
|
1636
1648
|
) -> ExecuteWorkflowResponse:
|
1637
1649
|
"""
|
@@ -1657,6 +1669,9 @@ class AsyncVellum:
|
|
1657
1669
|
external_id : typing.Optional[str]
|
1658
1670
|
Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
|
1659
1671
|
|
1672
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
1673
|
+
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.
|
1674
|
+
|
1660
1675
|
request_options : typing.Optional[RequestOptions]
|
1661
1676
|
Request-specific configuration.
|
1662
1677
|
|
@@ -1700,6 +1715,7 @@ class AsyncVellum:
|
|
1700
1715
|
"workflow_deployment_name": workflow_deployment_name,
|
1701
1716
|
"release_tag": release_tag,
|
1702
1717
|
"external_id": external_id,
|
1718
|
+
"metadata": metadata,
|
1703
1719
|
},
|
1704
1720
|
request_options=request_options,
|
1705
1721
|
omit=OMIT,
|
@@ -1758,6 +1774,7 @@ class AsyncVellum:
|
|
1758
1774
|
release_tag: typing.Optional[str] = OMIT,
|
1759
1775
|
external_id: typing.Optional[str] = OMIT,
|
1760
1776
|
event_types: typing.Optional[typing.Sequence[WorkflowExecutionEventType]] = OMIT,
|
1777
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT,
|
1761
1778
|
request_options: typing.Optional[RequestOptions] = None,
|
1762
1779
|
) -> typing.AsyncIterator[WorkflowStreamEvent]:
|
1763
1780
|
"""
|
@@ -1786,6 +1803,9 @@ class AsyncVellum:
|
|
1786
1803
|
event_types : typing.Optional[typing.Sequence[WorkflowExecutionEventType]]
|
1787
1804
|
Optionally specify which events you want to receive. Defaults to only WORKFLOW events. Note that the schema of non-WORKFLOW events is unstable and should be used with caution.
|
1788
1805
|
|
1806
|
+
metadata : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]
|
1807
|
+
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.
|
1808
|
+
|
1789
1809
|
request_options : typing.Optional[RequestOptions]
|
1790
1810
|
Request-specific configuration.
|
1791
1811
|
|
@@ -1825,6 +1845,7 @@ class AsyncVellum:
|
|
1825
1845
|
release_tag="string",
|
1826
1846
|
external_id="string",
|
1827
1847
|
event_types=["NODE"],
|
1848
|
+
metadata={"string": {"key": "value"}},
|
1828
1849
|
)
|
1829
1850
|
async for chunk in response:
|
1830
1851
|
yield chunk
|
@@ -1844,6 +1865,7 @@ class AsyncVellum:
|
|
1844
1865
|
"release_tag": release_tag,
|
1845
1866
|
"external_id": external_id,
|
1846
1867
|
"event_types": event_types,
|
1868
|
+
"metadata": metadata,
|
1847
1869
|
},
|
1848
1870
|
request_options=request_options,
|
1849
1871
|
omit=OMIT,
|
vellum/core/client_wrapper.py
CHANGED
vellum/resources/__init__.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
3
|
from . import (
|
4
|
+
ad_hoc,
|
4
5
|
deployments,
|
5
6
|
document_indexes,
|
6
7
|
documents,
|
7
8
|
folder_entities,
|
8
|
-
ml_models,
|
9
9
|
sandboxes,
|
10
10
|
test_suite_runs,
|
11
11
|
test_suites,
|
@@ -20,11 +20,11 @@ __all__ = [
|
|
20
20
|
"DeploymentsListRequestStatus",
|
21
21
|
"DocumentIndexesListRequestStatus",
|
22
22
|
"WorkflowDeploymentsListRequestStatus",
|
23
|
+
"ad_hoc",
|
23
24
|
"deployments",
|
24
25
|
"document_indexes",
|
25
26
|
"documents",
|
26
27
|
"folder_entities",
|
27
|
-
"ml_models",
|
28
28
|
"sandboxes",
|
29
29
|
"test_suite_runs",
|
30
30
|
"test_suites",
|
@@ -0,0 +1,372 @@
|
|
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.prompt_request_input_request import PromptRequestInputRequest
|
6
|
+
from ...types.vellum_variable_request import VellumVariableRequest
|
7
|
+
from ...types.prompt_parameters_request import PromptParametersRequest
|
8
|
+
from ...types.prompt_block_request import PromptBlockRequest
|
9
|
+
from ...types.ad_hoc_expand_meta_request import AdHocExpandMetaRequest
|
10
|
+
from ...core.request_options import RequestOptions
|
11
|
+
from ...types.ad_hoc_execute_prompt_event import AdHocExecutePromptEvent
|
12
|
+
from ...core.pydantic_utilities import parse_obj_as
|
13
|
+
import json
|
14
|
+
from ...errors.bad_request_error import BadRequestError
|
15
|
+
from ...errors.forbidden_error import ForbiddenError
|
16
|
+
from ...errors.internal_server_error import InternalServerError
|
17
|
+
from json.decoder import JSONDecodeError
|
18
|
+
from ...core.api_error import ApiError
|
19
|
+
from ...core.client_wrapper import AsyncClientWrapper
|
20
|
+
|
21
|
+
# this is used as the default value for optional parameters
|
22
|
+
OMIT = typing.cast(typing.Any, ...)
|
23
|
+
|
24
|
+
|
25
|
+
class AdHocClient:
|
26
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
27
|
+
self._client_wrapper = client_wrapper
|
28
|
+
|
29
|
+
def adhoc_execute_prompt_stream(
|
30
|
+
self,
|
31
|
+
*,
|
32
|
+
ml_model: str,
|
33
|
+
input_values: typing.Sequence[PromptRequestInputRequest],
|
34
|
+
input_variables: typing.Sequence[VellumVariableRequest],
|
35
|
+
parameters: PromptParametersRequest,
|
36
|
+
blocks: typing.Sequence[PromptBlockRequest],
|
37
|
+
expand_meta: typing.Optional[AdHocExpandMetaRequest] = OMIT,
|
38
|
+
request_options: typing.Optional[RequestOptions] = None,
|
39
|
+
) -> typing.Iterator[AdHocExecutePromptEvent]:
|
40
|
+
"""
|
41
|
+
An internal-only endpoint that's subject to breaking changes without notice. Not intended for public use.
|
42
|
+
|
43
|
+
Parameters
|
44
|
+
----------
|
45
|
+
ml_model : str
|
46
|
+
|
47
|
+
input_values : typing.Sequence[PromptRequestInputRequest]
|
48
|
+
|
49
|
+
input_variables : typing.Sequence[VellumVariableRequest]
|
50
|
+
|
51
|
+
parameters : PromptParametersRequest
|
52
|
+
|
53
|
+
blocks : typing.Sequence[PromptBlockRequest]
|
54
|
+
|
55
|
+
expand_meta : typing.Optional[AdHocExpandMetaRequest]
|
56
|
+
|
57
|
+
request_options : typing.Optional[RequestOptions]
|
58
|
+
Request-specific configuration.
|
59
|
+
|
60
|
+
Yields
|
61
|
+
------
|
62
|
+
typing.Iterator[AdHocExecutePromptEvent]
|
63
|
+
|
64
|
+
|
65
|
+
Examples
|
66
|
+
--------
|
67
|
+
from vellum import (
|
68
|
+
AdHocExpandMetaRequest,
|
69
|
+
EphemeralPromptCacheConfigRequest,
|
70
|
+
JinjaPromptBlockPropertiesRequest,
|
71
|
+
JinjaPromptBlockRequest,
|
72
|
+
PromptParametersRequest,
|
73
|
+
PromptRequestStringInputRequest,
|
74
|
+
Vellum,
|
75
|
+
VellumVariableRequest,
|
76
|
+
)
|
77
|
+
|
78
|
+
client = Vellum(
|
79
|
+
api_key="YOUR_API_KEY",
|
80
|
+
)
|
81
|
+
response = client.ad_hoc.adhoc_execute_prompt_stream(
|
82
|
+
ml_model="string",
|
83
|
+
input_values=[
|
84
|
+
PromptRequestStringInputRequest(
|
85
|
+
key="string",
|
86
|
+
value="string",
|
87
|
+
)
|
88
|
+
],
|
89
|
+
input_variables=[
|
90
|
+
VellumVariableRequest(
|
91
|
+
id="string",
|
92
|
+
key="string",
|
93
|
+
type="STRING",
|
94
|
+
)
|
95
|
+
],
|
96
|
+
parameters=PromptParametersRequest(
|
97
|
+
stop=["string"],
|
98
|
+
temperature=1.1,
|
99
|
+
max_tokens=1,
|
100
|
+
top_p=1.1,
|
101
|
+
top_k=1,
|
102
|
+
frequency_penalty=1.1,
|
103
|
+
presence_penalty=1.1,
|
104
|
+
logit_bias={"string": {"key": "value"}},
|
105
|
+
custom_parameters={"string": {"key": "value"}},
|
106
|
+
),
|
107
|
+
blocks=[
|
108
|
+
JinjaPromptBlockRequest(
|
109
|
+
properties=JinjaPromptBlockPropertiesRequest(
|
110
|
+
template="string",
|
111
|
+
template_type="STRING",
|
112
|
+
),
|
113
|
+
id="string",
|
114
|
+
state="ENABLED",
|
115
|
+
cache_config=EphemeralPromptCacheConfigRequest(),
|
116
|
+
)
|
117
|
+
],
|
118
|
+
expand_meta=AdHocExpandMetaRequest(
|
119
|
+
cost=True,
|
120
|
+
model_name=True,
|
121
|
+
usage=True,
|
122
|
+
finish_reason=True,
|
123
|
+
),
|
124
|
+
)
|
125
|
+
for chunk in response:
|
126
|
+
yield chunk
|
127
|
+
"""
|
128
|
+
with self._client_wrapper.httpx_client.stream(
|
129
|
+
"v1/ad-hoc/execute-prompt-stream",
|
130
|
+
base_url=self._client_wrapper.get_environment().default,
|
131
|
+
method="POST",
|
132
|
+
json={
|
133
|
+
"ml_model": ml_model,
|
134
|
+
"input_values": input_values,
|
135
|
+
"input_variables": input_variables,
|
136
|
+
"parameters": parameters,
|
137
|
+
"blocks": blocks,
|
138
|
+
"expand_meta": expand_meta,
|
139
|
+
},
|
140
|
+
request_options=request_options,
|
141
|
+
omit=OMIT,
|
142
|
+
) as _response:
|
143
|
+
try:
|
144
|
+
if 200 <= _response.status_code < 300:
|
145
|
+
for _text in _response.iter_lines():
|
146
|
+
try:
|
147
|
+
if len(_text) == 0:
|
148
|
+
continue
|
149
|
+
yield typing.cast(
|
150
|
+
AdHocExecutePromptEvent,
|
151
|
+
parse_obj_as(
|
152
|
+
type_=AdHocExecutePromptEvent, # type: ignore
|
153
|
+
object_=json.loads(_text),
|
154
|
+
),
|
155
|
+
)
|
156
|
+
except:
|
157
|
+
pass
|
158
|
+
return
|
159
|
+
_response.read()
|
160
|
+
if _response.status_code == 400:
|
161
|
+
raise BadRequestError(
|
162
|
+
typing.cast(
|
163
|
+
typing.Optional[typing.Any],
|
164
|
+
parse_obj_as(
|
165
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
166
|
+
object_=_response.json(),
|
167
|
+
),
|
168
|
+
)
|
169
|
+
)
|
170
|
+
if _response.status_code == 403:
|
171
|
+
raise ForbiddenError(
|
172
|
+
typing.cast(
|
173
|
+
typing.Optional[typing.Any],
|
174
|
+
parse_obj_as(
|
175
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
176
|
+
object_=_response.json(),
|
177
|
+
),
|
178
|
+
)
|
179
|
+
)
|
180
|
+
if _response.status_code == 500:
|
181
|
+
raise InternalServerError(
|
182
|
+
typing.cast(
|
183
|
+
typing.Optional[typing.Any],
|
184
|
+
parse_obj_as(
|
185
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
186
|
+
object_=_response.json(),
|
187
|
+
),
|
188
|
+
)
|
189
|
+
)
|
190
|
+
_response_json = _response.json()
|
191
|
+
except JSONDecodeError:
|
192
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
193
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
194
|
+
|
195
|
+
|
196
|
+
class AsyncAdHocClient:
|
197
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
198
|
+
self._client_wrapper = client_wrapper
|
199
|
+
|
200
|
+
async def adhoc_execute_prompt_stream(
|
201
|
+
self,
|
202
|
+
*,
|
203
|
+
ml_model: str,
|
204
|
+
input_values: typing.Sequence[PromptRequestInputRequest],
|
205
|
+
input_variables: typing.Sequence[VellumVariableRequest],
|
206
|
+
parameters: PromptParametersRequest,
|
207
|
+
blocks: typing.Sequence[PromptBlockRequest],
|
208
|
+
expand_meta: typing.Optional[AdHocExpandMetaRequest] = OMIT,
|
209
|
+
request_options: typing.Optional[RequestOptions] = None,
|
210
|
+
) -> typing.AsyncIterator[AdHocExecutePromptEvent]:
|
211
|
+
"""
|
212
|
+
An internal-only endpoint that's subject to breaking changes without notice. Not intended for public use.
|
213
|
+
|
214
|
+
Parameters
|
215
|
+
----------
|
216
|
+
ml_model : str
|
217
|
+
|
218
|
+
input_values : typing.Sequence[PromptRequestInputRequest]
|
219
|
+
|
220
|
+
input_variables : typing.Sequence[VellumVariableRequest]
|
221
|
+
|
222
|
+
parameters : PromptParametersRequest
|
223
|
+
|
224
|
+
blocks : typing.Sequence[PromptBlockRequest]
|
225
|
+
|
226
|
+
expand_meta : typing.Optional[AdHocExpandMetaRequest]
|
227
|
+
|
228
|
+
request_options : typing.Optional[RequestOptions]
|
229
|
+
Request-specific configuration.
|
230
|
+
|
231
|
+
Yields
|
232
|
+
------
|
233
|
+
typing.AsyncIterator[AdHocExecutePromptEvent]
|
234
|
+
|
235
|
+
|
236
|
+
Examples
|
237
|
+
--------
|
238
|
+
import asyncio
|
239
|
+
|
240
|
+
from vellum import (
|
241
|
+
AdHocExpandMetaRequest,
|
242
|
+
AsyncVellum,
|
243
|
+
EphemeralPromptCacheConfigRequest,
|
244
|
+
JinjaPromptBlockPropertiesRequest,
|
245
|
+
JinjaPromptBlockRequest,
|
246
|
+
PromptParametersRequest,
|
247
|
+
PromptRequestStringInputRequest,
|
248
|
+
VellumVariableRequest,
|
249
|
+
)
|
250
|
+
|
251
|
+
client = AsyncVellum(
|
252
|
+
api_key="YOUR_API_KEY",
|
253
|
+
)
|
254
|
+
|
255
|
+
|
256
|
+
async def main() -> None:
|
257
|
+
response = await client.ad_hoc.adhoc_execute_prompt_stream(
|
258
|
+
ml_model="string",
|
259
|
+
input_values=[
|
260
|
+
PromptRequestStringInputRequest(
|
261
|
+
key="string",
|
262
|
+
value="string",
|
263
|
+
)
|
264
|
+
],
|
265
|
+
input_variables=[
|
266
|
+
VellumVariableRequest(
|
267
|
+
id="string",
|
268
|
+
key="string",
|
269
|
+
type="STRING",
|
270
|
+
)
|
271
|
+
],
|
272
|
+
parameters=PromptParametersRequest(
|
273
|
+
stop=["string"],
|
274
|
+
temperature=1.1,
|
275
|
+
max_tokens=1,
|
276
|
+
top_p=1.1,
|
277
|
+
top_k=1,
|
278
|
+
frequency_penalty=1.1,
|
279
|
+
presence_penalty=1.1,
|
280
|
+
logit_bias={"string": {"key": "value"}},
|
281
|
+
custom_parameters={"string": {"key": "value"}},
|
282
|
+
),
|
283
|
+
blocks=[
|
284
|
+
JinjaPromptBlockRequest(
|
285
|
+
properties=JinjaPromptBlockPropertiesRequest(
|
286
|
+
template="string",
|
287
|
+
template_type="STRING",
|
288
|
+
),
|
289
|
+
id="string",
|
290
|
+
state="ENABLED",
|
291
|
+
cache_config=EphemeralPromptCacheConfigRequest(),
|
292
|
+
)
|
293
|
+
],
|
294
|
+
expand_meta=AdHocExpandMetaRequest(
|
295
|
+
cost=True,
|
296
|
+
model_name=True,
|
297
|
+
usage=True,
|
298
|
+
finish_reason=True,
|
299
|
+
),
|
300
|
+
)
|
301
|
+
async for chunk in response:
|
302
|
+
yield chunk
|
303
|
+
|
304
|
+
|
305
|
+
asyncio.run(main())
|
306
|
+
"""
|
307
|
+
async with self._client_wrapper.httpx_client.stream(
|
308
|
+
"v1/ad-hoc/execute-prompt-stream",
|
309
|
+
base_url=self._client_wrapper.get_environment().default,
|
310
|
+
method="POST",
|
311
|
+
json={
|
312
|
+
"ml_model": ml_model,
|
313
|
+
"input_values": input_values,
|
314
|
+
"input_variables": input_variables,
|
315
|
+
"parameters": parameters,
|
316
|
+
"blocks": blocks,
|
317
|
+
"expand_meta": expand_meta,
|
318
|
+
},
|
319
|
+
request_options=request_options,
|
320
|
+
omit=OMIT,
|
321
|
+
) as _response:
|
322
|
+
try:
|
323
|
+
if 200 <= _response.status_code < 300:
|
324
|
+
async for _text in _response.aiter_lines():
|
325
|
+
try:
|
326
|
+
if len(_text) == 0:
|
327
|
+
continue
|
328
|
+
yield typing.cast(
|
329
|
+
AdHocExecutePromptEvent,
|
330
|
+
parse_obj_as(
|
331
|
+
type_=AdHocExecutePromptEvent, # type: ignore
|
332
|
+
object_=json.loads(_text),
|
333
|
+
),
|
334
|
+
)
|
335
|
+
except:
|
336
|
+
pass
|
337
|
+
return
|
338
|
+
await _response.aread()
|
339
|
+
if _response.status_code == 400:
|
340
|
+
raise BadRequestError(
|
341
|
+
typing.cast(
|
342
|
+
typing.Optional[typing.Any],
|
343
|
+
parse_obj_as(
|
344
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
345
|
+
object_=_response.json(),
|
346
|
+
),
|
347
|
+
)
|
348
|
+
)
|
349
|
+
if _response.status_code == 403:
|
350
|
+
raise ForbiddenError(
|
351
|
+
typing.cast(
|
352
|
+
typing.Optional[typing.Any],
|
353
|
+
parse_obj_as(
|
354
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
355
|
+
object_=_response.json(),
|
356
|
+
),
|
357
|
+
)
|
358
|
+
)
|
359
|
+
if _response.status_code == 500:
|
360
|
+
raise InternalServerError(
|
361
|
+
typing.cast(
|
362
|
+
typing.Optional[typing.Any],
|
363
|
+
parse_obj_as(
|
364
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
365
|
+
object_=_response.json(),
|
366
|
+
),
|
367
|
+
)
|
368
|
+
)
|
369
|
+
_response_json = _response.json()
|
370
|
+
except JSONDecodeError:
|
371
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
372
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|