vellum-ai 0.3.23__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 +37 -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 +37 -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 +4 -8
- vellum/types/external_test_case_execution_request.py +4 -8
- 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/{registered_prompt_sandbox_snapshot.py → named_scenario_input_string_variable_value_request.py} +7 -9
- vellum/types/named_test_case_chat_history_variable_value.py +3 -7
- vellum/types/named_test_case_chat_history_variable_value_request.py +3 -7
- vellum/types/named_test_case_error_variable_value.py +3 -7
- 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/named_test_case_json_variable_value.py +3 -7
- vellum/types/named_test_case_json_variable_value_request.py +3 -7
- vellum/types/named_test_case_number_variable_value.py +3 -7
- vellum/types/named_test_case_number_variable_value_request.py +3 -7
- vellum/types/named_test_case_search_results_variable_value.py +3 -7
- vellum/types/named_test_case_search_results_variable_value_request.py +3 -7
- vellum/types/named_test_case_string_variable_value.py +3 -7
- vellum/types/named_test_case_string_variable_value_request.py +3 -7
- vellum/types/named_test_case_variable_value.py +12 -0
- vellum/types/named_test_case_variable_value_request.py +12 -0
- vellum/types/node_input_compiled_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 +5 -9
- vellum/types/scenario_input.py +18 -21
- vellum/types/{registered_prompt_sandbox.py → scenario_input_chat_history_variable_value.py} +7 -13
- vellum/types/{register_prompt_error_response.py → scenario_input_string_variable_value.py} +7 -9
- 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 +3 -7
- vellum/types/test_case_error_variable_value.py +3 -7
- vellum/types/test_case_function_call_variable_value.py +32 -0
- vellum/types/test_case_json_variable_value.py +3 -7
- vellum/types/test_case_number_variable_value.py +3 -7
- vellum/types/test_case_search_results_variable_value.py +3 -7
- vellum/types/test_case_string_variable_value.py +3 -7
- 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_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/{registered_prompt_model_version.py → test_suite_run_execution_function_call_output.py} +8 -13
- 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/test_suite_run_external_exec_config.py +4 -8
- vellum/types/test_suite_run_external_exec_config_data.py +4 -8
- vellum/types/test_suite_run_external_exec_config_data_request.py +4 -8
- vellum/types/test_suite_run_external_exec_config_request.py +4 -8
- 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.23.dist-info → vellum_ai-0.5.0.dist-info}/METADATA +1 -2
- 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/model_version_sandbox_snapshot.py +0 -44
- vellum/types/prompt_template_block.py +0 -41
- vellum/types/prompt_template_block_data.py +0 -31
- vellum/types/prompt_template_block_data_request.py +0 -31
- 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/registered_prompt_deployment.py +0 -42
- vellum/types/scenario_input_request.py +0 -34
- vellum/types/scenario_input_type_enum.py +0 -22
- vellum_ai-0.3.23.dist-info/RECORD +0 -394
- {vellum_ai-0.3.23.dist-info → vellum_ai-0.5.0.dist-info}/LICENSE +0 -0
- {vellum_ai-0.3.23.dist-info → vellum_ai-0.5.0.dist-info}/WHEEL +0 -0
@@ -7,6 +7,7 @@ from json.decoder import JSONDecodeError
|
|
7
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
|
+
from ...core.pydantic_utilities import pydantic_v1
|
10
11
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
11
12
|
from ...core.request_options import RequestOptions
|
12
13
|
from ...types.document_index_read import DocumentIndexRead
|
@@ -15,11 +16,6 @@ from ...types.environment_enum import EnvironmentEnum
|
|
15
16
|
from ...types.paginated_document_index_read_list import PaginatedDocumentIndexReadList
|
16
17
|
from .types.document_indexes_list_request_status import DocumentIndexesListRequestStatus
|
17
18
|
|
18
|
-
try:
|
19
|
-
import pydantic.v1 as pydantic # type: ignore
|
20
|
-
except ImportError:
|
21
|
-
import pydantic # type: ignore
|
22
|
-
|
23
19
|
# this is used as the default value for optional parameters
|
24
20
|
OMIT = typing.cast(typing.Any, ...)
|
25
21
|
|
@@ -61,8 +57,8 @@ class DocumentIndexesClient:
|
|
61
57
|
client.document_indexes.list()
|
62
58
|
"""
|
63
59
|
_response = self._client_wrapper.httpx_client.request(
|
64
|
-
"GET",
|
65
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
60
|
+
method="GET",
|
61
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
66
62
|
params=jsonable_encoder(
|
67
63
|
remove_none_from_dict(
|
68
64
|
{
|
@@ -93,7 +89,7 @@ class DocumentIndexesClient:
|
|
93
89
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
94
90
|
)
|
95
91
|
if 200 <= _response.status_code < 300:
|
96
|
-
return
|
92
|
+
return pydantic_v1.parse_obj_as(PaginatedDocumentIndexReadList, _response.json()) # type: ignore
|
97
93
|
try:
|
98
94
|
_response_json = _response.json()
|
99
95
|
except JSONDecodeError:
|
@@ -169,8 +165,8 @@ class DocumentIndexesClient:
|
|
169
165
|
if copy_documents_from_index_id is not OMIT:
|
170
166
|
_request["copy_documents_from_index_id"] = copy_documents_from_index_id
|
171
167
|
_response = self._client_wrapper.httpx_client.request(
|
172
|
-
"POST",
|
173
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
168
|
+
method="POST",
|
169
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
174
170
|
params=jsonable_encoder(
|
175
171
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
176
172
|
),
|
@@ -195,7 +191,7 @@ class DocumentIndexesClient:
|
|
195
191
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
196
192
|
)
|
197
193
|
if 200 <= _response.status_code < 300:
|
198
|
-
return
|
194
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
199
195
|
try:
|
200
196
|
_response_json = _response.json()
|
201
197
|
except JSONDecodeError:
|
@@ -221,8 +217,8 @@ class DocumentIndexesClient:
|
|
221
217
|
)
|
222
218
|
"""
|
223
219
|
_response = self._client_wrapper.httpx_client.request(
|
224
|
-
"GET",
|
225
|
-
urllib.parse.urljoin(
|
220
|
+
method="GET",
|
221
|
+
url=urllib.parse.urljoin(
|
226
222
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
227
223
|
),
|
228
224
|
params=jsonable_encoder(
|
@@ -243,7 +239,7 @@ class DocumentIndexesClient:
|
|
243
239
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
244
240
|
)
|
245
241
|
if 200 <= _response.status_code < 300:
|
246
|
-
return
|
242
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
247
243
|
try:
|
248
244
|
_response_json = _response.json()
|
249
245
|
except JSONDecodeError:
|
@@ -294,8 +290,8 @@ class DocumentIndexesClient:
|
|
294
290
|
if environment is not OMIT:
|
295
291
|
_request["environment"] = environment
|
296
292
|
_response = self._client_wrapper.httpx_client.request(
|
297
|
-
"PUT",
|
298
|
-
urllib.parse.urljoin(
|
293
|
+
method="PUT",
|
294
|
+
url=urllib.parse.urljoin(
|
299
295
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
300
296
|
),
|
301
297
|
params=jsonable_encoder(
|
@@ -322,7 +318,7 @@ class DocumentIndexesClient:
|
|
322
318
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
323
319
|
)
|
324
320
|
if 200 <= _response.status_code < 300:
|
325
|
-
return
|
321
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
326
322
|
try:
|
327
323
|
_response_json = _response.json()
|
328
324
|
except JSONDecodeError:
|
@@ -348,8 +344,8 @@ class DocumentIndexesClient:
|
|
348
344
|
)
|
349
345
|
"""
|
350
346
|
_response = self._client_wrapper.httpx_client.request(
|
351
|
-
"DELETE",
|
352
|
-
urllib.parse.urljoin(
|
347
|
+
method="DELETE",
|
348
|
+
url=urllib.parse.urljoin(
|
353
349
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
354
350
|
),
|
355
351
|
params=jsonable_encoder(
|
@@ -422,8 +418,8 @@ class DocumentIndexesClient:
|
|
422
418
|
if environment is not OMIT:
|
423
419
|
_request["environment"] = environment
|
424
420
|
_response = self._client_wrapper.httpx_client.request(
|
425
|
-
"PATCH",
|
426
|
-
urllib.parse.urljoin(
|
421
|
+
method="PATCH",
|
422
|
+
url=urllib.parse.urljoin(
|
427
423
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
428
424
|
),
|
429
425
|
params=jsonable_encoder(
|
@@ -450,7 +446,7 @@ class DocumentIndexesClient:
|
|
450
446
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
451
447
|
)
|
452
448
|
if 200 <= _response.status_code < 300:
|
453
|
-
return
|
449
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
454
450
|
try:
|
455
451
|
_response_json = _response.json()
|
456
452
|
except JSONDecodeError:
|
@@ -495,8 +491,8 @@ class AsyncDocumentIndexesClient:
|
|
495
491
|
await client.document_indexes.list()
|
496
492
|
"""
|
497
493
|
_response = await self._client_wrapper.httpx_client.request(
|
498
|
-
"GET",
|
499
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
494
|
+
method="GET",
|
495
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
500
496
|
params=jsonable_encoder(
|
501
497
|
remove_none_from_dict(
|
502
498
|
{
|
@@ -527,7 +523,7 @@ class AsyncDocumentIndexesClient:
|
|
527
523
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
528
524
|
)
|
529
525
|
if 200 <= _response.status_code < 300:
|
530
|
-
return
|
526
|
+
return pydantic_v1.parse_obj_as(PaginatedDocumentIndexReadList, _response.json()) # type: ignore
|
531
527
|
try:
|
532
528
|
_response_json = _response.json()
|
533
529
|
except JSONDecodeError:
|
@@ -603,8 +599,8 @@ class AsyncDocumentIndexesClient:
|
|
603
599
|
if copy_documents_from_index_id is not OMIT:
|
604
600
|
_request["copy_documents_from_index_id"] = copy_documents_from_index_id
|
605
601
|
_response = await self._client_wrapper.httpx_client.request(
|
606
|
-
"POST",
|
607
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
602
|
+
method="POST",
|
603
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/document-indexes"),
|
608
604
|
params=jsonable_encoder(
|
609
605
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
610
606
|
),
|
@@ -629,7 +625,7 @@ class AsyncDocumentIndexesClient:
|
|
629
625
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
630
626
|
)
|
631
627
|
if 200 <= _response.status_code < 300:
|
632
|
-
return
|
628
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
633
629
|
try:
|
634
630
|
_response_json = _response.json()
|
635
631
|
except JSONDecodeError:
|
@@ -655,8 +651,8 @@ class AsyncDocumentIndexesClient:
|
|
655
651
|
)
|
656
652
|
"""
|
657
653
|
_response = await self._client_wrapper.httpx_client.request(
|
658
|
-
"GET",
|
659
|
-
urllib.parse.urljoin(
|
654
|
+
method="GET",
|
655
|
+
url=urllib.parse.urljoin(
|
660
656
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
661
657
|
),
|
662
658
|
params=jsonable_encoder(
|
@@ -677,7 +673,7 @@ class AsyncDocumentIndexesClient:
|
|
677
673
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
678
674
|
)
|
679
675
|
if 200 <= _response.status_code < 300:
|
680
|
-
return
|
676
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
681
677
|
try:
|
682
678
|
_response_json = _response.json()
|
683
679
|
except JSONDecodeError:
|
@@ -728,8 +724,8 @@ class AsyncDocumentIndexesClient:
|
|
728
724
|
if environment is not OMIT:
|
729
725
|
_request["environment"] = environment
|
730
726
|
_response = await self._client_wrapper.httpx_client.request(
|
731
|
-
"PUT",
|
732
|
-
urllib.parse.urljoin(
|
727
|
+
method="PUT",
|
728
|
+
url=urllib.parse.urljoin(
|
733
729
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
734
730
|
),
|
735
731
|
params=jsonable_encoder(
|
@@ -756,7 +752,7 @@ class AsyncDocumentIndexesClient:
|
|
756
752
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
757
753
|
)
|
758
754
|
if 200 <= _response.status_code < 300:
|
759
|
-
return
|
755
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
760
756
|
try:
|
761
757
|
_response_json = _response.json()
|
762
758
|
except JSONDecodeError:
|
@@ -782,8 +778,8 @@ class AsyncDocumentIndexesClient:
|
|
782
778
|
)
|
783
779
|
"""
|
784
780
|
_response = await self._client_wrapper.httpx_client.request(
|
785
|
-
"DELETE",
|
786
|
-
urllib.parse.urljoin(
|
781
|
+
method="DELETE",
|
782
|
+
url=urllib.parse.urljoin(
|
787
783
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
788
784
|
),
|
789
785
|
params=jsonable_encoder(
|
@@ -856,8 +852,8 @@ class AsyncDocumentIndexesClient:
|
|
856
852
|
if environment is not OMIT:
|
857
853
|
_request["environment"] = environment
|
858
854
|
_response = await self._client_wrapper.httpx_client.request(
|
859
|
-
"PATCH",
|
860
|
-
urllib.parse.urljoin(
|
855
|
+
method="PATCH",
|
856
|
+
url=urllib.parse.urljoin(
|
861
857
|
f"{self._client_wrapper.get_environment().default}/", f"v1/document-indexes/{jsonable_encoder(id)}"
|
862
858
|
),
|
863
859
|
params=jsonable_encoder(
|
@@ -884,7 +880,7 @@ class AsyncDocumentIndexesClient:
|
|
884
880
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
885
881
|
)
|
886
882
|
if 200 <= _response.status_code < 300:
|
887
|
-
return
|
883
|
+
return pydantic_v1.parse_obj_as(DocumentIndexRead, _response.json()) # type: ignore
|
888
884
|
try:
|
889
885
|
_response_json = _response.json()
|
890
886
|
except JSONDecodeError:
|
@@ -1,17 +1,5 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
import enum
|
4
3
|
import typing
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
class DocumentIndexesListRequestStatus(str, enum.Enum):
|
10
|
-
ACTIVE = "ACTIVE"
|
11
|
-
ARCHIVED = "ARCHIVED"
|
12
|
-
|
13
|
-
def visit(self, active: typing.Callable[[], T_Result], archived: typing.Callable[[], T_Result]) -> T_Result:
|
14
|
-
if self is DocumentIndexesListRequestStatus.ACTIVE:
|
15
|
-
return active()
|
16
|
-
if self is DocumentIndexesListRequestStatus.ARCHIVED:
|
17
|
-
return archived()
|
5
|
+
DocumentIndexesListRequestStatus = typing.Union[typing.Literal["ACTIVE", "ARCHIVED"], typing.Any]
|
@@ -8,6 +8,7 @@ from ... import core
|
|
8
8
|
from ...core.api_error import ApiError
|
9
9
|
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
10
10
|
from ...core.jsonable_encoder import jsonable_encoder
|
11
|
+
from ...core.pydantic_utilities import pydantic_v1
|
11
12
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
12
13
|
from ...core.request_options import RequestOptions
|
13
14
|
from ...errors.bad_request_error import BadRequestError
|
@@ -18,11 +19,6 @@ from ...types.document_status import DocumentStatus
|
|
18
19
|
from ...types.paginated_slim_document_list import PaginatedSlimDocumentList
|
19
20
|
from ...types.upload_document_response import UploadDocumentResponse
|
20
21
|
|
21
|
-
try:
|
22
|
-
import pydantic.v1 as pydantic # type: ignore
|
23
|
-
except ImportError:
|
24
|
-
import pydantic # type: ignore
|
25
|
-
|
26
22
|
# this is used as the default value for optional parameters
|
27
23
|
OMIT = typing.cast(typing.Any, ...)
|
28
24
|
|
@@ -62,8 +58,8 @@ class DocumentsClient:
|
|
62
58
|
client.documents.list()
|
63
59
|
"""
|
64
60
|
_response = self._client_wrapper.httpx_client.request(
|
65
|
-
"GET",
|
66
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/documents"),
|
61
|
+
method="GET",
|
62
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/documents"),
|
67
63
|
params=jsonable_encoder(
|
68
64
|
remove_none_from_dict(
|
69
65
|
{
|
@@ -94,7 +90,55 @@ class DocumentsClient:
|
|
94
90
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
95
91
|
)
|
96
92
|
if 200 <= _response.status_code < 300:
|
97
|
-
return
|
93
|
+
return pydantic_v1.parse_obj_as(PaginatedSlimDocumentList, _response.json()) # type: ignore
|
94
|
+
try:
|
95
|
+
_response_json = _response.json()
|
96
|
+
except JSONDecodeError:
|
97
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
98
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
99
|
+
|
100
|
+
def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentRead:
|
101
|
+
"""
|
102
|
+
Retrieve a Document via its Vellum-generated ID.
|
103
|
+
|
104
|
+
Parameters:
|
105
|
+
- id: str. A UUID string identifying this document.
|
106
|
+
|
107
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
108
|
+
---
|
109
|
+
from vellum.client import Vellum
|
110
|
+
|
111
|
+
client = Vellum(
|
112
|
+
api_key="YOUR_API_KEY",
|
113
|
+
)
|
114
|
+
client.documents.retrieve(
|
115
|
+
id="id",
|
116
|
+
)
|
117
|
+
"""
|
118
|
+
_response = self._client_wrapper.httpx_client.request(
|
119
|
+
method="GET",
|
120
|
+
url=urllib.parse.urljoin(
|
121
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
122
|
+
),
|
123
|
+
params=jsonable_encoder(
|
124
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
125
|
+
),
|
126
|
+
headers=jsonable_encoder(
|
127
|
+
remove_none_from_dict(
|
128
|
+
{
|
129
|
+
**self._client_wrapper.get_headers(),
|
130
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
131
|
+
}
|
132
|
+
)
|
133
|
+
),
|
134
|
+
timeout=request_options.get("timeout_in_seconds")
|
135
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
136
|
+
else self._client_wrapper.get_timeout(),
|
137
|
+
retries=0,
|
138
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
139
|
+
)
|
140
|
+
if 200 <= _response.status_code < 300:
|
141
|
+
return pydantic_v1.parse_obj_as(DocumentRead, _response.json()) # type: ignore
|
98
142
|
try:
|
99
143
|
_response_json = _response.json()
|
100
144
|
except JSONDecodeError:
|
@@ -118,8 +162,8 @@ class DocumentsClient:
|
|
118
162
|
)
|
119
163
|
"""
|
120
164
|
_response = self._client_wrapper.httpx_client.request(
|
121
|
-
"DELETE",
|
122
|
-
urllib.parse.urljoin(
|
165
|
+
method="DELETE",
|
166
|
+
url=urllib.parse.urljoin(
|
123
167
|
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
124
168
|
),
|
125
169
|
params=jsonable_encoder(
|
@@ -188,8 +232,8 @@ class DocumentsClient:
|
|
188
232
|
if metadata is not OMIT:
|
189
233
|
_request["metadata"] = metadata
|
190
234
|
_response = self._client_wrapper.httpx_client.request(
|
191
|
-
"PATCH",
|
192
|
-
urllib.parse.urljoin(
|
235
|
+
method="PATCH",
|
236
|
+
url=urllib.parse.urljoin(
|
193
237
|
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
194
238
|
),
|
195
239
|
params=jsonable_encoder(
|
@@ -216,7 +260,7 @@ class DocumentsClient:
|
|
216
260
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
217
261
|
)
|
218
262
|
if 200 <= _response.status_code < 300:
|
219
|
-
return
|
263
|
+
return pydantic_v1.parse_obj_as(DocumentRead, _response.json()) # type: ignore
|
220
264
|
try:
|
221
265
|
_response_json = _response.json()
|
222
266
|
except JSONDecodeError:
|
@@ -267,11 +311,13 @@ class DocumentsClient:
|
|
267
311
|
client = Vellum(
|
268
312
|
api_key="YOUR_API_KEY",
|
269
313
|
)
|
270
|
-
client.documents.upload(
|
314
|
+
client.documents.upload(
|
315
|
+
label="label",
|
316
|
+
)
|
271
317
|
"""
|
272
318
|
_response = self._client_wrapper.httpx_client.request(
|
273
|
-
"POST",
|
274
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().documents}/", "v1/upload-document"),
|
319
|
+
method="POST",
|
320
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().documents}/", "v1/upload-document"),
|
275
321
|
params=jsonable_encoder(
|
276
322
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
277
323
|
),
|
@@ -317,13 +363,13 @@ class DocumentsClient:
|
|
317
363
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
318
364
|
)
|
319
365
|
if 200 <= _response.status_code < 300:
|
320
|
-
return
|
366
|
+
return pydantic_v1.parse_obj_as(UploadDocumentResponse, _response.json()) # type: ignore
|
321
367
|
if _response.status_code == 400:
|
322
|
-
raise BadRequestError(
|
368
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
323
369
|
if _response.status_code == 404:
|
324
|
-
raise NotFoundError(
|
370
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
325
371
|
if _response.status_code == 500:
|
326
|
-
raise InternalServerError(
|
372
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
327
373
|
try:
|
328
374
|
_response_json = _response.json()
|
329
375
|
except JSONDecodeError:
|
@@ -366,8 +412,8 @@ class AsyncDocumentsClient:
|
|
366
412
|
await client.documents.list()
|
367
413
|
"""
|
368
414
|
_response = await self._client_wrapper.httpx_client.request(
|
369
|
-
"GET",
|
370
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/documents"),
|
415
|
+
method="GET",
|
416
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().default}/", "v1/documents"),
|
371
417
|
params=jsonable_encoder(
|
372
418
|
remove_none_from_dict(
|
373
419
|
{
|
@@ -398,7 +444,55 @@ class AsyncDocumentsClient:
|
|
398
444
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
399
445
|
)
|
400
446
|
if 200 <= _response.status_code < 300:
|
401
|
-
return
|
447
|
+
return pydantic_v1.parse_obj_as(PaginatedSlimDocumentList, _response.json()) # type: ignore
|
448
|
+
try:
|
449
|
+
_response_json = _response.json()
|
450
|
+
except JSONDecodeError:
|
451
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
452
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
453
|
+
|
454
|
+
async def retrieve(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> DocumentRead:
|
455
|
+
"""
|
456
|
+
Retrieve a Document via its Vellum-generated ID.
|
457
|
+
|
458
|
+
Parameters:
|
459
|
+
- id: str. A UUID string identifying this document.
|
460
|
+
|
461
|
+
- request_options: typing.Optional[RequestOptions]. Request-specific configuration.
|
462
|
+
---
|
463
|
+
from vellum.client import AsyncVellum
|
464
|
+
|
465
|
+
client = AsyncVellum(
|
466
|
+
api_key="YOUR_API_KEY",
|
467
|
+
)
|
468
|
+
await client.documents.retrieve(
|
469
|
+
id="id",
|
470
|
+
)
|
471
|
+
"""
|
472
|
+
_response = await self._client_wrapper.httpx_client.request(
|
473
|
+
method="GET",
|
474
|
+
url=urllib.parse.urljoin(
|
475
|
+
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
476
|
+
),
|
477
|
+
params=jsonable_encoder(
|
478
|
+
request_options.get("additional_query_parameters") if request_options is not None else None
|
479
|
+
),
|
480
|
+
headers=jsonable_encoder(
|
481
|
+
remove_none_from_dict(
|
482
|
+
{
|
483
|
+
**self._client_wrapper.get_headers(),
|
484
|
+
**(request_options.get("additional_headers", {}) if request_options is not None else {}),
|
485
|
+
}
|
486
|
+
)
|
487
|
+
),
|
488
|
+
timeout=request_options.get("timeout_in_seconds")
|
489
|
+
if request_options is not None and request_options.get("timeout_in_seconds") is not None
|
490
|
+
else self._client_wrapper.get_timeout(),
|
491
|
+
retries=0,
|
492
|
+
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
493
|
+
)
|
494
|
+
if 200 <= _response.status_code < 300:
|
495
|
+
return pydantic_v1.parse_obj_as(DocumentRead, _response.json()) # type: ignore
|
402
496
|
try:
|
403
497
|
_response_json = _response.json()
|
404
498
|
except JSONDecodeError:
|
@@ -422,8 +516,8 @@ class AsyncDocumentsClient:
|
|
422
516
|
)
|
423
517
|
"""
|
424
518
|
_response = await self._client_wrapper.httpx_client.request(
|
425
|
-
"DELETE",
|
426
|
-
urllib.parse.urljoin(
|
519
|
+
method="DELETE",
|
520
|
+
url=urllib.parse.urljoin(
|
427
521
|
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
428
522
|
),
|
429
523
|
params=jsonable_encoder(
|
@@ -492,8 +586,8 @@ class AsyncDocumentsClient:
|
|
492
586
|
if metadata is not OMIT:
|
493
587
|
_request["metadata"] = metadata
|
494
588
|
_response = await self._client_wrapper.httpx_client.request(
|
495
|
-
"PATCH",
|
496
|
-
urllib.parse.urljoin(
|
589
|
+
method="PATCH",
|
590
|
+
url=urllib.parse.urljoin(
|
497
591
|
f"{self._client_wrapper.get_environment().default}/", f"v1/documents/{jsonable_encoder(id)}"
|
498
592
|
),
|
499
593
|
params=jsonable_encoder(
|
@@ -520,7 +614,7 @@ class AsyncDocumentsClient:
|
|
520
614
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
521
615
|
)
|
522
616
|
if 200 <= _response.status_code < 300:
|
523
|
-
return
|
617
|
+
return pydantic_v1.parse_obj_as(DocumentRead, _response.json()) # type: ignore
|
524
618
|
try:
|
525
619
|
_response_json = _response.json()
|
526
620
|
except JSONDecodeError:
|
@@ -571,11 +665,13 @@ class AsyncDocumentsClient:
|
|
571
665
|
client = AsyncVellum(
|
572
666
|
api_key="YOUR_API_KEY",
|
573
667
|
)
|
574
|
-
await client.documents.upload(
|
668
|
+
await client.documents.upload(
|
669
|
+
label="label",
|
670
|
+
)
|
575
671
|
"""
|
576
672
|
_response = await self._client_wrapper.httpx_client.request(
|
577
|
-
"POST",
|
578
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_environment().documents}/", "v1/upload-document"),
|
673
|
+
method="POST",
|
674
|
+
url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().documents}/", "v1/upload-document"),
|
579
675
|
params=jsonable_encoder(
|
580
676
|
request_options.get("additional_query_parameters") if request_options is not None else None
|
581
677
|
),
|
@@ -621,13 +717,13 @@ class AsyncDocumentsClient:
|
|
621
717
|
max_retries=request_options.get("max_retries") if request_options is not None else 0, # type: ignore
|
622
718
|
)
|
623
719
|
if 200 <= _response.status_code < 300:
|
624
|
-
return
|
720
|
+
return pydantic_v1.parse_obj_as(UploadDocumentResponse, _response.json()) # type: ignore
|
625
721
|
if _response.status_code == 400:
|
626
|
-
raise BadRequestError(
|
722
|
+
raise BadRequestError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
627
723
|
if _response.status_code == 404:
|
628
|
-
raise NotFoundError(
|
724
|
+
raise NotFoundError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
629
725
|
if _response.status_code == 500:
|
630
|
-
raise InternalServerError(
|
726
|
+
raise InternalServerError(pydantic_v1.parse_obj_as(typing.Any, _response.json())) # type: ignore
|
631
727
|
try:
|
632
728
|
_response_json = _response.json()
|
633
729
|
except JSONDecodeError:
|
@@ -44,8 +44,8 @@ class FolderEntitiesClient:
|
|
44
44
|
)
|
45
45
|
"""
|
46
46
|
_response = self._client_wrapper.httpx_client.request(
|
47
|
-
"POST",
|
48
|
-
urllib.parse.urljoin(
|
47
|
+
method="POST",
|
48
|
+
url=urllib.parse.urljoin(
|
49
49
|
f"{self._client_wrapper.get_environment().default}/",
|
50
50
|
f"v1/folders/{jsonable_encoder(folder_id)}/add-entity",
|
51
51
|
),
|
@@ -111,8 +111,8 @@ class AsyncFolderEntitiesClient:
|
|
111
111
|
)
|
112
112
|
"""
|
113
113
|
_response = await self._client_wrapper.httpx_client.request(
|
114
|
-
"POST",
|
115
|
-
urllib.parse.urljoin(
|
114
|
+
method="POST",
|
115
|
+
url=urllib.parse.urljoin(
|
116
116
|
f"{self._client_wrapper.get_environment().default}/",
|
117
117
|
f"v1/folders/{jsonable_encoder(folder_id)}/add-entity",
|
118
118
|
),
|