vellum-ai 0.3.14__py3-none-any.whl → 0.3.15__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +22 -0
- vellum/client.py +846 -100
- vellum/core/__init__.py +8 -0
- vellum/core/client_wrapper.py +27 -8
- vellum/core/file.py +38 -0
- vellum/core/http_client.py +130 -0
- vellum/core/jsonable_encoder.py +2 -2
- vellum/core/request_options.py +32 -0
- vellum/resources/deployments/client.py +161 -24
- vellum/resources/document_indexes/client.py +337 -80
- vellum/resources/documents/client.py +278 -58
- vellum/resources/folder_entities/client.py +60 -10
- vellum/resources/model_versions/client.py +48 -8
- vellum/resources/registered_prompts/client.py +52 -6
- vellum/resources/sandboxes/client.py +108 -26
- vellum/resources/test_suite_runs/client.py +221 -38
- vellum/resources/test_suites/client.py +110 -24
- vellum/resources/workflow_deployments/client.py +110 -14
- vellum/types/__init__.py +20 -0
- vellum/types/api_node_result.py +1 -0
- vellum/types/api_node_result_data.py +4 -2
- vellum/types/array_chat_message_content.py +1 -0
- vellum/types/array_chat_message_content_item.py +6 -5
- vellum/types/array_chat_message_content_item_request.py +6 -5
- vellum/types/array_chat_message_content_request.py +1 -0
- vellum/types/array_enum.py +2 -2
- vellum/types/array_variable_value_item.py +16 -10
- vellum/types/chat_history_enum.py +2 -2
- vellum/types/chat_history_input_request.py +6 -1
- vellum/types/chat_history_variable_value.py +2 -1
- vellum/types/chat_message.py +7 -5
- vellum/types/chat_message_content.py +8 -6
- vellum/types/chat_message_content_request.py +8 -6
- vellum/types/chat_message_request.py +7 -5
- vellum/types/code_execution_node_array_result.py +31 -0
- vellum/types/code_execution_node_chat_history_result.py +2 -1
- vellum/types/code_execution_node_error_result.py +2 -1
- vellum/types/code_execution_node_function_call_result.py +31 -0
- vellum/types/code_execution_node_json_result.py +2 -1
- vellum/types/code_execution_node_number_result.py +2 -1
- vellum/types/code_execution_node_result.py +1 -0
- vellum/types/code_execution_node_result_data.py +2 -1
- vellum/types/code_execution_node_result_output.py +36 -8
- vellum/types/code_execution_node_search_results_result.py +2 -1
- vellum/types/code_execution_node_string_result.py +2 -1
- vellum/types/conditional_node_result.py +1 -0
- vellum/types/conditional_node_result_data.py +2 -1
- vellum/types/deployment_provider_payload_response.py +1 -0
- vellum/types/deployment_read.py +32 -17
- vellum/types/document_document_to_document_index.py +21 -15
- vellum/types/document_index_read.py +32 -19
- vellum/types/document_read.py +34 -24
- vellum/types/document_status.py +2 -2
- vellum/types/enriched_normalized_completion.py +36 -19
- vellum/types/error_enum.py +2 -2
- vellum/types/error_variable_value.py +2 -1
- vellum/types/execute_prompt_api_error_response.py +5 -1
- vellum/types/execute_prompt_event.py +8 -6
- vellum/types/execute_prompt_response.py +4 -4
- vellum/types/execute_workflow_error_response.py +5 -1
- vellum/types/execute_workflow_response.py +3 -2
- vellum/types/execute_workflow_stream_error_response.py +5 -1
- vellum/types/execute_workflow_workflow_result_event.py +4 -4
- vellum/types/execution_array_vellum_value.py +7 -2
- vellum/types/execution_chat_history_vellum_value.py +7 -2
- vellum/types/execution_error_vellum_value.py +7 -2
- vellum/types/execution_function_call_vellum_value.py +7 -2
- vellum/types/execution_json_vellum_value.py +7 -2
- vellum/types/execution_number_vellum_value.py +7 -2
- vellum/types/execution_search_results_vellum_value.py +7 -2
- vellum/types/execution_string_vellum_value.py +7 -2
- vellum/types/execution_vellum_value.py +16 -10
- vellum/types/fulfilled_enum.py +2 -2
- vellum/types/fulfilled_execute_prompt_event.py +2 -1
- vellum/types/fulfilled_execute_prompt_response.py +12 -5
- vellum/types/fulfilled_execute_workflow_workflow_result_event.py +1 -0
- vellum/types/fulfilled_function_call.py +2 -1
- vellum/types/fulfilled_prompt_execution_meta.py +3 -2
- vellum/types/fulfilled_workflow_node_result_event.py +6 -5
- vellum/types/function_call.py +4 -4
- vellum/types/function_call_chat_message_content.py +1 -0
- vellum/types/function_call_chat_message_content_request.py +1 -0
- vellum/types/function_call_chat_message_content_value.py +2 -1
- vellum/types/function_call_chat_message_content_value_request.py +2 -1
- vellum/types/function_call_enum.py +2 -2
- vellum/types/function_call_variable_value.py +1 -0
- vellum/types/generate_error_response.py +5 -1
- vellum/types/generate_options_request.py +8 -5
- vellum/types/generate_request.py +15 -9
- vellum/types/generate_result.py +10 -6
- vellum/types/generate_result_data.py +5 -3
- vellum/types/generate_result_error.py +5 -1
- vellum/types/generate_stream_response.py +1 -0
- vellum/types/generate_stream_result.py +3 -2
- vellum/types/generate_stream_result_data.py +1 -0
- vellum/types/image_chat_message_content.py +1 -0
- vellum/types/image_chat_message_content_request.py +1 -0
- vellum/types/image_enum.py +2 -2
- vellum/types/image_variable_value.py +2 -1
- vellum/types/initiated_enum.py +2 -2
- vellum/types/initiated_execute_prompt_event.py +2 -1
- vellum/types/initiated_prompt_execution_meta.py +5 -4
- vellum/types/initiated_workflow_node_result_event.py +5 -4
- vellum/types/json_enum.py +2 -2
- vellum/types/json_input_request.py +6 -1
- vellum/types/json_variable_value.py +2 -1
- vellum/types/logprobs_enum.py +2 -2
- vellum/types/metadata_filter_config_request.py +7 -6
- vellum/types/metadata_filter_rule_request.py +7 -6
- vellum/types/model_version_build_config.py +12 -7
- vellum/types/model_version_exec_config.py +18 -11
- vellum/types/model_version_exec_config_parameters.py +7 -6
- vellum/types/model_version_read.py +51 -32
- vellum/types/model_version_sandbox_snapshot.py +17 -4
- vellum/types/named_test_case_chat_history_variable_value_request.py +2 -1
- vellum/types/named_test_case_error_variable_value_request.py +2 -1
- vellum/types/named_test_case_json_variable_value_request.py +2 -1
- vellum/types/named_test_case_number_variable_value_request.py +2 -1
- vellum/types/named_test_case_search_results_variable_value_request.py +2 -1
- vellum/types/named_test_case_string_variable_value_request.py +2 -1
- vellum/types/named_test_case_variable_value_request.py +12 -8
- vellum/types/node_input_compiled_array_value.py +2 -1
- vellum/types/node_input_compiled_chat_history_value.py +2 -1
- vellum/types/node_input_compiled_error_value.py +2 -1
- vellum/types/node_input_compiled_function_call.py +32 -0
- vellum/types/node_input_compiled_json_value.py +2 -1
- vellum/types/node_input_compiled_number_value.py +2 -1
- vellum/types/node_input_compiled_search_results_value.py +2 -1
- vellum/types/node_input_compiled_string_value.py +2 -1
- vellum/types/node_input_variable_compiled_value.py +26 -9
- vellum/types/node_output_compiled_array_value.py +2 -1
- vellum/types/node_output_compiled_chat_history_value.py +2 -1
- vellum/types/node_output_compiled_error_value.py +2 -1
- vellum/types/node_output_compiled_function_value.py +2 -1
- vellum/types/node_output_compiled_json_value.py +2 -1
- vellum/types/node_output_compiled_number_value.py +2 -1
- vellum/types/node_output_compiled_search_results_value.py +2 -1
- vellum/types/node_output_compiled_string_value.py +2 -1
- vellum/types/node_output_compiled_value.py +16 -10
- vellum/types/normalized_log_probs.py +2 -1
- vellum/types/normalized_token_log_probs.py +3 -2
- vellum/types/number_enum.py +2 -2
- vellum/types/number_variable_value.py +2 -1
- vellum/types/paginated_document_index_read_list.py +5 -4
- vellum/types/paginated_slim_deployment_read_list.py +5 -4
- vellum/types/paginated_slim_document_list.py +5 -4
- vellum/types/paginated_slim_workflow_deployment_list.py +5 -4
- vellum/types/paginated_test_suite_run_execution_list.py +5 -4
- vellum/types/prompt_deployment_expand_meta_request_request.py +25 -15
- vellum/types/prompt_deployment_input_request.py +6 -5
- vellum/types/prompt_execution_meta.py +6 -5
- vellum/types/prompt_node_result.py +1 -0
- vellum/types/prompt_node_result_data.py +4 -3
- vellum/types/prompt_output.py +8 -6
- vellum/types/prompt_template_block.py +1 -0
- vellum/types/prompt_template_block_data.py +1 -0
- vellum/types/prompt_template_block_data_request.py +1 -0
- vellum/types/prompt_template_block_properties.py +11 -10
- vellum/types/prompt_template_block_properties_request.py +11 -10
- vellum/types/prompt_template_block_request.py +1 -0
- vellum/types/raw_prompt_execution_overrides_request.py +11 -5
- vellum/types/register_prompt_error_response.py +5 -1
- vellum/types/register_prompt_model_parameters_request.py +5 -4
- vellum/types/register_prompt_prompt.py +10 -2
- vellum/types/register_prompt_prompt_info_request.py +5 -3
- vellum/types/register_prompt_response.py +30 -10
- vellum/types/registered_prompt_deployment.py +15 -3
- vellum/types/registered_prompt_input_variable_request.py +3 -2
- vellum/types/registered_prompt_model_version.py +10 -2
- vellum/types/registered_prompt_sandbox.py +10 -2
- vellum/types/registered_prompt_sandbox_snapshot.py +5 -1
- vellum/types/rejected_enum.py +2 -2
- vellum/types/rejected_execute_prompt_event.py +2 -1
- vellum/types/rejected_execute_prompt_response.py +12 -5
- vellum/types/rejected_execute_workflow_workflow_result_event.py +1 -0
- vellum/types/rejected_function_call.py +2 -1
- vellum/types/rejected_prompt_execution_meta.py +3 -2
- vellum/types/rejected_workflow_node_result_event.py +4 -3
- vellum/types/sandbox_scenario.py +11 -3
- vellum/types/scenario_input.py +4 -3
- vellum/types/scenario_input_request.py +4 -3
- vellum/types/search_error_response.py +5 -1
- vellum/types/search_filters_request.py +10 -6
- vellum/types/search_node_result.py +1 -0
- vellum/types/search_node_result_data.py +7 -4
- vellum/types/search_request_options_request.py +20 -8
- vellum/types/search_response.py +5 -3
- vellum/types/search_result.py +15 -5
- vellum/types/search_result_document.py +20 -8
- vellum/types/search_result_document_request.py +15 -7
- vellum/types/search_result_merging_request.py +5 -1
- vellum/types/search_result_request.py +15 -5
- vellum/types/search_results_enum.py +2 -2
- vellum/types/search_results_variable_value.py +2 -1
- vellum/types/search_weights_request.py +10 -4
- vellum/types/slim_deployment_read.py +28 -14
- vellum/types/slim_document.py +56 -35
- vellum/types/slim_workflow_deployment.py +37 -24
- vellum/types/streaming_enum.py +2 -2
- vellum/types/streaming_execute_prompt_event.py +6 -4
- vellum/types/streaming_prompt_execution_meta.py +2 -1
- vellum/types/streaming_workflow_node_result_event.py +6 -5
- vellum/types/string_chat_message_content.py +1 -0
- vellum/types/string_chat_message_content_request.py +1 -0
- vellum/types/string_enum.py +2 -2
- vellum/types/string_input_request.py +6 -1
- vellum/types/string_variable_value.py +2 -1
- vellum/types/submit_completion_actual_request.py +25 -13
- vellum/types/submit_completion_actuals_error_response.py +1 -0
- vellum/types/submit_workflow_execution_actual_request.py +6 -5
- vellum/types/subworkflow_enum.py +2 -2
- vellum/types/subworkflow_node_result.py +1 -0
- vellum/types/templating_node_array_result.py +31 -0
- vellum/types/templating_node_chat_history_result.py +2 -1
- vellum/types/templating_node_error_result.py +2 -1
- vellum/types/templating_node_function_call_result.py +31 -0
- vellum/types/templating_node_json_result.py +2 -1
- vellum/types/templating_node_number_result.py +2 -1
- vellum/types/templating_node_result.py +1 -0
- vellum/types/templating_node_result_data.py +1 -0
- vellum/types/templating_node_result_output.py +36 -8
- vellum/types/templating_node_search_results_result.py +2 -1
- vellum/types/templating_node_string_result.py +2 -1
- vellum/types/terminal_node_array_result.py +8 -3
- vellum/types/terminal_node_chat_history_result.py +8 -3
- vellum/types/terminal_node_error_result.py +8 -3
- vellum/types/terminal_node_function_call_result.py +8 -3
- vellum/types/terminal_node_json_result.py +8 -3
- vellum/types/terminal_node_number_result.py +8 -3
- vellum/types/terminal_node_result.py +1 -0
- vellum/types/terminal_node_result_data.py +1 -0
- vellum/types/terminal_node_result_output.py +16 -10
- vellum/types/terminal_node_search_results_result.py +8 -3
- vellum/types/terminal_node_string_result.py +8 -3
- vellum/types/test_case_chat_history_variable_value.py +2 -1
- vellum/types/test_case_error_variable_value.py +2 -1
- vellum/types/test_case_json_variable_value.py +2 -1
- vellum/types/test_case_number_variable_value.py +2 -1
- vellum/types/test_case_search_results_variable_value.py +2 -1
- vellum/types/test_case_string_variable_value.py +2 -1
- vellum/types/test_case_variable_value.py +12 -8
- vellum/types/test_suite_run_deployment_release_tag_exec_config.py +5 -3
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data.py +10 -4
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +10 -4
- vellum/types/test_suite_run_deployment_release_tag_exec_config_request.py +5 -3
- vellum/types/test_suite_run_deployment_release_tag_exec_config_type_enum.py +2 -2
- vellum/types/test_suite_run_exec_config.py +4 -4
- vellum/types/test_suite_run_exec_config_request.py +4 -4
- vellum/types/test_suite_run_execution.py +1 -0
- vellum/types/test_suite_run_execution_chat_history_output.py +2 -1
- vellum/types/test_suite_run_execution_error_output.py +2 -1
- vellum/types/test_suite_run_execution_json_output.py +2 -1
- vellum/types/test_suite_run_execution_metric_result.py +1 -0
- vellum/types/test_suite_run_execution_number_output.py +2 -1
- vellum/types/test_suite_run_execution_output.py +12 -8
- vellum/types/test_suite_run_execution_search_results_output.py +2 -1
- vellum/types/test_suite_run_execution_string_output.py +2 -1
- vellum/types/test_suite_run_metric_error_output.py +1 -0
- vellum/types/test_suite_run_metric_error_output_type_enum.py +2 -2
- vellum/types/test_suite_run_metric_number_output.py +1 -0
- vellum/types/test_suite_run_metric_number_output_type_enum.py +2 -2
- vellum/types/test_suite_run_metric_output.py +4 -4
- vellum/types/test_suite_run_read.py +16 -14
- vellum/types/test_suite_run_test_suite.py +1 -0
- vellum/types/test_suite_run_workflow_release_tag_exec_config.py +5 -3
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data.py +10 -6
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +10 -6
- vellum/types/test_suite_run_workflow_release_tag_exec_config_request.py +5 -3
- vellum/types/test_suite_run_workflow_release_tag_exec_config_type_enum.py +2 -2
- vellum/types/test_suite_test_case.py +3 -2
- vellum/types/upload_document_error_response.py +1 -0
- vellum/types/upload_document_response.py +5 -1
- vellum/types/vellum_error.py +1 -0
- vellum/types/vellum_error_request.py +1 -0
- vellum/types/vellum_image.py +2 -1
- vellum/types/vellum_image_request.py +2 -1
- vellum/types/vellum_variable.py +1 -0
- vellum/types/workflow_deployment_read.py +37 -24
- vellum/types/workflow_event_error.py +1 -0
- vellum/types/workflow_execution_actual_chat_history_request.py +25 -15
- vellum/types/workflow_execution_actual_json_request.py +25 -15
- vellum/types/workflow_execution_actual_string_request.py +25 -15
- vellum/types/workflow_execution_node_result_event.py +3 -2
- vellum/types/workflow_execution_workflow_result_event.py +3 -2
- vellum/types/workflow_node_result_data.py +16 -10
- vellum/types/workflow_node_result_event.py +8 -6
- vellum/types/workflow_output.py +18 -11
- vellum/types/workflow_output_array.py +7 -2
- vellum/types/workflow_output_chat_history.py +7 -2
- vellum/types/workflow_output_error.py +7 -2
- vellum/types/workflow_output_function_call.py +7 -2
- vellum/types/workflow_output_image.py +7 -2
- vellum/types/workflow_output_json.py +7 -2
- vellum/types/workflow_output_number.py +7 -2
- vellum/types/workflow_output_search_results.py +7 -2
- vellum/types/workflow_output_string.py +7 -2
- vellum/types/workflow_request_chat_history_input_request.py +6 -1
- vellum/types/workflow_request_input_request.py +8 -6
- vellum/types/workflow_request_json_input_request.py +6 -1
- vellum/types/workflow_request_number_input_request.py +6 -1
- vellum/types/workflow_request_string_input_request.py +6 -1
- vellum/types/workflow_result_event.py +5 -4
- vellum/types/workflow_result_event_output_data.py +16 -10
- vellum/types/workflow_result_event_output_data_array.py +8 -5
- vellum/types/workflow_result_event_output_data_chat_history.py +8 -5
- vellum/types/workflow_result_event_output_data_error.py +8 -5
- vellum/types/workflow_result_event_output_data_function_call.py +8 -5
- vellum/types/workflow_result_event_output_data_json.py +8 -5
- vellum/types/workflow_result_event_output_data_number.py +8 -5
- vellum/types/workflow_result_event_output_data_search_results.py +8 -5
- vellum/types/workflow_result_event_output_data_string.py +11 -7
- vellum/types/workflow_stream_event.py +4 -4
- vellum/version.py +4 -0
- {vellum_ai-0.3.14.dist-info → vellum_ai-0.3.15.dist-info}/METADATA +4 -4
- vellum_ai-0.3.15.dist-info/RECORD +365 -0
- vellum_ai-0.3.14.dist-info/RECORD +0 -356
- {vellum_ai-0.3.14.dist-info → vellum_ai-0.3.15.dist-info}/LICENSE +0 -0
- {vellum_ai-0.3.14.dist-info → vellum_ai-0.3.15.dist-info}/WHEEL +0 -0
vellum/core/__init__.py
CHANGED
@@ -3,14 +3,22 @@
|
|
3
3
|
from .api_error import ApiError
|
4
4
|
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
|
5
5
|
from .datetime_utils import serialize_datetime
|
6
|
+
from .file import File, convert_file_dict_to_httpx_tuples
|
7
|
+
from .http_client import AsyncHttpClient, HttpClient
|
6
8
|
from .jsonable_encoder import jsonable_encoder
|
7
9
|
from .remove_none_from_dict import remove_none_from_dict
|
10
|
+
from .request_options import RequestOptions
|
8
11
|
|
9
12
|
__all__ = [
|
10
13
|
"ApiError",
|
11
14
|
"AsyncClientWrapper",
|
15
|
+
"AsyncHttpClient",
|
12
16
|
"BaseClientWrapper",
|
17
|
+
"File",
|
18
|
+
"HttpClient",
|
19
|
+
"RequestOptions",
|
13
20
|
"SyncClientWrapper",
|
21
|
+
"convert_file_dict_to_httpx_tuples",
|
14
22
|
"jsonable_encoder",
|
15
23
|
"remove_none_from_dict",
|
16
24
|
"serialize_datetime",
|
vellum/core/client_wrapper.py
CHANGED
@@ -5,18 +5,20 @@ import typing
|
|
5
5
|
import httpx
|
6
6
|
|
7
7
|
from ..environment import VellumEnvironment
|
8
|
+
from .http_client import AsyncHttpClient, HttpClient
|
8
9
|
|
9
10
|
|
10
11
|
class BaseClientWrapper:
|
11
|
-
def __init__(self, *, api_key: str, environment: VellumEnvironment):
|
12
|
+
def __init__(self, *, api_key: str, environment: VellumEnvironment, timeout: typing.Optional[float] = None):
|
12
13
|
self.api_key = api_key
|
13
14
|
self._environment = environment
|
15
|
+
self._timeout = timeout
|
14
16
|
|
15
17
|
def get_headers(self) -> typing.Dict[str, str]:
|
16
18
|
headers: typing.Dict[str, str] = {
|
17
19
|
"X-Fern-Language": "Python",
|
18
20
|
"X-Fern-SDK-Name": "vellum-ai",
|
19
|
-
"X-Fern-SDK-Version": "0.3.
|
21
|
+
"X-Fern-SDK-Version": "0.3.15",
|
20
22
|
}
|
21
23
|
headers["X_API_KEY"] = self.api_key
|
22
24
|
return headers
|
@@ -24,14 +26,31 @@ class BaseClientWrapper:
|
|
24
26
|
def get_environment(self) -> VellumEnvironment:
|
25
27
|
return self._environment
|
26
28
|
|
29
|
+
def get_timeout(self) -> typing.Optional[float]:
|
30
|
+
return self._timeout
|
31
|
+
|
27
32
|
|
28
33
|
class SyncClientWrapper(BaseClientWrapper):
|
29
|
-
def __init__(
|
30
|
-
|
31
|
-
|
34
|
+
def __init__(
|
35
|
+
self,
|
36
|
+
*,
|
37
|
+
api_key: str,
|
38
|
+
environment: VellumEnvironment,
|
39
|
+
timeout: typing.Optional[float] = None,
|
40
|
+
httpx_client: httpx.Client
|
41
|
+
):
|
42
|
+
super().__init__(api_key=api_key, environment=environment, timeout=timeout)
|
43
|
+
self.httpx_client = HttpClient(httpx_client=httpx_client)
|
32
44
|
|
33
45
|
|
34
46
|
class AsyncClientWrapper(BaseClientWrapper):
|
35
|
-
def __init__(
|
36
|
-
|
37
|
-
|
47
|
+
def __init__(
|
48
|
+
self,
|
49
|
+
*,
|
50
|
+
api_key: str,
|
51
|
+
environment: VellumEnvironment,
|
52
|
+
timeout: typing.Optional[float] = None,
|
53
|
+
httpx_client: httpx.AsyncClient
|
54
|
+
):
|
55
|
+
super().__init__(api_key=api_key, environment=environment, timeout=timeout)
|
56
|
+
self.httpx_client = AsyncHttpClient(httpx_client=httpx_client)
|
vellum/core/file.py
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
# File typing inspired by the flexibility of types within the httpx library
|
6
|
+
# https://github.com/encode/httpx/blob/master/httpx/_types.py
|
7
|
+
FileContent = typing.Union[typing.IO[bytes], bytes, str]
|
8
|
+
File = typing.Union[
|
9
|
+
# file (or bytes)
|
10
|
+
FileContent,
|
11
|
+
# (filename, file (or bytes))
|
12
|
+
typing.Tuple[typing.Optional[str], FileContent],
|
13
|
+
# (filename, file (or bytes), content_type)
|
14
|
+
typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str]],
|
15
|
+
# (filename, file (or bytes), content_type, headers)
|
16
|
+
typing.Tuple[typing.Optional[str], FileContent, typing.Optional[str], typing.Mapping[str, str]],
|
17
|
+
]
|
18
|
+
|
19
|
+
|
20
|
+
def convert_file_dict_to_httpx_tuples(
|
21
|
+
d: typing.Dict[str, typing.Union[File, typing.List[File]]]
|
22
|
+
) -> typing.List[typing.Tuple[str, File]]:
|
23
|
+
"""
|
24
|
+
The format we use is a list of tuples, where the first element is the
|
25
|
+
name of the file and the second is the file object. Typically HTTPX wants
|
26
|
+
a dict, but to be able to send lists of files, you have to use the list
|
27
|
+
approach (which also works for non-lists)
|
28
|
+
https://github.com/encode/httpx/pull/1032
|
29
|
+
"""
|
30
|
+
|
31
|
+
httpx_tuples = []
|
32
|
+
for key, file_like in d.items():
|
33
|
+
if isinstance(file_like, list):
|
34
|
+
for file_like_item in file_like:
|
35
|
+
httpx_tuples.append((key, file_like_item))
|
36
|
+
else:
|
37
|
+
httpx_tuples.append((key, file_like))
|
38
|
+
return httpx_tuples
|
@@ -0,0 +1,130 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import asyncio
|
4
|
+
import email.utils
|
5
|
+
import re
|
6
|
+
import time
|
7
|
+
import typing
|
8
|
+
from contextlib import asynccontextmanager, contextmanager
|
9
|
+
from functools import wraps
|
10
|
+
from random import random
|
11
|
+
|
12
|
+
import httpx
|
13
|
+
|
14
|
+
INITIAL_RETRY_DELAY_SECONDS = 0.5
|
15
|
+
MAX_RETRY_DELAY_SECONDS = 10
|
16
|
+
MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30
|
17
|
+
|
18
|
+
|
19
|
+
def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]:
|
20
|
+
"""
|
21
|
+
This function parses the `Retry-After` header in a HTTP response and returns the number of seconds to wait.
|
22
|
+
|
23
|
+
Inspired by the urllib3 retry implementation.
|
24
|
+
"""
|
25
|
+
retry_after_ms = response_headers.get("retry-after-ms")
|
26
|
+
if retry_after_ms is not None:
|
27
|
+
try:
|
28
|
+
return int(retry_after_ms) / 1000 if retry_after_ms > 0 else 0
|
29
|
+
except Exception:
|
30
|
+
pass
|
31
|
+
|
32
|
+
retry_after = response_headers.get("retry-after")
|
33
|
+
if retry_after is None:
|
34
|
+
return None
|
35
|
+
|
36
|
+
# Attempt to parse the header as an int.
|
37
|
+
if re.match(r"^\s*[0-9]+\s*$", retry_after):
|
38
|
+
seconds = float(retry_after)
|
39
|
+
# Fallback to parsing it as a date.
|
40
|
+
else:
|
41
|
+
retry_date_tuple = email.utils.parsedate_tz(retry_after)
|
42
|
+
if retry_date_tuple is None:
|
43
|
+
return None
|
44
|
+
if retry_date_tuple[9] is None: # Python 2
|
45
|
+
# Assume UTC if no timezone was specified
|
46
|
+
# On Python2.7, parsedate_tz returns None for a timezone offset
|
47
|
+
# instead of 0 if no timezone is given, where mktime_tz treats
|
48
|
+
# a None timezone offset as local time.
|
49
|
+
retry_date_tuple = retry_date_tuple[:9] + (0,) + retry_date_tuple[10:]
|
50
|
+
|
51
|
+
retry_date = email.utils.mktime_tz(retry_date_tuple)
|
52
|
+
seconds = retry_date - time.time()
|
53
|
+
|
54
|
+
if seconds < 0:
|
55
|
+
seconds = 0
|
56
|
+
|
57
|
+
return seconds
|
58
|
+
|
59
|
+
|
60
|
+
def _retry_timeout(response: httpx.Response, retries: int) -> float:
|
61
|
+
"""
|
62
|
+
Determine the amount of time to wait before retrying a request.
|
63
|
+
This function begins by trying to parse a retry-after header from the response, and then proceeds to use exponential backoff
|
64
|
+
with a jitter to determine the number of seconds to wait.
|
65
|
+
"""
|
66
|
+
|
67
|
+
# If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says.
|
68
|
+
retry_after = _parse_retry_after(response.headers)
|
69
|
+
if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER:
|
70
|
+
return retry_after
|
71
|
+
|
72
|
+
# Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS.
|
73
|
+
retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS)
|
74
|
+
|
75
|
+
# Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries.
|
76
|
+
timeout = retry_delay * (1 - 0.25 * random())
|
77
|
+
return timeout if timeout >= 0 else 0
|
78
|
+
|
79
|
+
|
80
|
+
def _should_retry(response: httpx.Response) -> bool:
|
81
|
+
retriable_400s = [429, 408, 409]
|
82
|
+
return response.status_code >= 500 or response.status_code in retriable_400s
|
83
|
+
|
84
|
+
|
85
|
+
class HttpClient:
|
86
|
+
def __init__(self, *, httpx_client: httpx.Client):
|
87
|
+
self.httpx_client = httpx_client
|
88
|
+
|
89
|
+
# Ensure that the signature of the `request` method is the same as the `httpx.Client.request` method
|
90
|
+
@wraps(httpx.Client.request)
|
91
|
+
def request(
|
92
|
+
self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any
|
93
|
+
) -> httpx.Response:
|
94
|
+
response = self.httpx_client.request(*args, **kwargs)
|
95
|
+
if _should_retry(response=response):
|
96
|
+
if max_retries > retries:
|
97
|
+
time.sleep(_retry_timeout(response=response, retries=retries))
|
98
|
+
return self.request(max_retries=max_retries, retries=retries + 1, *args, **kwargs)
|
99
|
+
return response
|
100
|
+
|
101
|
+
@wraps(httpx.Client.stream)
|
102
|
+
@contextmanager
|
103
|
+
def stream(self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any) -> typing.Any:
|
104
|
+
with self.httpx_client.stream(*args, **kwargs) as stream:
|
105
|
+
yield stream
|
106
|
+
|
107
|
+
|
108
|
+
class AsyncHttpClient:
|
109
|
+
def __init__(self, *, httpx_client: httpx.AsyncClient):
|
110
|
+
self.httpx_client = httpx_client
|
111
|
+
|
112
|
+
# Ensure that the signature of the `request` method is the same as the `httpx.Client.request` method
|
113
|
+
@wraps(httpx.AsyncClient.request)
|
114
|
+
async def request(
|
115
|
+
self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any
|
116
|
+
) -> httpx.Response:
|
117
|
+
response = await self.httpx_client.request(*args, **kwargs)
|
118
|
+
if _should_retry(response=response):
|
119
|
+
if max_retries > retries:
|
120
|
+
await asyncio.sleep(_retry_timeout(response=response, retries=retries))
|
121
|
+
return await self.request(max_retries=max_retries, retries=retries + 1, *args, **kwargs)
|
122
|
+
return response
|
123
|
+
|
124
|
+
@wraps(httpx.AsyncClient.stream)
|
125
|
+
@asynccontextmanager
|
126
|
+
async def stream(
|
127
|
+
self, *args: typing.Any, max_retries: int = 0, retries: int = 0, **kwargs: typing.Any
|
128
|
+
) -> typing.Any:
|
129
|
+
async with self.httpx_client.stream(*args, **kwargs) as stream:
|
130
|
+
yield stream
|
vellum/core/jsonable_encoder.py
CHANGED
@@ -65,10 +65,10 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
|
|
65
65
|
return str(obj)
|
66
66
|
if isinstance(obj, (str, int, float, type(None))):
|
67
67
|
return obj
|
68
|
-
if isinstance(obj, dt.date):
|
69
|
-
return str(obj)
|
70
68
|
if isinstance(obj, dt.datetime):
|
71
69
|
return serialize_datetime(obj)
|
70
|
+
if isinstance(obj, dt.date):
|
71
|
+
return str(obj)
|
72
72
|
if isinstance(obj, dict):
|
73
73
|
encoded_dict = {}
|
74
74
|
allowed_keys = set(obj.keys())
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
try:
|
6
|
+
from typing import NotRequired # type: ignore
|
7
|
+
except ImportError:
|
8
|
+
from typing_extensions import NotRequired # type: ignore
|
9
|
+
|
10
|
+
|
11
|
+
class RequestOptions(typing.TypedDict):
|
12
|
+
"""
|
13
|
+
Additional options for request-specific configuration when calling APIs via the SDK.
|
14
|
+
This is used primarily as an optional final parameter for service functions.
|
15
|
+
|
16
|
+
Attributes:
|
17
|
+
- timeout_in_seconds: int. The number of seconds to await an API call before timing out.
|
18
|
+
|
19
|
+
- max_retries: int. The max number of retries to attempt if the API call fails.
|
20
|
+
|
21
|
+
- additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict
|
22
|
+
|
23
|
+
- additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict
|
24
|
+
|
25
|
+
- additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
|
26
|
+
"""
|
27
|
+
|
28
|
+
timeout_in_seconds: NotRequired[int]
|
29
|
+
max_retries: NotRequired[int]
|
30
|
+
additional_headers: NotRequired[typing.Dict[str, typing.Any]]
|
31
|
+
additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
|
32
|
+
additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]
|
@@ -8,6 +8,7 @@ from ...core.api_error import ApiError
|
|
8
8
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
9
9
|
from ...core.jsonable_encoder import jsonable_encoder
|
10
10
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
11
|
+
from ...core.request_options import RequestOptions
|
11
12
|
from ...errors.bad_request_error import BadRequestError
|
12
13
|
from ...errors.forbidden_error import ForbiddenError
|
13
14
|
from ...errors.internal_server_error import InternalServerError
|
@@ -38,6 +39,7 @@ class DeploymentsClient:
|
|
38
39
|
offset: typing.Optional[int] = None,
|
39
40
|
ordering: typing.Optional[str] = None,
|
40
41
|
status: typing.Optional[DeploymentsListRequestStatus] = None,
|
42
|
+
request_options: typing.Optional[RequestOptions] = None,
|
41
43
|
) -> PaginatedSlimDeploymentReadList:
|
42
44
|
"""
|
43
45
|
Parameters:
|
@@ -48,6 +50,8 @@ class DeploymentsClient:
|
|
48
50
|
- ordering: typing.Optional[str]. Which field to use when ordering the results.
|
49
51
|
|
50
52
|
- status: typing.Optional[DeploymentsListRequestStatus]. status
|
53
|
+
|
54
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
51
55
|
---
|
52
56
|
from vellum.client import Vellum
|
53
57
|
|
@@ -59,9 +63,34 @@ class DeploymentsClient:
|
|
59
63
|
_response = self._client_wrapper.httpx_client.request(
|
60
64
|
"GET",
|
61
65
|
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/deployments"),
|
62
|
-
params=
|
63
|
-
|
64
|
-
|
66
|
+
params=jsonable_encoder(
|
67
|
+
remove_none_from_dict(
|
68
|
+
{
|
69
|
+
"limit": limit,
|
70
|
+
"offset": offset,
|
71
|
+
"ordering": ordering,
|
72
|
+
"status": status,
|
73
|
+
**(
|
74
|
+
request_options.get("additional_query_parameters", {})
|
75
|
+
if request_options is not None
|
76
|
+
else {}
|
77
|
+
),
|
78
|
+
}
|
79
|
+
)
|
80
|
+
),
|
81
|
+
headers=jsonable_encoder(
|
82
|
+
remove_none_from_dict(
|
83
|
+
{
|
84
|
+
**self._client_wrapper.get_headers(),
|
85
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
86
|
+
}
|
87
|
+
)
|
88
|
+
),
|
89
|
+
timeout=request_options.get("timeout_in_seconds")
|
90
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
91
|
+
else self._client_wrapper.get_timeout(),
|
92
|
+
retries=0,
|
93
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
65
94
|
)
|
66
95
|
if 200 <= _response.status_code < 300:
|
67
96
|
return pydantic.parse_obj_as(PaginatedSlimDeploymentReadList, _response.json()) # type: ignore
|
@@ -71,12 +100,14 @@ class DeploymentsClient:
|
|
71
100
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
72
101
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
73
102
|
|
74
|
-
def retrieve(self, id: str) -> DeploymentRead:
|
103
|
+
def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeploymentRead:
|
75
104
|
"""
|
76
105
|
Used to retrieve a deployment given its ID or name.
|
77
106
|
|
78
107
|
Parameters:
|
79
108
|
- id: str. Either the Deployment's ID or its unique name
|
109
|
+
|
110
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
80
111
|
---
|
81
112
|
from vellum.client import Vellum
|
82
113
|
|
@@ -89,9 +120,25 @@ class DeploymentsClient:
|
|
89
120
|
"""
|
90
121
|
_response = self._client_wrapper.httpx_client.request(
|
91
122
|
"GET",
|
92
|
-
urllib.parse.urljoin(
|
93
|
-
|
94
|
-
|
123
|
+
urllib.parse.urljoin(
|
124
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/deployments/{jsonable_encoder(id)}"
|
125
|
+
),
|
126
|
+
params=jsonable_encoder(
|
127
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
128
|
+
),
|
129
|
+
headers=jsonable_encoder(
|
130
|
+
remove_none_from_dict(
|
131
|
+
{
|
132
|
+
**self._client_wrapper.get_headers(),
|
133
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
134
|
+
}
|
135
|
+
)
|
136
|
+
),
|
137
|
+
timeout=request_options.get("timeout_in_seconds")
|
138
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
139
|
+
else self._client_wrapper.get_timeout(),
|
140
|
+
retries=0,
|
141
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
95
142
|
)
|
96
143
|
if 200 <= _response.status_code < 300:
|
97
144
|
return pydantic.parse_obj_as(DeploymentRead, _response.json()) # type: ignore
|
@@ -106,8 +153,9 @@ class DeploymentsClient:
|
|
106
153
|
*,
|
107
154
|
deployment_id: typing.Optional[str] = OMIT,
|
108
155
|
deployment_name: typing.Optional[str] = OMIT,
|
109
|
-
inputs: typing.
|
156
|
+
inputs: typing.Sequence[PromptDeploymentInputRequest],
|
110
157
|
release_tag: typing.Optional[str] = OMIT,
|
158
|
+
request_options: typing.Optional[RequestOptions] = None,
|
111
159
|
) -> DeploymentProviderPayloadResponse:
|
112
160
|
"""
|
113
161
|
Parameters:
|
@@ -115,9 +163,11 @@ class DeploymentsClient:
|
|
115
163
|
|
116
164
|
- deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
|
117
165
|
|
118
|
-
- inputs: typing.
|
166
|
+
- inputs: typing.Sequence[PromptDeploymentInputRequest]. The list of inputs defined in the Prompt's deployment with their corresponding values.
|
119
167
|
|
120
168
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
|
169
|
+
|
170
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
121
171
|
---
|
122
172
|
from vellum.client import Vellum
|
123
173
|
|
@@ -140,9 +190,28 @@ class DeploymentsClient:
|
|
140
190
|
urllib.parse.urljoin(
|
141
191
|
f"{self._client_wrapper.get_environment().default}/", "v1/deployments/provider-payload"
|
142
192
|
),
|
143
|
-
|
144
|
-
|
145
|
-
|
193
|
+
params=jsonable_encoder(
|
194
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
195
|
+
),
|
196
|
+
json=jsonable_encoder(_request)
|
197
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
198
|
+
else {
|
199
|
+
**jsonable_encoder(_request),
|
200
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
201
|
+
},
|
202
|
+
headers=jsonable_encoder(
|
203
|
+
remove_none_from_dict(
|
204
|
+
{
|
205
|
+
**self._client_wrapper.get_headers(),
|
206
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
207
|
+
}
|
208
|
+
)
|
209
|
+
),
|
210
|
+
timeout=request_options.get("timeout_in_seconds")
|
211
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
212
|
+
else self._client_wrapper.get_timeout(),
|
213
|
+
retries=0,
|
214
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
146
215
|
)
|
147
216
|
if 200 <= _response.status_code < 300:
|
148
217
|
return pydantic.parse_obj_as(DeploymentProviderPayloadResponse, _response.json()) # type: ignore
|
@@ -172,6 +241,7 @@ class AsyncDeploymentsClient:
|
|
172
241
|
offset: typing.Optional[int] = None,
|
173
242
|
ordering: typing.Optional[str] = None,
|
174
243
|
status: typing.Optional[DeploymentsListRequestStatus] = None,
|
244
|
+
request_options: typing.Optional[RequestOptions] = None,
|
175
245
|
) -> PaginatedSlimDeploymentReadList:
|
176
246
|
"""
|
177
247
|
Parameters:
|
@@ -182,6 +252,8 @@ class AsyncDeploymentsClient:
|
|
182
252
|
- ordering: typing.Optional[str]. Which field to use when ordering the results.
|
183
253
|
|
184
254
|
- status: typing.Optional[DeploymentsListRequestStatus]. status
|
255
|
+
|
256
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
185
257
|
---
|
186
258
|
from vellum.client import AsyncVellum
|
187
259
|
|
@@ -193,9 +265,34 @@ class AsyncDeploymentsClient:
|
|
193
265
|
_response = await self._client_wrapper.httpx_client.request(
|
194
266
|
"GET",
|
195
267
|
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/deployments"),
|
196
|
-
params=
|
197
|
-
|
198
|
-
|
268
|
+
params=jsonable_encoder(
|
269
|
+
remove_none_from_dict(
|
270
|
+
{
|
271
|
+
"limit": limit,
|
272
|
+
"offset": offset,
|
273
|
+
"ordering": ordering,
|
274
|
+
"status": status,
|
275
|
+
**(
|
276
|
+
request_options.get("additional_query_parameters", {})
|
277
|
+
if request_options is not None
|
278
|
+
else {}
|
279
|
+
),
|
280
|
+
}
|
281
|
+
)
|
282
|
+
),
|
283
|
+
headers=jsonable_encoder(
|
284
|
+
remove_none_from_dict(
|
285
|
+
{
|
286
|
+
**self._client_wrapper.get_headers(),
|
287
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
288
|
+
}
|
289
|
+
)
|
290
|
+
),
|
291
|
+
timeout=request_options.get("timeout_in_seconds")
|
292
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
293
|
+
else self._client_wrapper.get_timeout(),
|
294
|
+
retries=0,
|
295
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
199
296
|
)
|
200
297
|
if 200 <= _response.status_code < 300:
|
201
298
|
return pydantic.parse_obj_as(PaginatedSlimDeploymentReadList, _response.json()) # type: ignore
|
@@ -205,12 +302,14 @@ class AsyncDeploymentsClient:
|
|
205
302
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
206
303
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
207
304
|
|
208
|
-
async def retrieve(self, id: str) -> DeploymentRead:
|
305
|
+
async def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DeploymentRead:
|
209
306
|
"""
|
210
307
|
Used to retrieve a deployment given its ID or name.
|
211
308
|
|
212
309
|
Parameters:
|
213
310
|
- id: str. Either the Deployment's ID or its unique name
|
311
|
+
|
312
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
214
313
|
---
|
215
314
|
from vellum.client import AsyncVellum
|
216
315
|
|
@@ -223,9 +322,25 @@ class AsyncDeploymentsClient:
|
|
223
322
|
"""
|
224
323
|
_response = await self._client_wrapper.httpx_client.request(
|
225
324
|
"GET",
|
226
|
-
urllib.parse.urljoin(
|
227
|
-
|
228
|
-
|
325
|
+
urllib.parse.urljoin(
|
326
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/deployments/{jsonable_encoder(id)}"
|
327
|
+
),
|
328
|
+
params=jsonable_encoder(
|
329
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
330
|
+
),
|
331
|
+
headers=jsonable_encoder(
|
332
|
+
remove_none_from_dict(
|
333
|
+
{
|
334
|
+
**self._client_wrapper.get_headers(),
|
335
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
336
|
+
}
|
337
|
+
)
|
338
|
+
),
|
339
|
+
timeout=request_options.get("timeout_in_seconds")
|
340
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
341
|
+
else self._client_wrapper.get_timeout(),
|
342
|
+
retries=0,
|
343
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
229
344
|
)
|
230
345
|
if 200 <= _response.status_code < 300:
|
231
346
|
return pydantic.parse_obj_as(DeploymentRead, _response.json()) # type: ignore
|
@@ -240,8 +355,9 @@ class AsyncDeploymentsClient:
|
|
240
355
|
*,
|
241
356
|
deployment_id: typing.Optional[str] = OMIT,
|
242
357
|
deployment_name: typing.Optional[str] = OMIT,
|
243
|
-
inputs: typing.
|
358
|
+
inputs: typing.Sequence[PromptDeploymentInputRequest],
|
244
359
|
release_tag: typing.Optional[str] = OMIT,
|
360
|
+
request_options: typing.Optional[RequestOptions] = None,
|
245
361
|
) -> DeploymentProviderPayloadResponse:
|
246
362
|
"""
|
247
363
|
Parameters:
|
@@ -249,9 +365,11 @@ class AsyncDeploymentsClient:
|
|
249
365
|
|
250
366
|
- deployment_name: typing.Optional[str]. The name of the deployment. Must provide either this or deployment_id.
|
251
367
|
|
252
|
-
- inputs: typing.
|
368
|
+
- inputs: typing.Sequence[PromptDeploymentInputRequest]. The list of inputs defined in the Prompt's deployment with their corresponding values.
|
253
369
|
|
254
370
|
- release_tag: typing.Optional[str]. Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
|
371
|
+
|
372
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
255
373
|
---
|
256
374
|
from vellum.client import AsyncVellum
|
257
375
|
|
@@ -274,9 +392,28 @@ class AsyncDeploymentsClient:
|
|
274
392
|
urllib.parse.urljoin(
|
275
393
|
f"{self._client_wrapper.get_environment().default}/", "v1/deployments/provider-payload"
|
276
394
|
),
|
277
|
-
|
278
|
-
|
279
|
-
|
395
|
+
params=jsonable_encoder(
|
396
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
397
|
+
),
|
398
|
+
json=jsonable_encoder(_request)
|
399
|
+
if request_options is None or request_options.get("additional_body_parameters") is None
|
400
|
+
else {
|
401
|
+
**jsonable_encoder(_request),
|
402
|
+
**(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
|
403
|
+
},
|
404
|
+
headers=jsonable_encoder(
|
405
|
+
remove_none_from_dict(
|
406
|
+
{
|
407
|
+
**self._client_wrapper.get_headers(),
|
408
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
409
|
+
}
|
410
|
+
)
|
411
|
+
),
|
412
|
+
timeout=request_options.get("timeout_in_seconds")
|
413
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
414
|
+
else self._client_wrapper.get_timeout(),
|
415
|
+
retries=0,
|
416
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
280
417
|
)
|
281
418
|
if 200 <= _response.status_code < 300:
|
282
419
|
return pydantic.parse_obj_as(DeploymentProviderPayloadResponse, _response.json()) # type: ignore
|