vellum-ai 0.3.22__py3-none-any.whl → 0.5.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +81 -60
- vellum/client.py +139 -137
- vellum/core/__init__.py +2 -0
- vellum/core/client_wrapper.py +1 -1
- vellum/core/jsonable_encoder.py +5 -9
- vellum/core/pydantic_utilities.py +12 -0
- vellum/errors/__init__.py +1 -2
- vellum/lib/__init__.py +5 -0
- vellum/lib/test_suites/__init__.py +5 -0
- vellum/lib/test_suites/constants.py +2 -0
- vellum/lib/test_suites/exceptions.py +2 -0
- vellum/lib/test_suites/resources.py +253 -0
- vellum/lib/utils/__init__.py +0 -0
- vellum/lib/utils/env.py +11 -0
- vellum/lib/utils/exceptions.py +2 -0
- vellum/lib/utils/paginator.py +28 -0
- vellum/resources/__init__.py +0 -4
- vellum/resources/deployments/client.py +27 -31
- vellum/resources/deployments/types/deployments_list_request_status.py +1 -13
- vellum/resources/document_indexes/client.py +35 -39
- vellum/resources/document_indexes/types/document_indexes_list_request_status.py +1 -13
- vellum/resources/documents/client.py +131 -35
- vellum/resources/folder_entities/client.py +4 -4
- vellum/resources/sandboxes/client.py +18 -46
- vellum/resources/test_suite_runs/client.py +19 -23
- vellum/resources/test_suites/client.py +17 -21
- vellum/resources/workflow_deployments/client.py +13 -17
- vellum/resources/workflow_deployments/types/workflow_deployments_list_request_status.py +1 -13
- vellum/types/__init__.py +83 -55
- vellum/types/api_node_result.py +3 -7
- vellum/types/api_node_result_data.py +4 -8
- vellum/types/array_chat_message_content.py +3 -7
- vellum/types/array_chat_message_content_request.py +3 -7
- vellum/types/chat_history_input_request.py +4 -8
- vellum/types/chat_history_variable_value.py +3 -7
- vellum/types/chat_message.py +4 -8
- vellum/types/chat_message_request.py +4 -8
- vellum/types/chat_message_role.py +1 -32
- vellum/types/code_execution_node_array_result.py +3 -7
- vellum/types/code_execution_node_chat_history_result.py +3 -7
- vellum/types/code_execution_node_error_result.py +3 -7
- vellum/types/code_execution_node_function_call_result.py +3 -7
- vellum/types/code_execution_node_json_result.py +3 -7
- vellum/types/code_execution_node_number_result.py +3 -7
- vellum/types/code_execution_node_result.py +3 -7
- vellum/types/code_execution_node_result_data.py +3 -7
- vellum/types/code_execution_node_search_results_result.py +3 -7
- vellum/types/code_execution_node_string_result.py +3 -7
- vellum/types/conditional_node_result.py +3 -7
- vellum/types/conditional_node_result_data.py +3 -7
- vellum/types/deployment_provider_payload_response.py +3 -7
- vellum/types/deployment_read.py +8 -12
- vellum/types/document_document_to_document_index.py +6 -10
- vellum/types/document_index_read.py +8 -12
- vellum/types/document_read.py +8 -12
- vellum/types/enriched_normalized_completion.py +9 -13
- vellum/types/entity_status.py +1 -18
- vellum/types/environment_enum.py +1 -27
- vellum/types/error_variable_value.py +3 -7
- vellum/types/execute_prompt_api_error_response.py +4 -8
- vellum/types/execute_workflow_error_response.py +4 -8
- vellum/types/execute_workflow_response.py +3 -7
- vellum/types/execute_workflow_stream_error_response.py +4 -8
- vellum/types/execution_array_vellum_value.py +4 -8
- vellum/types/execution_chat_history_vellum_value.py +4 -8
- vellum/types/execution_error_vellum_value.py +4 -8
- vellum/types/execution_function_call_vellum_value.py +4 -8
- vellum/types/execution_json_vellum_value.py +4 -8
- vellum/types/execution_number_vellum_value.py +4 -8
- vellum/types/execution_search_results_vellum_value.py +4 -8
- vellum/types/execution_string_vellum_value.py +4 -8
- vellum/types/external_test_case_execution.py +31 -0
- vellum/types/external_test_case_execution_request.py +31 -0
- vellum/types/finish_reason_enum.py +1 -27
- vellum/types/fulfilled_execute_prompt_event.py +3 -7
- vellum/types/fulfilled_execute_prompt_response.py +5 -9
- vellum/types/fulfilled_execute_workflow_workflow_result_event.py +3 -7
- vellum/types/fulfilled_function_call.py +3 -7
- vellum/types/{registered_prompt_input_variable_request.py → fulfilled_function_call_request.py} +10 -9
- vellum/types/fulfilled_prompt_execution_meta.py +3 -7
- vellum/types/fulfilled_workflow_node_result_event.py +3 -7
- vellum/types/function_call_chat_message_content.py +3 -7
- vellum/types/function_call_chat_message_content_request.py +3 -7
- vellum/types/function_call_chat_message_content_value.py +3 -7
- vellum/types/function_call_chat_message_content_value_request.py +3 -7
- vellum/types/function_call_variable_value.py +3 -7
- vellum/types/generate_error_response.py +4 -8
- vellum/types/generate_options_request.py +4 -8
- vellum/types/generate_request.py +6 -10
- vellum/types/generate_result.py +5 -9
- vellum/types/generate_result_data.py +4 -8
- vellum/types/generate_result_error.py +4 -8
- vellum/types/generate_stream_response.py +3 -7
- vellum/types/generate_stream_result.py +3 -7
- vellum/types/generate_stream_result_data.py +3 -7
- vellum/types/image_chat_message_content.py +3 -7
- vellum/types/image_chat_message_content_request.py +3 -7
- vellum/types/image_variable_value.py +3 -7
- vellum/types/indexing_state_enum.py +3 -37
- vellum/types/initiated_execute_prompt_event.py +3 -7
- vellum/types/initiated_prompt_execution_meta.py +3 -7
- vellum/types/initiated_workflow_node_result_event.py +3 -7
- vellum/types/json_input_request.py +4 -8
- vellum/types/json_variable_value.py +3 -7
- vellum/types/logical_operator.py +23 -173
- vellum/types/logprobs_enum.py +1 -18
- vellum/types/metadata_filter_config_request.py +3 -7
- vellum/types/metadata_filter_rule_combinator.py +1 -18
- vellum/types/metadata_filter_rule_request.py +3 -7
- vellum/types/ml_model_usage.py +3 -7
- vellum/types/named_scenario_input_chat_history_variable_value_request.py +31 -0
- vellum/types/named_scenario_input_request.py +31 -0
- vellum/types/{prompt_template_block_data.py → named_scenario_input_string_variable_value_request.py} +8 -9
- vellum/types/{prompt_template_block_data_request.py → named_test_case_chat_history_variable_value.py} +9 -9
- vellum/types/named_test_case_chat_history_variable_value_request.py +3 -7
- vellum/types/named_test_case_error_variable_value.py +31 -0
- vellum/types/named_test_case_error_variable_value_request.py +3 -7
- vellum/types/{register_prompt_prompt.py → named_test_case_function_call_variable_value.py} +7 -13
- vellum/types/named_test_case_function_call_variable_value_request.py +31 -0
- vellum/types/{register_prompt_error_response.py → named_test_case_json_variable_value.py} +7 -9
- vellum/types/named_test_case_json_variable_value_request.py +3 -7
- vellum/types/{registered_prompt_sandbox_snapshot.py → named_test_case_number_variable_value.py} +7 -9
- vellum/types/named_test_case_number_variable_value_request.py +3 -7
- vellum/types/named_test_case_search_results_variable_value.py +31 -0
- vellum/types/named_test_case_search_results_variable_value_request.py +3 -7
- vellum/types/named_test_case_string_variable_value.py +30 -0
- vellum/types/named_test_case_string_variable_value_request.py +3 -7
- vellum/types/named_test_case_variable_value.py +94 -0
- vellum/types/named_test_case_variable_value_request.py +12 -0
- vellum/types/node_input_compiled_array_value.py +3 -7
- vellum/types/node_input_compiled_chat_history_value.py +3 -7
- vellum/types/node_input_compiled_error_value.py +3 -7
- vellum/types/node_input_compiled_function_call.py +3 -7
- vellum/types/node_input_compiled_json_value.py +3 -7
- vellum/types/node_input_compiled_number_value.py +3 -7
- vellum/types/node_input_compiled_search_results_value.py +3 -7
- vellum/types/node_input_compiled_string_value.py +3 -7
- vellum/types/node_output_compiled_array_value.py +3 -7
- vellum/types/node_output_compiled_chat_history_value.py +3 -7
- vellum/types/node_output_compiled_error_value.py +3 -7
- vellum/types/node_output_compiled_function_value.py +3 -7
- vellum/types/node_output_compiled_json_value.py +3 -7
- vellum/types/node_output_compiled_number_value.py +3 -7
- vellum/types/node_output_compiled_search_results_value.py +3 -7
- vellum/types/node_output_compiled_string_value.py +3 -7
- vellum/types/normalized_log_probs.py +3 -7
- vellum/types/normalized_token_log_probs.py +3 -7
- vellum/types/number_variable_value.py +3 -7
- vellum/types/paginated_document_index_read_list.py +3 -7
- vellum/types/paginated_slim_deployment_read_list.py +3 -7
- vellum/types/paginated_slim_document_list.py +3 -7
- vellum/types/paginated_slim_workflow_deployment_list.py +3 -7
- vellum/types/paginated_test_suite_run_execution_list.py +3 -7
- vellum/types/paginated_test_suite_test_case_list.py +3 -7
- vellum/types/processing_failure_reason_enum.py +1 -20
- vellum/types/processing_state_enum.py +1 -32
- vellum/types/prompt_deployment_expand_meta_request_request.py +9 -13
- vellum/types/prompt_execution_meta.py +3 -7
- vellum/types/prompt_node_result.py +3 -7
- vellum/types/prompt_node_result_data.py +3 -7
- vellum/types/raw_prompt_execution_overrides_request.py +5 -9
- vellum/types/rejected_execute_prompt_event.py +3 -7
- vellum/types/rejected_execute_prompt_response.py +5 -9
- vellum/types/rejected_execute_workflow_workflow_result_event.py +3 -7
- vellum/types/rejected_function_call.py +3 -7
- vellum/types/rejected_prompt_execution_meta.py +3 -7
- vellum/types/rejected_workflow_node_result_event.py +3 -7
- vellum/types/sandbox_scenario.py +8 -8
- vellum/types/scenario_input.py +18 -21
- vellum/types/{registered_prompt_sandbox.py → scenario_input_chat_history_variable_value.py} +7 -13
- vellum/types/scenario_input_string_variable_value.py +30 -0
- vellum/types/search_error_response.py +4 -8
- vellum/types/search_filters_request.py +5 -9
- vellum/types/search_node_result.py +3 -7
- vellum/types/search_node_result_data.py +4 -8
- vellum/types/search_request_options_request.py +7 -11
- vellum/types/search_response.py +4 -8
- vellum/types/search_result.py +6 -10
- vellum/types/search_result_document.py +7 -11
- vellum/types/search_result_document_request.py +6 -10
- vellum/types/search_result_merging_request.py +4 -8
- vellum/types/search_result_request.py +6 -10
- vellum/types/search_results_variable_value.py +3 -7
- vellum/types/search_weights_request.py +5 -9
- vellum/types/slim_deployment_read.py +7 -11
- vellum/types/slim_document.py +12 -16
- vellum/types/slim_workflow_deployment.py +9 -13
- vellum/types/streaming_execute_prompt_event.py +4 -8
- vellum/types/streaming_prompt_execution_meta.py +3 -7
- vellum/types/streaming_workflow_node_result_event.py +3 -7
- vellum/types/string_chat_message_content.py +3 -7
- vellum/types/string_chat_message_content_request.py +3 -7
- vellum/types/string_input_request.py +4 -8
- vellum/types/string_variable_value.py +3 -7
- vellum/types/submit_completion_actual_request.py +8 -12
- vellum/types/submit_completion_actuals_error_response.py +3 -7
- vellum/types/subworkflow_node_result.py +3 -7
- vellum/types/templating_node_array_result.py +3 -7
- vellum/types/templating_node_chat_history_result.py +3 -7
- vellum/types/templating_node_error_result.py +3 -7
- vellum/types/templating_node_function_call_result.py +3 -7
- vellum/types/templating_node_json_result.py +3 -7
- vellum/types/templating_node_number_result.py +3 -7
- vellum/types/templating_node_result.py +3 -7
- vellum/types/templating_node_result_data.py +3 -7
- vellum/types/templating_node_search_results_result.py +3 -7
- vellum/types/templating_node_string_result.py +3 -7
- vellum/types/terminal_node_array_result.py +4 -8
- vellum/types/terminal_node_chat_history_result.py +4 -8
- vellum/types/terminal_node_error_result.py +4 -8
- vellum/types/terminal_node_function_call_result.py +4 -8
- vellum/types/terminal_node_json_result.py +4 -8
- vellum/types/terminal_node_number_result.py +4 -8
- vellum/types/terminal_node_result.py +3 -7
- vellum/types/terminal_node_result_data.py +3 -7
- vellum/types/terminal_node_search_results_result.py +4 -8
- vellum/types/terminal_node_string_result.py +4 -8
- vellum/types/test_case_chat_history_variable_value.py +7 -6
- vellum/types/test_case_error_variable_value.py +7 -6
- vellum/types/test_case_function_call_variable_value.py +32 -0
- vellum/types/test_case_json_variable_value.py +7 -6
- vellum/types/test_case_number_variable_value.py +7 -6
- vellum/types/test_case_search_results_variable_value.py +7 -6
- vellum/types/test_case_string_variable_value.py +7 -6
- vellum/types/test_case_variable_value.py +12 -0
- vellum/types/test_suite_run_deployment_release_tag_exec_config.py +4 -8
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data.py +5 -9
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +5 -9
- vellum/types/test_suite_run_deployment_release_tag_exec_config_request.py +4 -8
- vellum/types/test_suite_run_exec_config.py +14 -1
- vellum/types/test_suite_run_exec_config_request.py +14 -1
- vellum/types/test_suite_run_execution.py +3 -7
- vellum/types/test_suite_run_execution_chat_history_output.py +3 -7
- vellum/types/test_suite_run_execution_error_output.py +3 -7
- vellum/types/test_suite_run_execution_function_call_output.py +32 -0
- vellum/types/test_suite_run_execution_json_output.py +3 -7
- vellum/types/test_suite_run_execution_metric_definition.py +3 -7
- vellum/types/test_suite_run_execution_metric_result.py +3 -7
- vellum/types/test_suite_run_execution_number_output.py +3 -7
- vellum/types/test_suite_run_execution_output.py +12 -0
- vellum/types/test_suite_run_execution_search_results_output.py +3 -7
- vellum/types/test_suite_run_execution_string_output.py +3 -7
- vellum/types/{model_version_sandbox_snapshot.py → test_suite_run_external_exec_config.py} +8 -18
- vellum/types/{registered_prompt_model_version.py → test_suite_run_external_exec_config_data.py} +6 -14
- vellum/types/test_suite_run_external_exec_config_data_request.py +29 -0
- vellum/types/{registered_prompt_deployment.py → test_suite_run_external_exec_config_request.py} +8 -16
- vellum/types/test_suite_run_external_exec_config_type_enum.py +5 -0
- vellum/types/test_suite_run_metric_error_output.py +3 -7
- vellum/types/test_suite_run_metric_number_output.py +3 -7
- vellum/types/test_suite_run_metric_string_output.py +3 -7
- vellum/types/test_suite_run_read.py +5 -9
- vellum/types/test_suite_run_state.py +1 -37
- vellum/types/test_suite_run_test_suite.py +3 -7
- vellum/types/test_suite_run_workflow_release_tag_exec_config.py +4 -8
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data.py +5 -9
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +5 -9
- vellum/types/test_suite_run_workflow_release_tag_exec_config_request.py +4 -8
- vellum/types/test_suite_test_case.py +3 -7
- vellum/types/upload_document_error_response.py +3 -7
- vellum/types/upload_document_response.py +4 -8
- vellum/types/vellum_error.py +3 -7
- vellum/types/vellum_error_code_enum.py +3 -32
- vellum/types/vellum_error_request.py +3 -7
- vellum/types/vellum_image.py +3 -7
- vellum/types/vellum_image_request.py +3 -7
- vellum/types/vellum_variable.py +3 -7
- vellum/types/vellum_variable_type.py +6 -57
- vellum/types/workflow_deployment_read.py +9 -13
- vellum/types/workflow_event_error.py +3 -7
- vellum/types/workflow_execution_actual_chat_history_request.py +8 -12
- vellum/types/workflow_execution_actual_json_request.py +8 -12
- vellum/types/workflow_execution_actual_string_request.py +8 -12
- vellum/types/workflow_execution_event_error_code.py +13 -52
- vellum/types/workflow_execution_event_type.py +1 -18
- vellum/types/workflow_execution_node_result_event.py +3 -7
- vellum/types/workflow_execution_workflow_result_event.py +3 -7
- vellum/types/workflow_node_result_event_state.py +3 -32
- vellum/types/workflow_output_array.py +4 -8
- vellum/types/workflow_output_chat_history.py +4 -8
- vellum/types/workflow_output_error.py +4 -8
- vellum/types/workflow_output_function_call.py +4 -8
- vellum/types/workflow_output_image.py +4 -8
- vellum/types/workflow_output_json.py +4 -8
- vellum/types/workflow_output_number.py +4 -8
- vellum/types/workflow_output_search_results.py +4 -8
- vellum/types/workflow_output_string.py +4 -8
- vellum/types/workflow_request_chat_history_input_request.py +4 -8
- vellum/types/workflow_request_json_input_request.py +4 -8
- vellum/types/workflow_request_number_input_request.py +4 -8
- vellum/types/workflow_request_string_input_request.py +4 -8
- vellum/types/workflow_result_event.py +3 -7
- vellum/types/workflow_result_event_output_data_array.py +4 -8
- vellum/types/workflow_result_event_output_data_chat_history.py +4 -8
- vellum/types/workflow_result_event_output_data_error.py +4 -8
- vellum/types/workflow_result_event_output_data_function_call.py +4 -8
- vellum/types/workflow_result_event_output_data_json.py +4 -8
- vellum/types/workflow_result_event_output_data_number.py +4 -8
- vellum/types/workflow_result_event_output_data_search_results.py +4 -8
- vellum/types/workflow_result_event_output_data_string.py +5 -9
- {vellum_ai-0.3.22.dist-info → vellum_ai-0.5.0.dist-info}/METADATA +1 -1
- vellum_ai-0.5.0.dist-info/RECORD +382 -0
- vellum/errors/conflict_error.py +0 -9
- vellum/resources/model_versions/__init__.py +0 -2
- vellum/resources/model_versions/client.py +0 -123
- vellum/resources/registered_prompts/__init__.py +0 -2
- vellum/resources/registered_prompts/client.py +0 -327
- vellum/types/block_type_enum.py +0 -36
- vellum/types/model_version_build_config.py +0 -40
- vellum/types/model_version_exec_config.py +0 -48
- vellum/types/model_version_exec_config_parameters.py +0 -37
- vellum/types/model_version_read.py +0 -82
- vellum/types/model_version_read_status_enum.py +0 -36
- vellum/types/prompt_template_block.py +0 -41
- vellum/types/prompt_template_block_properties.py +0 -47
- vellum/types/prompt_template_block_properties_request.py +0 -47
- vellum/types/prompt_template_block_request.py +0 -41
- vellum/types/prompt_template_block_state.py +0 -22
- vellum/types/provider_enum.py +0 -81
- vellum/types/register_prompt_model_parameters_request.py +0 -37
- vellum/types/register_prompt_prompt_info_request.py +0 -35
- vellum/types/register_prompt_response.py +0 -62
- vellum/types/scenario_input_request.py +0 -34
- vellum/types/scenario_input_type_enum.py +0 -22
- vellum_ai-0.3.22.dist-info/RECORD +0 -380
- {vellum_ai-0.3.22.dist-info → vellum_ai-0.5.0.dist-info}/LICENSE +0 -0
- {vellum_ai-0.3.22.dist-info → vellum_ai-0.5.0.dist-info}/WHEEL +0 -0
vellum/client.py
CHANGED
@@ -10,6 +10,7 @@ import httpx
|
|
10
10
|
from .core.api_error import ApiError
|
11
11
|
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
12
12
|
from .core.jsonable_encoder import jsonable_encoder
|
13
|
+
from .core.pydantic_utilities import pydantic_v1
|
13
14
|
from .core.remove_none_from_dict import remove_none_from_dict
|
14
15
|
from .core.request_options import RequestOptions
|
15
16
|
from .environment import VellumEnvironment
|
@@ -21,8 +22,6 @@ from .resources.deployments.client import AsyncDeploymentsClient, DeploymentsCli
|
|
21
22
|
from .resources.document_indexes.client import AsyncDocumentIndexesClient, DocumentIndexesClient
|
22
23
|
from .resources.documents.client import AsyncDocumentsClient, DocumentsClient
|
23
24
|
from .resources.folder_entities.client import AsyncFolderEntitiesClient, FolderEntitiesClient
|
24
|
-
from .resources.model_versions.client import AsyncModelVersionsClient, ModelVersionsClient
|
25
|
-
from .resources.registered_prompts.client import AsyncRegisteredPromptsClient, RegisteredPromptsClient
|
26
25
|
from .resources.sandboxes.client import AsyncSandboxesClient, SandboxesClient
|
27
26
|
from .resources.test_suite_runs.client import AsyncTestSuiteRunsClient, TestSuiteRunsClient
|
28
27
|
from .resources.test_suites.client import AsyncTestSuitesClient, TestSuitesClient
|
@@ -45,11 +44,6 @@ from .types.workflow_execution_event_type import WorkflowExecutionEventType
|
|
45
44
|
from .types.workflow_request_input_request import WorkflowRequestInputRequest
|
46
45
|
from .types.workflow_stream_event import WorkflowStreamEvent
|
47
46
|
|
48
|
-
try:
|
49
|
-
import pydantic.v1 as pydantic # type: ignore
|
50
|
-
except ImportError:
|
51
|
-
import pydantic # type: ignore
|
52
|
-
|
53
47
|
# this is used as the default value for optional parameters
|
54
48
|
OMIT = typing.cast(typing.Any, ...)
|
55
49
|
|
@@ -67,6 +61,8 @@ class Vellum:
|
|
67
61
|
|
68
62
|
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
|
69
63
|
|
64
|
+
- follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
65
|
+
|
70
66
|
- httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
71
67
|
---
|
72
68
|
from vellum.client import Vellum
|
@@ -82,21 +78,24 @@ class Vellum:
|
|
82
78
|
environment: VellumEnvironment = VellumEnvironment.PRODUCTION,
|
83
79
|
api_key: str,
|
84
80
|
timeout: typing.Optional[float] = None,
|
81
|
+
follow_redirects: typing.Optional[bool] = True,
|
85
82
|
httpx_client: typing.Optional[httpx.Client] = None,
|
86
83
|
):
|
87
84
|
_defaulted_timeout = timeout if timeout is not None else None if httpx_client is None else None
|
88
85
|
self._client_wrapper = SyncClientWrapper(
|
89
86
|
environment=environment,
|
90
87
|
api_key=api_key,
|
91
|
-
httpx_client=
|
88
|
+
httpx_client=httpx_client
|
89
|
+
if httpx_client is not None
|
90
|
+
else httpx.Client(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
91
|
+
if follow_redirects is not None
|
92
|
+
else httpx.Client(timeout=_defaulted_timeout),
|
92
93
|
timeout=_defaulted_timeout,
|
93
94
|
)
|
94
95
|
self.deployments = DeploymentsClient(client_wrapper=self._client_wrapper)
|
95
96
|
self.document_indexes = DocumentIndexesClient(client_wrapper=self._client_wrapper)
|
96
97
|
self.documents = DocumentsClient(client_wrapper=self._client_wrapper)
|
97
98
|
self.folder_entities = FolderEntitiesClient(client_wrapper=self._client_wrapper)
|
98
|
-
self.model_versions = ModelVersionsClient(client_wrapper=self._client_wrapper)
|
99
|
-
self.registered_prompts = RegisteredPromptsClient(client_wrapper=self._client_wrapper)
|
100
99
|
self.sandboxes = SandboxesClient(client_wrapper=self._client_wrapper)
|
101
100
|
self.test_suite_runs = TestSuiteRunsClient(client_wrapper=self._client_wrapper)
|
102
101
|
self.test_suites = TestSuitesClient(client_wrapper=self._client_wrapper)
|
@@ -196,8 +195,8 @@ class Vellum:
|
|
196
195
|
if metadata is not OMIT:
|
197
196
|
_request["metadata"] = metadata
|
198
197
|
_response = self._client_wrapper.httpx_client.request(
|
199
|
-
"POST",
|
200
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt"),
|
198
|
+
method="POST",
|
199
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt"),
|
201
200
|
params=jsonable_encoder(
|
202
201
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
203
202
|
),
|
@@ -222,15 +221,15 @@ class Vellum:
|
|
222
221
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
223
222
|
)
|
224
223
|
if 200 <= _response.status_code < 300:
|
225
|
-
return
|
224
|
+
return pydantic_v1.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
|
226
225
|
if _response.status_code == 400:
|
227
|
-
raise BadRequestError(
|
226
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
228
227
|
if _response.status_code == 403:
|
229
|
-
raise ForbiddenError(
|
228
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
230
229
|
if _response.status_code == 404:
|
231
|
-
raise NotFoundError(
|
230
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
232
231
|
if _response.status_code == 500:
|
233
|
-
raise InternalServerError(
|
232
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
234
233
|
try:
|
235
234
|
_response_json = _response.json()
|
236
235
|
except JSONDecodeError:
|
@@ -331,8 +330,8 @@ class Vellum:
|
|
331
330
|
if metadata is not OMIT:
|
332
331
|
_request["metadata"] = metadata
|
333
332
|
with self._client_wrapper.httpx_client.stream(
|
334
|
-
"POST",
|
335
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt-stream"),
|
333
|
+
method="POST",
|
334
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt-stream"),
|
336
335
|
params=jsonable_encoder(
|
337
336
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
338
337
|
),
|
@@ -360,17 +359,17 @@ class Vellum:
|
|
360
359
|
for _text in _response.iter_lines():
|
361
360
|
if len(_text) == 0:
|
362
361
|
continue
|
363
|
-
yield
|
362
|
+
yield pydantic_v1.parse_obj_as(ExecutePromptEvent, json.loads(_text)) # type: ignore
|
364
363
|
return
|
365
364
|
_response.read()
|
366
365
|
if _response.status_code == 400:
|
367
|
-
raise BadRequestError(
|
366
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
368
367
|
if _response.status_code == 403:
|
369
|
-
raise ForbiddenError(
|
368
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
370
369
|
if _response.status_code == 404:
|
371
|
-
raise NotFoundError(
|
370
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
372
371
|
if _response.status_code == 500:
|
373
|
-
raise InternalServerError(
|
372
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
374
373
|
try:
|
375
374
|
_response_json = _response.json()
|
376
375
|
except JSONDecodeError:
|
@@ -432,8 +431,8 @@ class Vellum:
|
|
432
431
|
if external_id is not OMIT:
|
433
432
|
_request["external_id"] = external_id
|
434
433
|
_response = self._client_wrapper.httpx_client.request(
|
435
|
-
"POST",
|
436
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow"),
|
434
|
+
method="POST",
|
435
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow"),
|
437
436
|
params=jsonable_encoder(
|
438
437
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
439
438
|
),
|
@@ -458,13 +457,13 @@ class Vellum:
|
|
458
457
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
459
458
|
)
|
460
459
|
if 200 <= _response.status_code < 300:
|
461
|
-
return
|
460
|
+
return pydantic_v1.parse_obj_as(ExecuteWorkflowResponse, _response.json()) # type: ignore
|
462
461
|
if _response.status_code == 400:
|
463
|
-
raise BadRequestError(
|
462
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
464
463
|
if _response.status_code == 404:
|
465
|
-
raise NotFoundError(
|
464
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
466
465
|
if _response.status_code == 500:
|
467
|
-
raise InternalServerError(
|
466
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
468
467
|
try:
|
469
468
|
_response_json = _response.json()
|
470
469
|
except JSONDecodeError:
|
@@ -500,10 +499,7 @@ class Vellum:
|
|
500
499
|
|
501
500
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
502
501
|
---
|
503
|
-
from vellum import
|
504
|
-
WorkflowExecutionEventType,
|
505
|
-
WorkflowRequestInputRequest_String,
|
506
|
-
)
|
502
|
+
from vellum import WorkflowRequestInputRequest_String
|
507
503
|
from vellum.client import Vellum
|
508
504
|
|
509
505
|
client = Vellum(
|
@@ -520,7 +516,7 @@ class Vellum:
|
|
520
516
|
workflow_deployment_name="string",
|
521
517
|
release_tag="string",
|
522
518
|
external_id="string",
|
523
|
-
event_types=[
|
519
|
+
event_types=["NODE"],
|
524
520
|
)
|
525
521
|
"""
|
526
522
|
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
@@ -535,8 +531,10 @@ class Vellum:
|
|
535
531
|
if event_types is not OMIT:
|
536
532
|
_request["event_types"] = event_types
|
537
533
|
with self._client_wrapper.httpx_client.stream(
|
538
|
-
"POST",
|
539
|
-
urllib.parse.urljoin(
|
534
|
+
method="POST",
|
535
|
+
url=urllib.parse.urljoin(
|
536
|
+
f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow-stream"
|
537
|
+
),
|
540
538
|
params=jsonable_encoder(
|
541
539
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
542
540
|
),
|
@@ -564,15 +562,15 @@ class Vellum:
|
|
564
562
|
for _text in _response.iter_lines():
|
565
563
|
if len(_text) == 0:
|
566
564
|
continue
|
567
|
-
yield
|
565
|
+
yield pydantic_v1.parse_obj_as(WorkflowStreamEvent, json.loads(_text)) # type: ignore
|
568
566
|
return
|
569
567
|
_response.read()
|
570
568
|
if _response.status_code == 400:
|
571
|
-
raise BadRequestError(
|
569
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
572
570
|
if _response.status_code == 404:
|
573
|
-
raise NotFoundError(
|
571
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
574
572
|
if _response.status_code == 500:
|
575
|
-
raise InternalServerError(
|
573
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
576
574
|
try:
|
577
575
|
_response_json = _response.json()
|
578
576
|
except JSONDecodeError:
|
@@ -626,8 +624,8 @@ class Vellum:
|
|
626
624
|
if options is not OMIT:
|
627
625
|
_request["options"] = options
|
628
626
|
_response = self._client_wrapper.httpx_client.request(
|
629
|
-
"POST",
|
630
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate"),
|
627
|
+
method="POST",
|
628
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate"),
|
631
629
|
params=jsonable_encoder(
|
632
630
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
633
631
|
),
|
@@ -652,15 +650,15 @@ class Vellum:
|
|
652
650
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
653
651
|
)
|
654
652
|
if 200 <= _response.status_code < 300:
|
655
|
-
return
|
653
|
+
return pydantic_v1.parse_obj_as(GenerateResponse, _response.json()) # type: ignore
|
656
654
|
if _response.status_code == 400:
|
657
|
-
raise BadRequestError(
|
655
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
658
656
|
if _response.status_code == 403:
|
659
|
-
raise ForbiddenError(
|
657
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
660
658
|
if _response.status_code == 404:
|
661
|
-
raise NotFoundError(
|
659
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
662
660
|
if _response.status_code == 500:
|
663
|
-
raise InternalServerError(
|
661
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
664
662
|
try:
|
665
663
|
_response_json = _response.json()
|
666
664
|
except JSONDecodeError:
|
@@ -695,10 +693,8 @@ class Vellum:
|
|
695
693
|
from vellum import (
|
696
694
|
ChatMessageContentRequest_String,
|
697
695
|
ChatMessageRequest,
|
698
|
-
ChatMessageRole,
|
699
696
|
GenerateOptionsRequest,
|
700
697
|
GenerateRequest,
|
701
|
-
LogprobsEnum,
|
702
698
|
)
|
703
699
|
from vellum.client import Vellum
|
704
700
|
|
@@ -714,7 +710,7 @@ class Vellum:
|
|
714
710
|
chat_history=[
|
715
711
|
ChatMessageRequest(
|
716
712
|
text="string",
|
717
|
-
role=
|
713
|
+
role="SYSTEM",
|
718
714
|
content=ChatMessageContentRequest_String(),
|
719
715
|
source="string",
|
720
716
|
)
|
@@ -723,7 +719,7 @@ class Vellum:
|
|
723
719
|
)
|
724
720
|
],
|
725
721
|
options=GenerateOptionsRequest(
|
726
|
-
logprobs=
|
722
|
+
logprobs="ALL",
|
727
723
|
),
|
728
724
|
)
|
729
725
|
"""
|
@@ -735,8 +731,8 @@ class Vellum:
|
|
735
731
|
if options is not OMIT:
|
736
732
|
_request["options"] = options
|
737
733
|
with self._client_wrapper.httpx_client.stream(
|
738
|
-
"POST",
|
739
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate-stream"),
|
734
|
+
method="POST",
|
735
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate-stream"),
|
740
736
|
params=jsonable_encoder(
|
741
737
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
742
738
|
),
|
@@ -764,17 +760,17 @@ class Vellum:
|
|
764
760
|
for _text in _response.iter_lines():
|
765
761
|
if len(_text) == 0:
|
766
762
|
continue
|
767
|
-
yield
|
763
|
+
yield pydantic_v1.parse_obj_as(GenerateStreamResponse, json.loads(_text)) # type: ignore
|
768
764
|
return
|
769
765
|
_response.read()
|
770
766
|
if _response.status_code == 400:
|
771
|
-
raise BadRequestError(
|
767
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
772
768
|
if _response.status_code == 403:
|
773
|
-
raise ForbiddenError(
|
769
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
774
770
|
if _response.status_code == 404:
|
775
|
-
raise NotFoundError(
|
771
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
776
772
|
if _response.status_code == 500:
|
777
|
-
raise InternalServerError(
|
773
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
778
774
|
try:
|
779
775
|
_response_json = _response.json()
|
780
776
|
except JSONDecodeError:
|
@@ -823,8 +819,8 @@ class Vellum:
|
|
823
819
|
if options is not OMIT:
|
824
820
|
_request["options"] = options
|
825
821
|
_response = self._client_wrapper.httpx_client.request(
|
826
|
-
"POST",
|
827
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/search"),
|
822
|
+
method="POST",
|
823
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/search"),
|
828
824
|
params=jsonable_encoder(
|
829
825
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
830
826
|
),
|
@@ -849,13 +845,13 @@ class Vellum:
|
|
849
845
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
850
846
|
)
|
851
847
|
if 200 <= _response.status_code < 300:
|
852
|
-
return
|
848
|
+
return pydantic_v1.parse_obj_as(SearchResponse, _response.json()) # type: ignore
|
853
849
|
if _response.status_code == 400:
|
854
|
-
raise BadRequestError(
|
850
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
855
851
|
if _response.status_code == 404:
|
856
|
-
raise NotFoundError(
|
852
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
857
853
|
if _response.status_code == 500:
|
858
|
-
raise InternalServerError(
|
854
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
859
855
|
try:
|
860
856
|
_response_json = _response.json()
|
861
857
|
except JSONDecodeError:
|
@@ -900,8 +896,10 @@ class Vellum:
|
|
900
896
|
if deployment_name is not OMIT:
|
901
897
|
_request["deployment_name"] = deployment_name
|
902
898
|
_response = self._client_wrapper.httpx_client.request(
|
903
|
-
"POST",
|
904
|
-
urllib.parse.urljoin(
|
899
|
+
method="POST",
|
900
|
+
url=urllib.parse.urljoin(
|
901
|
+
f"{self._client_wrapper.get_environment().predict}/", "v1/submit-completion-actuals"
|
902
|
+
),
|
905
903
|
params=jsonable_encoder(
|
906
904
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
907
905
|
),
|
@@ -928,11 +926,11 @@ class Vellum:
|
|
928
926
|
if 200 <= _response.status_code < 300:
|
929
927
|
return
|
930
928
|
if _response.status_code == 400:
|
931
|
-
raise BadRequestError(
|
929
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
932
930
|
if _response.status_code == 404:
|
933
|
-
raise NotFoundError(
|
931
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
934
932
|
if _response.status_code == 500:
|
935
|
-
raise InternalServerError(
|
933
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
936
934
|
try:
|
937
935
|
_response_json = _response.json()
|
938
936
|
except JSONDecodeError:
|
@@ -976,8 +974,8 @@ class Vellum:
|
|
976
974
|
if external_id is not OMIT:
|
977
975
|
_request["external_id"] = external_id
|
978
976
|
_response = self._client_wrapper.httpx_client.request(
|
979
|
-
"POST",
|
980
|
-
urllib.parse.urljoin(
|
977
|
+
method="POST",
|
978
|
+
url=urllib.parse.urljoin(
|
981
979
|
f"{self._client_wrapper.get_environment().predict}/", "v1/submit-workflow-execution-actuals"
|
982
980
|
),
|
983
981
|
params=jsonable_encoder(
|
@@ -1025,6 +1023,8 @@ class AsyncVellum:
|
|
1025
1023
|
|
1026
1024
|
- timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set.
|
1027
1025
|
|
1026
|
+
- follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in.
|
1027
|
+
|
1028
1028
|
- httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration.
|
1029
1029
|
---
|
1030
1030
|
from vellum.client import AsyncVellum
|
@@ -1040,21 +1040,24 @@ class AsyncVellum:
|
|
1040
1040
|
environment: VellumEnvironment = VellumEnvironment.PRODUCTION,
|
1041
1041
|
api_key: str,
|
1042
1042
|
timeout: typing.Optional[float] = None,
|
1043
|
+
follow_redirects: typing.Optional[bool] = True,
|
1043
1044
|
httpx_client: typing.Optional[httpx.AsyncClient] = None,
|
1044
1045
|
):
|
1045
1046
|
_defaulted_timeout = timeout if timeout is not None else None if httpx_client is None else None
|
1046
1047
|
self._client_wrapper = AsyncClientWrapper(
|
1047
1048
|
environment=environment,
|
1048
1049
|
api_key=api_key,
|
1049
|
-
httpx_client=
|
1050
|
+
httpx_client=httpx_client
|
1051
|
+
if httpx_client is not None
|
1052
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout, follow_redirects=follow_redirects)
|
1053
|
+
if follow_redirects is not None
|
1054
|
+
else httpx.AsyncClient(timeout=_defaulted_timeout),
|
1050
1055
|
timeout=_defaulted_timeout,
|
1051
1056
|
)
|
1052
1057
|
self.deployments = AsyncDeploymentsClient(client_wrapper=self._client_wrapper)
|
1053
1058
|
self.document_indexes = AsyncDocumentIndexesClient(client_wrapper=self._client_wrapper)
|
1054
1059
|
self.documents = AsyncDocumentsClient(client_wrapper=self._client_wrapper)
|
1055
1060
|
self.folder_entities = AsyncFolderEntitiesClient(client_wrapper=self._client_wrapper)
|
1056
|
-
self.model_versions = AsyncModelVersionsClient(client_wrapper=self._client_wrapper)
|
1057
|
-
self.registered_prompts = AsyncRegisteredPromptsClient(client_wrapper=self._client_wrapper)
|
1058
1061
|
self.sandboxes = AsyncSandboxesClient(client_wrapper=self._client_wrapper)
|
1059
1062
|
self.test_suite_runs = AsyncTestSuiteRunsClient(client_wrapper=self._client_wrapper)
|
1060
1063
|
self.test_suites = AsyncTestSuitesClient(client_wrapper=self._client_wrapper)
|
@@ -1154,8 +1157,8 @@ class AsyncVellum:
|
|
1154
1157
|
if metadata is not OMIT:
|
1155
1158
|
_request["metadata"] = metadata
|
1156
1159
|
_response = await self._client_wrapper.httpx_client.request(
|
1157
|
-
"POST",
|
1158
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt"),
|
1160
|
+
method="POST",
|
1161
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt"),
|
1159
1162
|
params=jsonable_encoder(
|
1160
1163
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1161
1164
|
),
|
@@ -1180,15 +1183,15 @@ class AsyncVellum:
|
|
1180
1183
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
1181
1184
|
)
|
1182
1185
|
if 200 <= _response.status_code < 300:
|
1183
|
-
return
|
1186
|
+
return pydantic_v1.parse_obj_as(ExecutePromptResponse, _response.json()) # type: ignore
|
1184
1187
|
if _response.status_code == 400:
|
1185
|
-
raise BadRequestError(
|
1188
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1186
1189
|
if _response.status_code == 403:
|
1187
|
-
raise ForbiddenError(
|
1190
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1188
1191
|
if _response.status_code == 404:
|
1189
|
-
raise NotFoundError(
|
1192
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1190
1193
|
if _response.status_code == 500:
|
1191
|
-
raise InternalServerError(
|
1194
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1192
1195
|
try:
|
1193
1196
|
_response_json = _response.json()
|
1194
1197
|
except JSONDecodeError:
|
@@ -1289,8 +1292,8 @@ class AsyncVellum:
|
|
1289
1292
|
if metadata is not OMIT:
|
1290
1293
|
_request["metadata"] = metadata
|
1291
1294
|
async with self._client_wrapper.httpx_client.stream(
|
1292
|
-
"POST",
|
1293
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt-stream"),
|
1295
|
+
method="POST",
|
1296
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-prompt-stream"),
|
1294
1297
|
params=jsonable_encoder(
|
1295
1298
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1296
1299
|
),
|
@@ -1318,17 +1321,17 @@ class AsyncVellum:
|
|
1318
1321
|
async for _text in _response.aiter_lines():
|
1319
1322
|
if len(_text) == 0:
|
1320
1323
|
continue
|
1321
|
-
yield
|
1324
|
+
yield pydantic_v1.parse_obj_as(ExecutePromptEvent, json.loads(_text)) # type: ignore
|
1322
1325
|
return
|
1323
1326
|
await _response.aread()
|
1324
1327
|
if _response.status_code == 400:
|
1325
|
-
raise BadRequestError(
|
1328
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1326
1329
|
if _response.status_code == 403:
|
1327
|
-
raise ForbiddenError(
|
1330
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1328
1331
|
if _response.status_code == 404:
|
1329
|
-
raise NotFoundError(
|
1332
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1330
1333
|
if _response.status_code == 500:
|
1331
|
-
raise InternalServerError(
|
1334
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1332
1335
|
try:
|
1333
1336
|
_response_json = _response.json()
|
1334
1337
|
except JSONDecodeError:
|
@@ -1390,8 +1393,8 @@ class AsyncVellum:
|
|
1390
1393
|
if external_id is not OMIT:
|
1391
1394
|
_request["external_id"] = external_id
|
1392
1395
|
_response = await self._client_wrapper.httpx_client.request(
|
1393
|
-
"POST",
|
1394
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow"),
|
1396
|
+
method="POST",
|
1397
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow"),
|
1395
1398
|
params=jsonable_encoder(
|
1396
1399
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1397
1400
|
),
|
@@ -1416,13 +1419,13 @@ class AsyncVellum:
|
|
1416
1419
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
1417
1420
|
)
|
1418
1421
|
if 200 <= _response.status_code < 300:
|
1419
|
-
return
|
1422
|
+
return pydantic_v1.parse_obj_as(ExecuteWorkflowResponse, _response.json()) # type: ignore
|
1420
1423
|
if _response.status_code == 400:
|
1421
|
-
raise BadRequestError(
|
1424
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1422
1425
|
if _response.status_code == 404:
|
1423
|
-
raise NotFoundError(
|
1426
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1424
1427
|
if _response.status_code == 500:
|
1425
|
-
raise InternalServerError(
|
1428
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1426
1429
|
try:
|
1427
1430
|
_response_json = _response.json()
|
1428
1431
|
except JSONDecodeError:
|
@@ -1458,10 +1461,7 @@ class AsyncVellum:
|
|
1458
1461
|
|
1459
1462
|
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
1460
1463
|
---
|
1461
|
-
from vellum import
|
1462
|
-
WorkflowExecutionEventType,
|
1463
|
-
WorkflowRequestInputRequest_String,
|
1464
|
-
)
|
1464
|
+
from vellum import WorkflowRequestInputRequest_String
|
1465
1465
|
from vellum.client import AsyncVellum
|
1466
1466
|
|
1467
1467
|
client = AsyncVellum(
|
@@ -1478,7 +1478,7 @@ class AsyncVellum:
|
|
1478
1478
|
workflow_deployment_name="string",
|
1479
1479
|
release_tag="string",
|
1480
1480
|
external_id="string",
|
1481
|
-
event_types=[
|
1481
|
+
event_types=["NODE"],
|
1482
1482
|
)
|
1483
1483
|
"""
|
1484
1484
|
_request: typing.Dict[str, typing.Any] = {"inputs": inputs}
|
@@ -1493,8 +1493,10 @@ class AsyncVellum:
|
|
1493
1493
|
if event_types is not OMIT:
|
1494
1494
|
_request["event_types"] = event_types
|
1495
1495
|
async with self._client_wrapper.httpx_client.stream(
|
1496
|
-
"POST",
|
1497
|
-
urllib.parse.urljoin(
|
1496
|
+
method="POST",
|
1497
|
+
url=urllib.parse.urljoin(
|
1498
|
+
f"{self._client_wrapper.get_environment().predict}/", "v1/execute-workflow-stream"
|
1499
|
+
),
|
1498
1500
|
params=jsonable_encoder(
|
1499
1501
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1500
1502
|
),
|
@@ -1522,15 +1524,15 @@ class AsyncVellum:
|
|
1522
1524
|
async for _text in _response.aiter_lines():
|
1523
1525
|
if len(_text) == 0:
|
1524
1526
|
continue
|
1525
|
-
yield
|
1527
|
+
yield pydantic_v1.parse_obj_as(WorkflowStreamEvent, json.loads(_text)) # type: ignore
|
1526
1528
|
return
|
1527
1529
|
await _response.aread()
|
1528
1530
|
if _response.status_code == 400:
|
1529
|
-
raise BadRequestError(
|
1531
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1530
1532
|
if _response.status_code == 404:
|
1531
|
-
raise NotFoundError(
|
1533
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1532
1534
|
if _response.status_code == 500:
|
1533
|
-
raise InternalServerError(
|
1535
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1534
1536
|
try:
|
1535
1537
|
_response_json = _response.json()
|
1536
1538
|
except JSONDecodeError:
|
@@ -1584,8 +1586,8 @@ class AsyncVellum:
|
|
1584
1586
|
if options is not OMIT:
|
1585
1587
|
_request["options"] = options
|
1586
1588
|
_response = await self._client_wrapper.httpx_client.request(
|
1587
|
-
"POST",
|
1588
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate"),
|
1589
|
+
method="POST",
|
1590
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate"),
|
1589
1591
|
params=jsonable_encoder(
|
1590
1592
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1591
1593
|
),
|
@@ -1610,15 +1612,15 @@ class AsyncVellum:
|
|
1610
1612
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
1611
1613
|
)
|
1612
1614
|
if 200 <= _response.status_code < 300:
|
1613
|
-
return
|
1615
|
+
return pydantic_v1.parse_obj_as(GenerateResponse, _response.json()) # type: ignore
|
1614
1616
|
if _response.status_code == 400:
|
1615
|
-
raise BadRequestError(
|
1617
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1616
1618
|
if _response.status_code == 403:
|
1617
|
-
raise ForbiddenError(
|
1619
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1618
1620
|
if _response.status_code == 404:
|
1619
|
-
raise NotFoundError(
|
1621
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1620
1622
|
if _response.status_code == 500:
|
1621
|
-
raise InternalServerError(
|
1623
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1622
1624
|
try:
|
1623
1625
|
_response_json = _response.json()
|
1624
1626
|
except JSONDecodeError:
|
@@ -1653,10 +1655,8 @@ class AsyncVellum:
|
|
1653
1655
|
from vellum import (
|
1654
1656
|
ChatMessageContentRequest_String,
|
1655
1657
|
ChatMessageRequest,
|
1656
|
-
ChatMessageRole,
|
1657
1658
|
GenerateOptionsRequest,
|
1658
1659
|
GenerateRequest,
|
1659
|
-
LogprobsEnum,
|
1660
1660
|
)
|
1661
1661
|
from vellum.client import AsyncVellum
|
1662
1662
|
|
@@ -1672,7 +1672,7 @@ class AsyncVellum:
|
|
1672
1672
|
chat_history=[
|
1673
1673
|
ChatMessageRequest(
|
1674
1674
|
text="string",
|
1675
|
-
role=
|
1675
|
+
role="SYSTEM",
|
1676
1676
|
content=ChatMessageContentRequest_String(),
|
1677
1677
|
source="string",
|
1678
1678
|
)
|
@@ -1681,7 +1681,7 @@ class AsyncVellum:
|
|
1681
1681
|
)
|
1682
1682
|
],
|
1683
1683
|
options=GenerateOptionsRequest(
|
1684
|
-
logprobs=
|
1684
|
+
logprobs="ALL",
|
1685
1685
|
),
|
1686
1686
|
)
|
1687
1687
|
"""
|
@@ -1693,8 +1693,8 @@ class AsyncVellum:
|
|
1693
1693
|
if options is not OMIT:
|
1694
1694
|
_request["options"] = options
|
1695
1695
|
async with self._client_wrapper.httpx_client.stream(
|
1696
|
-
"POST",
|
1697
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate-stream"),
|
1696
|
+
method="POST",
|
1697
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/generate-stream"),
|
1698
1698
|
params=jsonable_encoder(
|
1699
1699
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1700
1700
|
),
|
@@ -1722,17 +1722,17 @@ class AsyncVellum:
|
|
1722
1722
|
async for _text in _response.aiter_lines():
|
1723
1723
|
if len(_text) == 0:
|
1724
1724
|
continue
|
1725
|
-
yield
|
1725
|
+
yield pydantic_v1.parse_obj_as(GenerateStreamResponse, json.loads(_text)) # type: ignore
|
1726
1726
|
return
|
1727
1727
|
await _response.aread()
|
1728
1728
|
if _response.status_code == 400:
|
1729
|
-
raise BadRequestError(
|
1729
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1730
1730
|
if _response.status_code == 403:
|
1731
|
-
raise ForbiddenError(
|
1731
|
+
raise ForbiddenError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1732
1732
|
if _response.status_code == 404:
|
1733
|
-
raise NotFoundError(
|
1733
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1734
1734
|
if _response.status_code == 500:
|
1735
|
-
raise InternalServerError(
|
1735
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1736
1736
|
try:
|
1737
1737
|
_response_json = _response.json()
|
1738
1738
|
except JSONDecodeError:
|
@@ -1781,8 +1781,8 @@ class AsyncVellum:
|
|
1781
1781
|
if options is not OMIT:
|
1782
1782
|
_request["options"] = options
|
1783
1783
|
_response = await self._client_wrapper.httpx_client.request(
|
1784
|
-
"POST",
|
1785
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/search"),
|
1784
|
+
method="POST",
|
1785
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().predict}/", "v1/search"),
|
1786
1786
|
params=jsonable_encoder(
|
1787
1787
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1788
1788
|
),
|
@@ -1807,13 +1807,13 @@ class AsyncVellum:
|
|
1807
1807
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
1808
1808
|
)
|
1809
1809
|
if 200 <= _response.status_code < 300:
|
1810
|
-
return
|
1810
|
+
return pydantic_v1.parse_obj_as(SearchResponse, _response.json()) # type: ignore
|
1811
1811
|
if _response.status_code == 400:
|
1812
|
-
raise BadRequestError(
|
1812
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1813
1813
|
if _response.status_code == 404:
|
1814
|
-
raise NotFoundError(
|
1814
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1815
1815
|
if _response.status_code == 500:
|
1816
|
-
raise InternalServerError(
|
1816
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1817
1817
|
try:
|
1818
1818
|
_response_json = _response.json()
|
1819
1819
|
except JSONDecodeError:
|
@@ -1858,8 +1858,10 @@ class AsyncVellum:
|
|
1858
1858
|
if deployment_name is not OMIT:
|
1859
1859
|
_request["deployment_name"] = deployment_name
|
1860
1860
|
_response = await self._client_wrapper.httpx_client.request(
|
1861
|
-
"POST",
|
1862
|
-
urllib.parse.urljoin(
|
1861
|
+
method="POST",
|
1862
|
+
url=urllib.parse.urljoin(
|
1863
|
+
f"{self._client_wrapper.get_environment().predict}/", "v1/submit-completion-actuals"
|
1864
|
+
),
|
1863
1865
|
params=jsonable_encoder(
|
1864
1866
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
1865
1867
|
),
|
@@ -1886,11 +1888,11 @@ class AsyncVellum:
|
|
1886
1888
|
if 200 <= _response.status_code < 300:
|
1887
1889
|
return
|
1888
1890
|
if _response.status_code == 400:
|
1889
|
-
raise BadRequestError(
|
1891
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1890
1892
|
if _response.status_code == 404:
|
1891
|
-
raise NotFoundError(
|
1893
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1892
1894
|
if _response.status_code == 500:
|
1893
|
-
raise InternalServerError(
|
1895
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
1894
1896
|
try:
|
1895
1897
|
_response_json = _response.json()
|
1896
1898
|
except JSONDecodeError:
|
@@ -1934,8 +1936,8 @@ class AsyncVellum:
|
|
1934
1936
|
if external_id is not OMIT:
|
1935
1937
|
_request["external_id"] = external_id
|
1936
1938
|
_response = await self._client_wrapper.httpx_client.request(
|
1937
|
-
"POST",
|
1938
|
-
urllib.parse.urljoin(
|
1939
|
+
method="POST",
|
1940
|
+
url=urllib.parse.urljoin(
|
1939
1941
|
f"{self._client_wrapper.get_environment().predict}/", "v1/submit-workflow-execution-actuals"
|
1940
1942
|
),
|
1941
1943
|
params=jsonable_encoder(
|