vellum-ai 1.1.3__py3-none-any.whl → 1.1.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vellum/__init__.py +2 -0
- vellum/client/README.md +22 -0
- vellum/client/__init__.py +89 -99
- vellum/client/core/__init__.py +2 -0
- vellum/client/core/api_error.py +13 -5
- vellum/client/core/client_wrapper.py +16 -4
- vellum/client/core/force_multipart.py +16 -0
- vellum/client/core/http_client.py +70 -24
- vellum/client/core/http_response.py +19 -11
- vellum/client/core/pydantic_utilities.py +71 -114
- vellum/client/core/serialization.py +6 -1
- vellum/client/errors/__init__.py +2 -0
- vellum/client/errors/bad_request_error.py +4 -3
- vellum/client/errors/forbidden_error.py +4 -3
- vellum/client/errors/internal_server_error.py +4 -3
- vellum/client/errors/not_found_error.py +4 -3
- vellum/client/raw_client.py +270 -201
- vellum/client/resources/__init__.py +2 -0
- vellum/client/resources/ad_hoc/__init__.py +2 -0
- vellum/client/resources/ad_hoc/client.py +16 -17
- vellum/client/resources/ad_hoc/raw_client.py +68 -53
- vellum/client/resources/container_images/__init__.py +2 -0
- vellum/client/resources/container_images/client.py +24 -21
- vellum/client/resources/container_images/raw_client.py +23 -24
- vellum/client/resources/deployments/__init__.py +2 -0
- vellum/client/resources/deployments/client.py +43 -44
- vellum/client/resources/deployments/raw_client.py +73 -66
- vellum/client/resources/deployments/types/__init__.py +2 -0
- vellum/client/resources/document_indexes/__init__.py +2 -0
- vellum/client/resources/document_indexes/client.py +38 -39
- vellum/client/resources/document_indexes/raw_client.py +42 -43
- vellum/client/resources/document_indexes/types/__init__.py +2 -0
- vellum/client/resources/documents/__init__.py +2 -0
- vellum/client/resources/documents/client.py +25 -26
- vellum/client/resources/documents/raw_client.py +51 -44
- vellum/client/resources/folder_entities/__init__.py +2 -0
- vellum/client/resources/folder_entities/client.py +12 -13
- vellum/client/resources/folder_entities/raw_client.py +15 -16
- vellum/client/resources/folder_entities/types/__init__.py +2 -0
- vellum/client/resources/metric_definitions/__init__.py +2 -0
- vellum/client/resources/metric_definitions/client.py +12 -13
- vellum/client/resources/metric_definitions/raw_client.py +17 -18
- vellum/client/resources/ml_models/__init__.py +2 -0
- vellum/client/resources/ml_models/client.py +7 -8
- vellum/client/resources/ml_models/raw_client.py +11 -12
- vellum/client/resources/organizations/__init__.py +2 -0
- vellum/client/resources/organizations/client.py +7 -8
- vellum/client/resources/organizations/raw_client.py +10 -11
- vellum/client/resources/prompts/__init__.py +2 -0
- vellum/client/resources/prompts/client.py +13 -12
- vellum/client/resources/prompts/raw_client.py +40 -33
- vellum/client/resources/sandboxes/__init__.py +2 -0
- vellum/client/resources/sandboxes/client.py +15 -16
- vellum/client/resources/sandboxes/raw_client.py +20 -21
- vellum/client/resources/test_suite_runs/__init__.py +2 -0
- vellum/client/resources/test_suite_runs/client.py +17 -18
- vellum/client/resources/test_suite_runs/raw_client.py +20 -21
- vellum/client/resources/test_suites/__init__.py +2 -0
- vellum/client/resources/test_suites/client.py +20 -19
- vellum/client/resources/test_suites/raw_client.py +46 -31
- vellum/client/resources/workflow_deployments/__init__.py +2 -0
- vellum/client/resources/workflow_deployments/client.py +45 -46
- vellum/client/resources/workflow_deployments/raw_client.py +48 -49
- vellum/client/resources/workflow_deployments/types/__init__.py +2 -0
- vellum/client/resources/workflow_executions/__init__.py +2 -0
- vellum/client/resources/workflow_executions/client.py +7 -8
- vellum/client/resources/workflow_executions/raw_client.py +11 -12
- vellum/client/resources/workflow_sandboxes/__init__.py +2 -0
- vellum/client/resources/workflow_sandboxes/client.py +12 -13
- vellum/client/resources/workflow_sandboxes/raw_client.py +16 -17
- vellum/client/resources/workflow_sandboxes/types/__init__.py +2 -0
- vellum/client/resources/workflows/__init__.py +2 -0
- vellum/client/resources/workflows/client.py +11 -12
- vellum/client/resources/workflows/raw_client.py +34 -27
- vellum/client/resources/workspace_secrets/__init__.py +2 -0
- vellum/client/resources/workspace_secrets/client.py +11 -12
- vellum/client/resources/workspace_secrets/raw_client.py +15 -16
- vellum/client/resources/workspaces/__init__.py +2 -0
- vellum/client/resources/workspaces/client.py +7 -8
- vellum/client/resources/workspaces/raw_client.py +10 -11
- vellum/client/types/__init__.py +2 -0
- vellum/client/types/ad_hoc_execute_prompt_event.py +3 -2
- vellum/client/types/ad_hoc_expand_meta.py +2 -2
- vellum/client/types/ad_hoc_fulfilled_prompt_execution_meta.py +3 -3
- vellum/client/types/ad_hoc_initiated_prompt_execution_meta.py +2 -2
- vellum/client/types/ad_hoc_rejected_prompt_execution_meta.py +3 -3
- vellum/client/types/ad_hoc_streaming_prompt_execution_meta.py +2 -2
- vellum/client/types/api_node_result.py +3 -3
- vellum/client/types/api_node_result_data.py +4 -4
- vellum/client/types/api_request_parent_context.py +11 -11
- vellum/client/types/array_chat_message_content.py +3 -3
- vellum/client/types/array_chat_message_content_item.py +5 -4
- vellum/client/types/array_chat_message_content_item_request.py +5 -4
- vellum/client/types/array_chat_message_content_request.py +3 -3
- vellum/client/types/array_input.py +12 -6
- vellum/client/types/array_vellum_value.py +4 -4
- vellum/client/types/array_vellum_value_request.py +4 -4
- vellum/client/types/audio_chat_message_content.py +3 -3
- vellum/client/types/audio_chat_message_content_request.py +3 -3
- vellum/client/types/audio_prompt_block.py +4 -4
- vellum/client/types/audio_vellum_value.py +3 -3
- vellum/client/types/audio_vellum_value_request.py +3 -3
- vellum/client/types/base_output.py +2 -2
- vellum/client/types/basic_vectorizer_intfloat_multilingual_e_5_large.py +2 -2
- vellum/client/types/basic_vectorizer_intfloat_multilingual_e_5_large_request.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1_request.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1.py +2 -2
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1_request.py +2 -2
- vellum/client/types/chat_history_input.py +3 -3
- vellum/client/types/chat_history_input_request.py +3 -3
- vellum/client/types/chat_history_vellum_value.py +3 -3
- vellum/client/types/chat_history_vellum_value_request.py +3 -3
- vellum/client/types/chat_message.py +4 -4
- vellum/client/types/chat_message_content.py +5 -4
- vellum/client/types/chat_message_content_request.py +5 -4
- vellum/client/types/chat_message_prompt_block.py +7 -7
- vellum/client/types/chat_message_request.py +4 -4
- vellum/client/types/code_execution_node_array_result.py +11 -5
- vellum/client/types/code_execution_node_chat_history_result.py +3 -3
- vellum/client/types/code_execution_node_error_result.py +3 -3
- vellum/client/types/code_execution_node_function_call_result.py +3 -3
- vellum/client/types/code_execution_node_json_result.py +2 -2
- vellum/client/types/code_execution_node_number_result.py +2 -2
- vellum/client/types/code_execution_node_result.py +10 -4
- vellum/client/types/code_execution_node_result_data.py +10 -4
- vellum/client/types/code_execution_node_result_output.py +6 -5
- vellum/client/types/code_execution_node_search_results_result.py +3 -3
- vellum/client/types/code_execution_node_string_result.py +2 -2
- vellum/client/types/code_execution_package.py +2 -2
- vellum/client/types/code_executor_input.py +7 -6
- vellum/client/types/code_executor_response.py +11 -5
- vellum/client/types/code_executor_secret_input.py +3 -3
- vellum/client/types/code_resource_definition.py +3 -3
- vellum/client/types/compile_prompt_deployment_expand_meta_request.py +2 -2
- vellum/client/types/compile_prompt_meta.py +2 -2
- vellum/client/types/conditional_node_result.py +3 -3
- vellum/client/types/conditional_node_result_data.py +2 -2
- vellum/client/types/container_image_build_config.py +3 -3
- vellum/client/types/container_image_container_image_tag.py +2 -2
- vellum/client/types/container_image_read.py +5 -5
- vellum/client/types/create_test_suite_test_case_request.py +9 -3
- vellum/client/types/deployment_history_item.py +10 -4
- vellum/client/types/deployment_provider_payload_response.py +4 -4
- vellum/client/types/deployment_read.py +10 -4
- vellum/client/types/deployment_release_tag_deployment_history_item.py +2 -2
- vellum/client/types/deployment_release_tag_read.py +4 -4
- vellum/client/types/docker_service_token.py +2 -2
- vellum/client/types/document_chat_message_content.py +3 -3
- vellum/client/types/document_chat_message_content_request.py +3 -3
- vellum/client/types/document_document_to_document_index.py +3 -3
- vellum/client/types/document_index_chunking.py +1 -0
- vellum/client/types/document_index_chunking_request.py +1 -0
- vellum/client/types/document_index_indexing_config.py +4 -4
- vellum/client/types/document_index_indexing_config_request.py +4 -4
- vellum/client/types/document_index_read.py +4 -4
- vellum/client/types/document_prompt_block.py +4 -4
- vellum/client/types/document_read.py +4 -4
- vellum/client/types/document_vellum_value.py +3 -3
- vellum/client/types/document_vellum_value_request.py +3 -3
- vellum/client/types/enriched_normalized_completion.py +3 -3
- vellum/client/types/ephemeral_prompt_cache_config.py +3 -3
- vellum/client/types/error_input.py +3 -3
- vellum/client/types/error_vellum_value.py +3 -3
- vellum/client/types/error_vellum_value_request.py +3 -3
- vellum/client/types/execute_api_request_bearer_token.py +1 -0
- vellum/client/types/execute_api_request_headers_value.py +1 -0
- vellum/client/types/execute_api_response.py +5 -5
- vellum/client/types/execute_prompt_event.py +3 -2
- vellum/client/types/execute_prompt_response.py +1 -0
- vellum/client/types/execute_workflow_response.py +10 -4
- vellum/client/types/execute_workflow_workflow_result_event.py +1 -0
- vellum/client/types/execution_array_vellum_value.py +12 -6
- vellum/client/types/execution_chat_history_vellum_value.py +3 -3
- vellum/client/types/execution_error_vellum_value.py +3 -3
- vellum/client/types/execution_function_call_vellum_value.py +3 -3
- vellum/client/types/execution_json_vellum_value.py +3 -3
- vellum/client/types/execution_number_vellum_value.py +3 -3
- vellum/client/types/execution_search_results_vellum_value.py +3 -3
- vellum/client/types/execution_string_vellum_value.py +3 -3
- vellum/client/types/execution_thinking_vellum_value.py +3 -3
- vellum/client/types/execution_vellum_value.py +6 -5
- vellum/client/types/external_input_descriptor.py +3 -3
- vellum/client/types/external_parent_context.py +11 -11
- vellum/client/types/external_test_case_execution.py +10 -4
- vellum/client/types/external_test_case_execution_request.py +10 -4
- vellum/client/types/fast_embed_vectorizer_baai_bge_small_en_v_15.py +2 -2
- vellum/client/types/fast_embed_vectorizer_baai_bge_small_en_v_15_request.py +2 -2
- vellum/client/types/folder_entity.py +4 -3
- vellum/client/types/folder_entity_dataset.py +3 -3
- vellum/client/types/folder_entity_dataset_data.py +3 -3
- vellum/client/types/folder_entity_document_index.py +3 -3
- vellum/client/types/folder_entity_document_index_data.py +4 -4
- vellum/client/types/folder_entity_folder.py +3 -3
- vellum/client/types/folder_entity_folder_data.py +2 -2
- vellum/client/types/folder_entity_prompt_sandbox.py +3 -3
- vellum/client/types/folder_entity_prompt_sandbox_data.py +3 -3
- vellum/client/types/folder_entity_test_suite.py +3 -3
- vellum/client/types/folder_entity_test_suite_data.py +3 -3
- vellum/client/types/folder_entity_workflow_sandbox.py +3 -3
- vellum/client/types/folder_entity_workflow_sandbox_data.py +3 -3
- vellum/client/types/fulfilled_ad_hoc_execute_prompt_event.py +4 -4
- vellum/client/types/fulfilled_execute_prompt_event.py +4 -4
- vellum/client/types/fulfilled_execute_prompt_response.py +3 -3
- vellum/client/types/fulfilled_execute_workflow_workflow_result_event.py +11 -5
- vellum/client/types/fulfilled_prompt_execution_meta.py +3 -3
- vellum/client/types/fulfilled_workflow_node_result_event.py +12 -6
- vellum/client/types/function_call.py +2 -2
- vellum/client/types/function_call_chat_message_content.py +3 -3
- vellum/client/types/function_call_chat_message_content_request.py +3 -3
- vellum/client/types/function_call_chat_message_content_value.py +2 -2
- vellum/client/types/function_call_chat_message_content_value_request.py +2 -2
- vellum/client/types/function_call_input.py +3 -3
- vellum/client/types/function_call_prompt_block.py +4 -4
- vellum/client/types/function_call_request.py +2 -2
- vellum/client/types/function_call_vellum_value.py +3 -3
- vellum/client/types/function_call_vellum_value_request.py +3 -3
- vellum/client/types/function_definition.py +4 -4
- vellum/client/types/generate_options_request.py +3 -3
- vellum/client/types/generate_request.py +2 -2
- vellum/client/types/generate_response.py +3 -3
- vellum/client/types/generate_result.py +3 -3
- vellum/client/types/generate_result_data.py +3 -3
- vellum/client/types/generate_result_error.py +3 -3
- vellum/client/types/generate_stream_response.py +3 -3
- vellum/client/types/generate_stream_result.py +4 -4
- vellum/client/types/generate_stream_result_data.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_config.py +2 -2
- vellum/client/types/google_vertex_ai_vectorizer_config_request.py +2 -2
- vellum/client/types/google_vertex_ai_vectorizer_gemini_embedding_001.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_gemini_embedding_001_request.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_embedding_004.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_embedding_004_request.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002.py +3 -3
- vellum/client/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002_request.py +3 -3
- vellum/client/types/hkunlp_instructor_xl_vectorizer.py +3 -3
- vellum/client/types/hkunlp_instructor_xl_vectorizer_request.py +3 -3
- vellum/client/types/image_chat_message_content.py +3 -3
- vellum/client/types/image_chat_message_content_request.py +3 -3
- vellum/client/types/image_prompt_block.py +4 -4
- vellum/client/types/image_vellum_value.py +3 -3
- vellum/client/types/image_vellum_value_request.py +3 -3
- vellum/client/types/indexing_config_vectorizer.py +7 -6
- vellum/client/types/indexing_config_vectorizer_request.py +7 -6
- vellum/client/types/initiated_ad_hoc_execute_prompt_event.py +3 -3
- vellum/client/types/initiated_execute_prompt_event.py +3 -3
- vellum/client/types/initiated_prompt_execution_meta.py +2 -2
- vellum/client/types/initiated_workflow_node_result_event.py +12 -6
- vellum/client/types/instructor_vectorizer_config.py +2 -2
- vellum/client/types/instructor_vectorizer_config_request.py +2 -2
- vellum/client/types/invoked_port.py +2 -2
- vellum/client/types/jinja_prompt_block.py +4 -4
- vellum/client/types/json_input.py +3 -3
- vellum/client/types/json_input_request.py +3 -3
- vellum/client/types/json_vellum_value.py +2 -2
- vellum/client/types/json_vellum_value_request.py +2 -2
- vellum/client/types/map_node_result.py +3 -3
- vellum/client/types/map_node_result_data.py +3 -3
- vellum/client/types/merge_node_result.py +3 -3
- vellum/client/types/merge_node_result_data.py +2 -2
- vellum/client/types/metadata_filter_config_request.py +12 -6
- vellum/client/types/metadata_filter_rule_request.py +5 -5
- vellum/client/types/metadata_filters_request.py +1 -0
- vellum/client/types/metric_definition_execution.py +10 -4
- vellum/client/types/metric_definition_history_item.py +10 -4
- vellum/client/types/metric_definition_input.py +3 -2
- vellum/client/types/metric_node_result.py +2 -2
- vellum/client/types/ml_model_read.py +6 -3
- vellum/client/types/ml_model_usage.py +2 -2
- vellum/client/types/ml_model_usage_wrapper.py +3 -3
- vellum/client/types/named_scenario_input_chat_history_variable_value_request.py +3 -3
- vellum/client/types/named_scenario_input_json_variable_value_request.py +2 -2
- vellum/client/types/named_scenario_input_request.py +3 -2
- vellum/client/types/named_scenario_input_string_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_array_variable_value.py +11 -5
- vellum/client/types/named_test_case_array_variable_value_request.py +11 -5
- vellum/client/types/named_test_case_chat_history_variable_value.py +3 -3
- vellum/client/types/named_test_case_chat_history_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_error_variable_value.py +3 -3
- vellum/client/types/named_test_case_error_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_function_call_variable_value.py +3 -3
- vellum/client/types/named_test_case_function_call_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_json_variable_value.py +2 -2
- vellum/client/types/named_test_case_json_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_number_variable_value.py +2 -2
- vellum/client/types/named_test_case_number_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_search_results_variable_value.py +3 -3
- vellum/client/types/named_test_case_search_results_variable_value_request.py +3 -3
- vellum/client/types/named_test_case_string_variable_value.py +2 -2
- vellum/client/types/named_test_case_string_variable_value_request.py +2 -2
- vellum/client/types/named_test_case_variable_value.py +6 -5
- vellum/client/types/named_test_case_variable_value_request.py +6 -5
- vellum/client/types/node_execution_fulfilled_body.py +4 -4
- vellum/client/types/node_execution_fulfilled_event.py +22 -16
- vellum/client/types/node_execution_initiated_body.py +3 -3
- vellum/client/types/node_execution_initiated_event.py +22 -16
- vellum/client/types/node_execution_paused_body.py +3 -3
- vellum/client/types/node_execution_paused_event.py +22 -16
- vellum/client/types/node_execution_rejected_body.py +4 -4
- vellum/client/types/node_execution_rejected_event.py +22 -16
- vellum/client/types/node_execution_resumed_body.py +3 -3
- vellum/client/types/node_execution_resumed_event.py +22 -16
- vellum/client/types/node_execution_span.py +19 -13
- vellum/client/types/node_execution_span_attributes.py +2 -2
- vellum/client/types/node_execution_streaming_body.py +4 -4
- vellum/client/types/node_execution_streaming_event.py +22 -16
- vellum/client/types/node_input_compiled_array_value.py +11 -5
- vellum/client/types/node_input_compiled_chat_history_value.py +3 -3
- vellum/client/types/node_input_compiled_error_value.py +3 -3
- vellum/client/types/node_input_compiled_function_call_value.py +3 -3
- vellum/client/types/node_input_compiled_json_value.py +2 -2
- vellum/client/types/node_input_compiled_number_value.py +2 -2
- vellum/client/types/node_input_compiled_search_results_value.py +3 -3
- vellum/client/types/node_input_compiled_secret_value.py +3 -3
- vellum/client/types/node_input_compiled_string_value.py +2 -2
- vellum/client/types/node_input_variable_compiled_value.py +6 -5
- vellum/client/types/node_output_compiled_array_value.py +12 -6
- vellum/client/types/node_output_compiled_chat_history_value.py +3 -3
- vellum/client/types/node_output_compiled_error_value.py +3 -3
- vellum/client/types/node_output_compiled_function_call_value.py +3 -3
- vellum/client/types/node_output_compiled_json_value.py +3 -3
- vellum/client/types/node_output_compiled_number_value.py +3 -3
- vellum/client/types/node_output_compiled_search_results_value.py +3 -3
- vellum/client/types/node_output_compiled_string_value.py +3 -3
- vellum/client/types/node_output_compiled_thinking_value.py +3 -3
- vellum/client/types/node_output_compiled_value.py +6 -5
- vellum/client/types/node_parent_context.py +12 -12
- vellum/client/types/normalized_log_probs.py +3 -3
- vellum/client/types/normalized_token_log_probs.py +2 -2
- vellum/client/types/number_input.py +3 -3
- vellum/client/types/number_vellum_value.py +2 -2
- vellum/client/types/number_vellum_value_request.py +2 -2
- vellum/client/types/open_ai_vectorizer_config.py +3 -3
- vellum/client/types/open_ai_vectorizer_config_request.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_large.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_large_request.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_small.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_3_small_request.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_ada_002.py +3 -3
- vellum/client/types/open_ai_vectorizer_text_embedding_ada_002_request.py +3 -3
- vellum/client/types/organization_read.py +4 -4
- vellum/client/types/paginated_container_image_read_list.py +3 -3
- vellum/client/types/paginated_deployment_release_tag_read_list.py +3 -3
- vellum/client/types/paginated_document_index_read_list.py +3 -3
- vellum/client/types/paginated_folder_entity_list.py +3 -3
- vellum/client/types/paginated_slim_deployment_read_list.py +10 -4
- vellum/client/types/paginated_slim_document_list.py +3 -3
- vellum/client/types/paginated_slim_workflow_deployment_list.py +10 -4
- vellum/client/types/paginated_test_suite_run_execution_list.py +10 -4
- vellum/client/types/paginated_test_suite_test_case_list.py +10 -4
- vellum/client/types/paginated_workflow_release_tag_read_list.py +3 -3
- vellum/client/types/paginated_workflow_sandbox_example_list.py +3 -3
- vellum/client/types/parent_context.py +5 -5
- vellum/client/types/pdf_search_result_meta_source.py +2 -2
- vellum/client/types/pdf_search_result_meta_source_request.py +2 -2
- vellum/client/types/plain_text_prompt_block.py +4 -4
- vellum/client/types/price.py +3 -3
- vellum/client/types/prompt_block.py +7 -6
- vellum/client/types/prompt_deployment_expand_meta_request.py +2 -2
- vellum/client/types/prompt_deployment_input_request.py +3 -2
- vellum/client/types/prompt_deployment_parent_context.py +11 -11
- vellum/client/types/prompt_deployment_release.py +6 -6
- vellum/client/types/prompt_deployment_release_prompt_deployment.py +2 -2
- vellum/client/types/prompt_deployment_release_prompt_version.py +4 -4
- vellum/client/types/prompt_exec_config.py +15 -9
- vellum/client/types/prompt_execution_meta.py +3 -3
- vellum/client/types/prompt_node_execution_meta.py +3 -3
- vellum/client/types/prompt_node_result.py +3 -3
- vellum/client/types/prompt_node_result_data.py +3 -3
- vellum/client/types/prompt_output.py +3 -2
- vellum/client/types/prompt_parameters.py +2 -2
- vellum/client/types/prompt_push_response.py +2 -2
- vellum/client/types/prompt_request_chat_history_input.py +3 -3
- vellum/client/types/prompt_request_input.py +3 -2
- vellum/client/types/prompt_request_json_input.py +3 -3
- vellum/client/types/prompt_request_string_input.py +3 -3
- vellum/client/types/prompt_settings.py +2 -2
- vellum/client/types/prompt_version_build_config_sandbox.py +2 -2
- vellum/client/types/raw_prompt_execution_overrides_request.py +2 -2
- vellum/client/types/reducto_chunker_config.py +2 -2
- vellum/client/types/reducto_chunker_config_request.py +2 -2
- vellum/client/types/reducto_chunking.py +3 -3
- vellum/client/types/reducto_chunking_request.py +3 -3
- vellum/client/types/rejected_ad_hoc_execute_prompt_event.py +4 -4
- vellum/client/types/rejected_execute_prompt_event.py +4 -4
- vellum/client/types/rejected_execute_prompt_response.py +3 -3
- vellum/client/types/rejected_execute_workflow_workflow_result_event.py +4 -4
- vellum/client/types/rejected_prompt_execution_meta.py +3 -3
- vellum/client/types/rejected_workflow_node_result_event.py +12 -6
- vellum/client/types/release_created_by.py +2 -2
- vellum/client/types/release_environment.py +2 -2
- vellum/client/types/release_release_tag.py +3 -3
- vellum/client/types/release_review_reviewer.py +2 -2
- vellum/client/types/release_tag_release.py +2 -2
- vellum/client/types/replace_test_suite_test_case_request.py +9 -3
- vellum/client/types/rich_text_child_block.py +2 -1
- vellum/client/types/rich_text_prompt_block.py +4 -4
- vellum/client/types/sandbox_scenario.py +3 -3
- vellum/client/types/scenario_input.py +3 -2
- vellum/client/types/scenario_input_chat_history_variable_value.py +3 -3
- vellum/client/types/scenario_input_json_variable_value.py +2 -2
- vellum/client/types/scenario_input_string_variable_value.py +2 -2
- vellum/client/types/search_filters_request.py +11 -5
- vellum/client/types/search_node_result.py +3 -3
- vellum/client/types/search_node_result_data.py +3 -3
- vellum/client/types/search_request_options_request.py +13 -7
- vellum/client/types/search_response.py +3 -3
- vellum/client/types/search_result.py +3 -3
- vellum/client/types/search_result_document.py +2 -2
- vellum/client/types/search_result_document_request.py +2 -2
- vellum/client/types/search_result_merging_request.py +2 -2
- vellum/client/types/search_result_meta.py +3 -3
- vellum/client/types/search_result_meta_request.py +3 -3
- vellum/client/types/search_result_request.py +3 -3
- vellum/client/types/search_results_input.py +3 -3
- vellum/client/types/search_results_vellum_value.py +3 -3
- vellum/client/types/search_results_vellum_value_request.py +3 -3
- vellum/client/types/search_weights_request.py +2 -2
- vellum/client/types/sentence_chunker_config.py +2 -2
- vellum/client/types/sentence_chunker_config_request.py +2 -2
- vellum/client/types/sentence_chunking.py +3 -3
- vellum/client/types/sentence_chunking_request.py +3 -3
- vellum/client/types/slim_deployment_read.py +10 -4
- vellum/client/types/slim_document.py +5 -5
- vellum/client/types/slim_document_document_to_document_index.py +3 -3
- vellum/client/types/slim_release_review.py +4 -4
- vellum/client/types/slim_workflow_deployment.py +11 -5
- vellum/client/types/slim_workflow_execution_read.py +21 -15
- vellum/client/types/span_link.py +12 -12
- vellum/client/types/streaming_ad_hoc_execute_prompt_event.py +4 -4
- vellum/client/types/streaming_execute_prompt_event.py +3 -3
- vellum/client/types/streaming_prompt_execution_meta.py +2 -2
- vellum/client/types/streaming_workflow_node_result_event.py +12 -6
- vellum/client/types/string_chat_message_content.py +2 -2
- vellum/client/types/string_chat_message_content_request.py +2 -2
- vellum/client/types/string_input.py +3 -3
- vellum/client/types/string_input_request.py +3 -3
- vellum/client/types/string_vellum_value.py +2 -2
- vellum/client/types/string_vellum_value_request.py +2 -2
- vellum/client/types/submit_completion_actual_request.py +3 -3
- vellum/client/types/submit_workflow_execution_actual_request.py +3 -2
- vellum/client/types/subworkflow_node_result.py +3 -3
- vellum/client/types/subworkflow_node_result_data.py +2 -2
- vellum/client/types/templating_node_array_result.py +11 -5
- vellum/client/types/templating_node_chat_history_result.py +3 -3
- vellum/client/types/templating_node_error_result.py +3 -3
- vellum/client/types/templating_node_function_call_result.py +3 -3
- vellum/client/types/templating_node_json_result.py +2 -2
- vellum/client/types/templating_node_number_result.py +2 -2
- vellum/client/types/templating_node_result.py +10 -4
- vellum/client/types/templating_node_result_data.py +10 -4
- vellum/client/types/templating_node_result_output.py +6 -5
- vellum/client/types/templating_node_search_results_result.py +3 -3
- vellum/client/types/templating_node_string_result.py +2 -2
- vellum/client/types/terminal_node_array_result.py +11 -5
- vellum/client/types/terminal_node_chat_history_result.py +2 -2
- vellum/client/types/terminal_node_error_result.py +2 -2
- vellum/client/types/terminal_node_function_call_result.py +2 -2
- vellum/client/types/terminal_node_json_result.py +2 -2
- vellum/client/types/terminal_node_number_result.py +2 -2
- vellum/client/types/terminal_node_result.py +10 -4
- vellum/client/types/terminal_node_result_data.py +10 -4
- vellum/client/types/terminal_node_result_output.py +6 -5
- vellum/client/types/terminal_node_search_results_result.py +2 -2
- vellum/client/types/terminal_node_string_result.py +2 -2
- vellum/client/types/test_case_array_variable_value.py +11 -5
- vellum/client/types/test_case_chat_history_variable_value.py +3 -3
- vellum/client/types/test_case_error_variable_value.py +3 -3
- vellum/client/types/test_case_function_call_variable_value.py +3 -3
- vellum/client/types/test_case_json_variable_value.py +2 -2
- vellum/client/types/test_case_number_variable_value.py +2 -2
- vellum/client/types/test_case_search_results_variable_value.py +3 -3
- vellum/client/types/test_case_string_variable_value.py +2 -2
- vellum/client/types/test_case_variable_value.py +6 -5
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config.py +3 -3
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_exec_config.py +2 -1
- vellum/client/types/test_suite_run_exec_config_request.py +2 -1
- vellum/client/types/test_suite_run_execution.py +11 -5
- vellum/client/types/test_suite_run_execution_array_output.py +11 -5
- vellum/client/types/test_suite_run_execution_chat_history_output.py +3 -3
- vellum/client/types/test_suite_run_execution_error_output.py +3 -3
- vellum/client/types/test_suite_run_execution_function_call_output.py +3 -3
- vellum/client/types/test_suite_run_execution_json_output.py +2 -2
- vellum/client/types/test_suite_run_execution_metric_definition.py +2 -2
- vellum/client/types/test_suite_run_execution_metric_result.py +11 -5
- vellum/client/types/test_suite_run_execution_number_output.py +2 -2
- vellum/client/types/test_suite_run_execution_output.py +6 -5
- vellum/client/types/test_suite_run_execution_search_results_output.py +3 -3
- vellum/client/types/test_suite_run_execution_string_output.py +2 -2
- vellum/client/types/test_suite_run_external_exec_config.py +10 -4
- vellum/client/types/test_suite_run_external_exec_config_data.py +10 -4
- vellum/client/types/test_suite_run_external_exec_config_data_request.py +10 -4
- vellum/client/types/test_suite_run_external_exec_config_request.py +10 -4
- vellum/client/types/test_suite_run_metric_array_output.py +11 -5
- vellum/client/types/test_suite_run_metric_error_output.py +3 -3
- vellum/client/types/test_suite_run_metric_json_output.py +2 -2
- vellum/client/types/test_suite_run_metric_number_output.py +2 -2
- vellum/client/types/test_suite_run_metric_output.py +5 -4
- vellum/client/types/test_suite_run_metric_string_output.py +2 -2
- vellum/client/types/test_suite_run_progress.py +2 -2
- vellum/client/types/test_suite_run_prompt_sandbox_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_read.py +12 -6
- vellum/client/types/test_suite_run_test_suite.py +2 -2
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config.py +3 -3
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_exec_config_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -3
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -3
- vellum/client/types/test_suite_test_case.py +10 -4
- vellum/client/types/test_suite_test_case_bulk_operation_request.py +2 -1
- vellum/client/types/test_suite_test_case_bulk_result.py +2 -1
- vellum/client/types/test_suite_test_case_create_bulk_operation_request.py +10 -4
- vellum/client/types/test_suite_test_case_created_bulk_result.py +3 -3
- vellum/client/types/test_suite_test_case_created_bulk_result_data.py +2 -2
- vellum/client/types/test_suite_test_case_delete_bulk_operation_data_request.py +2 -2
- vellum/client/types/test_suite_test_case_delete_bulk_operation_request.py +3 -3
- vellum/client/types/test_suite_test_case_deleted_bulk_result.py +3 -3
- vellum/client/types/test_suite_test_case_deleted_bulk_result_data.py +2 -2
- vellum/client/types/test_suite_test_case_rejected_bulk_result.py +2 -2
- vellum/client/types/test_suite_test_case_replace_bulk_operation_request.py +10 -4
- vellum/client/types/test_suite_test_case_replaced_bulk_result.py +3 -3
- vellum/client/types/test_suite_test_case_replaced_bulk_result_data.py +2 -2
- vellum/client/types/test_suite_test_case_upsert_bulk_operation_request.py +10 -4
- vellum/client/types/thinking_vellum_value.py +3 -3
- vellum/client/types/thinking_vellum_value_request.py +3 -3
- vellum/client/types/token_overlapping_window_chunker_config.py +2 -2
- vellum/client/types/token_overlapping_window_chunker_config_request.py +2 -2
- vellum/client/types/token_overlapping_window_chunking.py +3 -3
- vellum/client/types/token_overlapping_window_chunking_request.py +3 -3
- vellum/client/types/upload_document_response.py +3 -3
- vellum/client/types/upsert_test_suite_test_case_request.py +9 -3
- vellum/client/types/variable_prompt_block.py +4 -4
- vellum/client/types/vellum_audio.py +3 -3
- vellum/client/types/vellum_audio_request.py +3 -3
- vellum/client/types/vellum_code_resource_definition.py +2 -2
- vellum/client/types/vellum_document.py +2 -2
- vellum/client/types/vellum_document_request.py +2 -2
- vellum/client/types/vellum_error.py +3 -3
- vellum/client/types/vellum_error_request.py +3 -3
- vellum/client/types/vellum_image.py +2 -2
- vellum/client/types/vellum_image_request.py +2 -2
- vellum/client/types/vellum_node_execution_event.py +4 -3
- vellum/client/types/vellum_sdk_error.py +3 -3
- vellum/client/types/vellum_secret.py +2 -2
- vellum/client/types/vellum_span.py +2 -1
- vellum/client/types/vellum_value.py +9 -8
- vellum/client/types/vellum_value_logical_condition_group_request.py +6 -6
- vellum/client/types/vellum_value_logical_condition_request.py +13 -7
- vellum/client/types/vellum_value_logical_expression_request.py +2 -1
- vellum/client/types/vellum_value_request.py +9 -8
- vellum/client/types/vellum_variable.py +13 -7
- vellum/client/types/vellum_variable_extensions.py +2 -2
- vellum/client/types/vellum_video.py +3 -3
- vellum/client/types/vellum_video_request.py +3 -3
- vellum/client/types/vellum_workflow_execution_event.py +4 -3
- vellum/client/types/video_chat_message_content.py +3 -3
- vellum/client/types/video_chat_message_content_request.py +3 -3
- vellum/client/types/video_prompt_block.py +4 -4
- vellum/client/types/video_vellum_value.py +3 -3
- vellum/client/types/video_vellum_value_request.py +3 -3
- vellum/client/types/workflow_deployment_event_executions_response.py +18 -12
- vellum/client/types/workflow_deployment_history_item.py +10 -4
- vellum/client/types/workflow_deployment_parent_context.py +11 -11
- vellum/client/types/workflow_deployment_read.py +11 -5
- vellum/client/types/workflow_deployment_release.py +13 -7
- vellum/client/types/workflow_deployment_release_workflow_deployment.py +2 -2
- vellum/client/types/workflow_deployment_release_workflow_version.py +10 -4
- vellum/client/types/workflow_error.py +1 -0
- vellum/client/types/workflow_event_error.py +3 -3
- vellum/client/types/workflow_event_execution_read.py +22 -16
- vellum/client/types/workflow_execution_actual.py +10 -4
- vellum/client/types/workflow_execution_actual_chat_history_request.py +2 -2
- vellum/client/types/workflow_execution_actual_json_request.py +2 -2
- vellum/client/types/workflow_execution_actual_string_request.py +2 -2
- vellum/client/types/workflow_execution_detail.py +22 -16
- vellum/client/types/workflow_execution_fulfilled_body.py +3 -3
- vellum/client/types/workflow_execution_fulfilled_event.py +22 -16
- vellum/client/types/workflow_execution_initiated_body.py +3 -3
- vellum/client/types/workflow_execution_initiated_event.py +22 -16
- vellum/client/types/workflow_execution_node_result_event.py +10 -4
- vellum/client/types/workflow_execution_paused_body.py +4 -4
- vellum/client/types/workflow_execution_paused_event.py +22 -16
- vellum/client/types/workflow_execution_rejected_body.py +4 -4
- vellum/client/types/workflow_execution_rejected_event.py +22 -16
- vellum/client/types/workflow_execution_resumed_body.py +3 -3
- vellum/client/types/workflow_execution_resumed_event.py +22 -16
- vellum/client/types/workflow_execution_snapshotted_body.py +3 -3
- vellum/client/types/workflow_execution_snapshotted_event.py +22 -16
- vellum/client/types/workflow_execution_span.py +18 -12
- vellum/client/types/workflow_execution_span_attributes.py +2 -2
- vellum/client/types/workflow_execution_streaming_body.py +4 -4
- vellum/client/types/workflow_execution_streaming_event.py +22 -16
- vellum/client/types/workflow_execution_usage_calculation_error.py +3 -3
- vellum/client/types/workflow_execution_usage_calculation_fulfilled_body.py +3 -3
- vellum/client/types/workflow_execution_usage_result.py +3 -3
- vellum/client/types/workflow_execution_view_online_eval_metric_result.py +10 -4
- vellum/client/types/workflow_execution_workflow_result_event.py +10 -4
- vellum/client/types/workflow_expand_meta_request.py +2 -2
- vellum/client/types/workflow_initialization_error.py +2 -2
- vellum/client/types/workflow_node_result_data.py +8 -7
- vellum/client/types/workflow_node_result_event.py +3 -2
- vellum/client/types/workflow_output.py +6 -5
- vellum/client/types/workflow_output_array.py +12 -6
- vellum/client/types/workflow_output_chat_history.py +3 -3
- vellum/client/types/workflow_output_error.py +3 -3
- vellum/client/types/workflow_output_function_call.py +3 -3
- vellum/client/types/workflow_output_image.py +3 -3
- vellum/client/types/workflow_output_json.py +3 -3
- vellum/client/types/workflow_output_number.py +3 -3
- vellum/client/types/workflow_output_search_results.py +3 -3
- vellum/client/types/workflow_output_string.py +3 -3
- vellum/client/types/workflow_parent_context.py +12 -12
- vellum/client/types/workflow_push_deployment_config_request.py +2 -2
- vellum/client/types/workflow_push_response.py +2 -2
- vellum/client/types/workflow_release_tag_read.py +4 -4
- vellum/client/types/workflow_release_tag_workflow_deployment_history_item.py +2 -2
- vellum/client/types/workflow_request_chat_history_input_request.py +3 -3
- vellum/client/types/workflow_request_input_request.py +3 -2
- vellum/client/types/workflow_request_json_input_request.py +3 -3
- vellum/client/types/workflow_request_number_input_request.py +3 -3
- vellum/client/types/workflow_request_string_input_request.py +3 -3
- vellum/client/types/workflow_result_event.py +13 -7
- vellum/client/types/workflow_result_event_output_data.py +7 -6
- vellum/client/types/workflow_result_event_output_data_array.py +12 -6
- vellum/client/types/workflow_result_event_output_data_chat_history.py +3 -3
- vellum/client/types/workflow_result_event_output_data_error.py +3 -3
- vellum/client/types/workflow_result_event_output_data_function_call.py +3 -3
- vellum/client/types/workflow_result_event_output_data_json.py +3 -3
- vellum/client/types/workflow_result_event_output_data_number.py +3 -3
- vellum/client/types/workflow_result_event_output_data_search_results.py +3 -3
- vellum/client/types/workflow_result_event_output_data_string.py +3 -3
- vellum/client/types/workflow_sandbox_example.py +2 -2
- vellum/client/types/workflow_sandbox_parent_context.py +11 -11
- vellum/client/types/workflow_stream_event.py +2 -1
- vellum/client/types/workspace_read.py +3 -3
- vellum/client/types/workspace_secret_read.py +3 -3
- vellum/core/force_multipart.py +3 -0
- vellum/workflows/emitters/vellum_emitter.py +5 -0
- vellum/workflows/events/node.py +25 -10
- vellum/workflows/events/tests/test_event.py +19 -19
- vellum/workflows/state/context.py +8 -52
- vellum/workflows/state/encoder.py +2 -4
- vellum/workflows/utils/functions.py +1 -1
- vellum/workflows/workflows/base.py +1 -1
- {vellum_ai-1.1.3.dist-info → vellum_ai-1.1.5.dist-info}/METADATA +2 -2
- {vellum_ai-1.1.3.dist-info → vellum_ai-1.1.5.dist-info}/RECORD +671 -669
- vellum_ee/workflows/display/nodes/base_node_display.py +3 -3
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +154 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +50 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +4 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +4 -1
- vellum_ee/workflows/display/types.py +13 -2
- vellum_ee/workflows/display/workflows/base_workflow_display.py +15 -0
- vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +44 -2
- {vellum_ai-1.1.3.dist-info → vellum_ai-1.1.5.dist-info}/LICENSE +0 -0
- {vellum_ai-1.1.3.dist-info → vellum_ai-1.1.5.dist-info}/WHEEL +0 -0
- {vellum_ai-1.1.3.dist-info → vellum_ai-1.1.5.dist-info}/entry_points.txt +0 -0
@@ -11,10 +11,12 @@ from random import random
|
|
11
11
|
|
12
12
|
import httpx
|
13
13
|
from .file import File, convert_file_dict_to_httpx_tuples
|
14
|
+
from .force_multipart import FORCE_MULTIPART
|
14
15
|
from .jsonable_encoder import jsonable_encoder
|
15
16
|
from .query_encoder import encode_query
|
16
17
|
from .remove_none_from_dict import remove_none_from_dict
|
17
18
|
from .request_options import RequestOptions
|
19
|
+
from httpx._types import RequestFiles
|
18
20
|
|
19
21
|
INITIAL_RETRY_DELAY_SECONDS = 0.5
|
20
22
|
MAX_RETRY_DELAY_SECONDS = 10
|
@@ -178,11 +180,17 @@ class HttpClient:
|
|
178
180
|
json: typing.Optional[typing.Any] = None,
|
179
181
|
data: typing.Optional[typing.Any] = None,
|
180
182
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
181
|
-
files: typing.Optional[
|
183
|
+
files: typing.Optional[
|
184
|
+
typing.Union[
|
185
|
+
typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]],
|
186
|
+
typing.List[typing.Tuple[str, File]],
|
187
|
+
]
|
188
|
+
] = None,
|
182
189
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
183
190
|
request_options: typing.Optional[RequestOptions] = None,
|
184
191
|
retries: int = 2,
|
185
192
|
omit: typing.Optional[typing.Any] = None,
|
193
|
+
force_multipart: typing.Optional[bool] = None,
|
186
194
|
) -> httpx.Response:
|
187
195
|
base_url = self.get_base_url(base_url)
|
188
196
|
timeout = (
|
@@ -193,6 +201,15 @@ class HttpClient:
|
|
193
201
|
|
194
202
|
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
195
203
|
|
204
|
+
request_files: typing.Optional[RequestFiles] = (
|
205
|
+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
206
|
+
if (files is not None and files is not omit and isinstance(files, dict))
|
207
|
+
else None
|
208
|
+
)
|
209
|
+
|
210
|
+
if (request_files is None or len(request_files) == 0) and force_multipart:
|
211
|
+
request_files = FORCE_MULTIPART
|
212
|
+
|
196
213
|
response = self.httpx_client.request(
|
197
214
|
method=method,
|
198
215
|
url=urllib.parse.urljoin(f"{base_url}/", path),
|
@@ -225,11 +242,7 @@ class HttpClient:
|
|
225
242
|
json=json_body,
|
226
243
|
data=data_body,
|
227
244
|
content=content,
|
228
|
-
files=
|
229
|
-
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
230
|
-
if (files is not None and files is not omit)
|
231
|
-
else None
|
232
|
-
),
|
245
|
+
files=request_files,
|
233
246
|
timeout=timeout,
|
234
247
|
)
|
235
248
|
|
@@ -264,11 +277,17 @@ class HttpClient:
|
|
264
277
|
json: typing.Optional[typing.Any] = None,
|
265
278
|
data: typing.Optional[typing.Any] = None,
|
266
279
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
267
|
-
files: typing.Optional[
|
280
|
+
files: typing.Optional[
|
281
|
+
typing.Union[
|
282
|
+
typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]],
|
283
|
+
typing.List[typing.Tuple[str, File]],
|
284
|
+
]
|
285
|
+
] = None,
|
268
286
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
269
287
|
request_options: typing.Optional[RequestOptions] = None,
|
270
288
|
retries: int = 2,
|
271
289
|
omit: typing.Optional[typing.Any] = None,
|
290
|
+
force_multipart: typing.Optional[bool] = None,
|
272
291
|
) -> typing.Iterator[httpx.Response]:
|
273
292
|
base_url = self.get_base_url(base_url)
|
274
293
|
timeout = (
|
@@ -277,6 +296,15 @@ class HttpClient:
|
|
277
296
|
else self.base_timeout()
|
278
297
|
)
|
279
298
|
|
299
|
+
request_files: typing.Optional[RequestFiles] = (
|
300
|
+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
301
|
+
if (files is not None and files is not omit and isinstance(files, dict))
|
302
|
+
else None
|
303
|
+
)
|
304
|
+
|
305
|
+
if (request_files is None or len(request_files) == 0) and force_multipart:
|
306
|
+
request_files = FORCE_MULTIPART
|
307
|
+
|
280
308
|
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
281
309
|
|
282
310
|
with self.httpx_client.stream(
|
@@ -311,11 +339,7 @@ class HttpClient:
|
|
311
339
|
json=json_body,
|
312
340
|
data=data_body,
|
313
341
|
content=content,
|
314
|
-
files=
|
315
|
-
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
316
|
-
if (files is not None and files is not omit)
|
317
|
-
else None
|
318
|
-
),
|
342
|
+
files=request_files,
|
319
343
|
timeout=timeout,
|
320
344
|
) as stream:
|
321
345
|
yield stream
|
@@ -354,11 +378,17 @@ class AsyncHttpClient:
|
|
354
378
|
json: typing.Optional[typing.Any] = None,
|
355
379
|
data: typing.Optional[typing.Any] = None,
|
356
380
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
357
|
-
files: typing.Optional[
|
381
|
+
files: typing.Optional[
|
382
|
+
typing.Union[
|
383
|
+
typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]],
|
384
|
+
typing.List[typing.Tuple[str, File]],
|
385
|
+
]
|
386
|
+
] = None,
|
358
387
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
359
388
|
request_options: typing.Optional[RequestOptions] = None,
|
360
389
|
retries: int = 2,
|
361
390
|
omit: typing.Optional[typing.Any] = None,
|
391
|
+
force_multipart: typing.Optional[bool] = None,
|
362
392
|
) -> httpx.Response:
|
363
393
|
base_url = self.get_base_url(base_url)
|
364
394
|
timeout = (
|
@@ -367,6 +397,15 @@ class AsyncHttpClient:
|
|
367
397
|
else self.base_timeout()
|
368
398
|
)
|
369
399
|
|
400
|
+
request_files: typing.Optional[RequestFiles] = (
|
401
|
+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
402
|
+
if (files is not None and files is not omit and isinstance(files, dict))
|
403
|
+
else None
|
404
|
+
)
|
405
|
+
|
406
|
+
if (request_files is None or len(request_files) == 0) and force_multipart:
|
407
|
+
request_files = FORCE_MULTIPART
|
408
|
+
|
370
409
|
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
371
410
|
|
372
411
|
# Add the input to each of these and do None-safety checks
|
@@ -402,11 +441,7 @@ class AsyncHttpClient:
|
|
402
441
|
json=json_body,
|
403
442
|
data=data_body,
|
404
443
|
content=content,
|
405
|
-
files=
|
406
|
-
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
407
|
-
if files is not None
|
408
|
-
else None
|
409
|
-
),
|
444
|
+
files=request_files,
|
410
445
|
timeout=timeout,
|
411
446
|
)
|
412
447
|
|
@@ -440,11 +475,17 @@ class AsyncHttpClient:
|
|
440
475
|
json: typing.Optional[typing.Any] = None,
|
441
476
|
data: typing.Optional[typing.Any] = None,
|
442
477
|
content: typing.Optional[typing.Union[bytes, typing.Iterator[bytes], typing.AsyncIterator[bytes]]] = None,
|
443
|
-
files: typing.Optional[
|
478
|
+
files: typing.Optional[
|
479
|
+
typing.Union[
|
480
|
+
typing.Dict[str, typing.Optional[typing.Union[File, typing.List[File]]]],
|
481
|
+
typing.List[typing.Tuple[str, File]],
|
482
|
+
]
|
483
|
+
] = None,
|
444
484
|
headers: typing.Optional[typing.Dict[str, typing.Any]] = None,
|
445
485
|
request_options: typing.Optional[RequestOptions] = None,
|
446
486
|
retries: int = 2,
|
447
487
|
omit: typing.Optional[typing.Any] = None,
|
488
|
+
force_multipart: typing.Optional[bool] = None,
|
448
489
|
) -> typing.AsyncIterator[httpx.Response]:
|
449
490
|
base_url = self.get_base_url(base_url)
|
450
491
|
timeout = (
|
@@ -453,6 +494,15 @@ class AsyncHttpClient:
|
|
453
494
|
else self.base_timeout()
|
454
495
|
)
|
455
496
|
|
497
|
+
request_files: typing.Optional[RequestFiles] = (
|
498
|
+
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
499
|
+
if (files is not None and files is not omit and isinstance(files, dict))
|
500
|
+
else None
|
501
|
+
)
|
502
|
+
|
503
|
+
if (request_files is None or len(request_files) == 0) and force_multipart:
|
504
|
+
request_files = FORCE_MULTIPART
|
505
|
+
|
456
506
|
json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit)
|
457
507
|
|
458
508
|
async with self.httpx_client.stream(
|
@@ -487,11 +537,7 @@ class AsyncHttpClient:
|
|
487
537
|
json=json_body,
|
488
538
|
data=data_body,
|
489
539
|
content=content,
|
490
|
-
files=
|
491
|
-
convert_file_dict_to_httpx_tuples(remove_omit_from_dict(remove_none_from_dict(files), omit))
|
492
|
-
if files is not None
|
493
|
-
else None
|
494
|
-
),
|
540
|
+
files=request_files,
|
495
541
|
timeout=timeout,
|
496
542
|
) as stream:
|
497
543
|
yield stream
|
@@ -5,20 +5,31 @@ from typing import Dict, Generic, TypeVar
|
|
5
5
|
import httpx
|
6
6
|
|
7
7
|
T = TypeVar("T")
|
8
|
+
"""Generic to represent the underlying type of the data wrapped by the HTTP response."""
|
8
9
|
|
9
10
|
|
10
|
-
class
|
11
|
+
class BaseHttpResponse:
|
12
|
+
"""Minimalist HTTP response wrapper that exposes response headers."""
|
13
|
+
|
11
14
|
_response: httpx.Response
|
12
|
-
_data: T
|
13
15
|
|
14
|
-
def __init__(self, response: httpx.Response
|
16
|
+
def __init__(self, response: httpx.Response):
|
15
17
|
self._response = response
|
16
|
-
self._data = data
|
17
18
|
|
18
19
|
@property
|
19
20
|
def headers(self) -> Dict[str, str]:
|
20
21
|
return dict(self._response.headers)
|
21
22
|
|
23
|
+
|
24
|
+
class HttpResponse(Generic[T], BaseHttpResponse):
|
25
|
+
"""HTTP response wrapper that exposes response headers and data."""
|
26
|
+
|
27
|
+
_data: T
|
28
|
+
|
29
|
+
def __init__(self, response: httpx.Response, data: T):
|
30
|
+
super().__init__(response)
|
31
|
+
self._data = data
|
32
|
+
|
22
33
|
@property
|
23
34
|
def data(self) -> T:
|
24
35
|
return self._data
|
@@ -27,18 +38,15 @@ class HttpResponse(Generic[T]):
|
|
27
38
|
self._response.close()
|
28
39
|
|
29
40
|
|
30
|
-
class AsyncHttpResponse(Generic[T]):
|
31
|
-
|
41
|
+
class AsyncHttpResponse(Generic[T], BaseHttpResponse):
|
42
|
+
"""HTTP response wrapper that exposes response headers and data."""
|
43
|
+
|
32
44
|
_data: T
|
33
45
|
|
34
46
|
def __init__(self, response: httpx.Response, data: T):
|
35
|
-
|
47
|
+
super().__init__(response)
|
36
48
|
self._data = data
|
37
49
|
|
38
|
-
@property
|
39
|
-
def headers(self) -> Dict[str, str]:
|
40
|
-
return dict(self._response.headers)
|
41
|
-
|
42
50
|
@property
|
43
51
|
def data(self) -> T:
|
44
52
|
return self._data
|
@@ -2,98 +2,76 @@
|
|
2
2
|
|
3
3
|
# nopycln: file
|
4
4
|
import datetime as dt
|
5
|
-
import typing
|
6
5
|
from collections import defaultdict
|
6
|
+
from typing import Any, Callable, ClassVar, Dict, List, Mapping, Optional, Set, Tuple, Type, TypeVar, Union, cast
|
7
7
|
|
8
8
|
import pydantic
|
9
9
|
import logging
|
10
|
-
import typing_extensions
|
11
|
-
from .datetime_utils import serialize_datetime
|
12
|
-
from .serialization import convert_and_respect_annotation_metadata
|
13
10
|
|
14
11
|
logger = logging.getLogger(__name__)
|
15
12
|
|
16
13
|
IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
|
17
14
|
|
18
15
|
if IS_PYDANTIC_V2:
|
19
|
-
|
20
|
-
|
21
|
-
from pydantic.v1.
|
22
|
-
|
23
|
-
|
24
|
-
from pydantic.v1.
|
25
|
-
|
26
|
-
|
27
|
-
from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
28
|
-
ENCODERS_BY_TYPE as encoders_by_type,
|
29
|
-
)
|
30
|
-
from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
31
|
-
get_args as get_args,
|
32
|
-
)
|
33
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
34
|
-
get_origin as get_origin,
|
35
|
-
)
|
36
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
37
|
-
is_literal_type as is_literal_type,
|
38
|
-
)
|
39
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
40
|
-
is_union as is_union,
|
41
|
-
)
|
42
|
-
from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
16
|
+
from pydantic.v1.datetime_parse import parse_date as parse_date
|
17
|
+
from pydantic.v1.datetime_parse import parse_datetime as parse_datetime
|
18
|
+
from pydantic.v1.fields import ModelField as ModelField
|
19
|
+
from pydantic.v1.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[attr-defined]
|
20
|
+
from pydantic.v1.typing import get_args as get_args
|
21
|
+
from pydantic.v1.typing import get_origin as get_origin
|
22
|
+
from pydantic.v1.typing import is_literal_type as is_literal_type
|
23
|
+
from pydantic.v1.typing import is_union as is_union
|
43
24
|
else:
|
44
|
-
from pydantic.datetime_parse import parse_date as parse_date # type: ignore
|
45
|
-
from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore
|
46
|
-
from pydantic.fields import ModelField as ModelField # type: ignore
|
47
|
-
from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore
|
48
|
-
from pydantic.typing import get_args as get_args # type: ignore
|
49
|
-
from pydantic.typing import get_origin as get_origin # type: ignore
|
50
|
-
from pydantic.typing import is_literal_type as is_literal_type # type: ignore
|
51
|
-
from pydantic.typing import is_union as is_union # type: ignore
|
52
|
-
|
53
|
-
# isort: on
|
25
|
+
from pydantic.datetime_parse import parse_date as parse_date # type: ignore[no-redef]
|
26
|
+
from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore[no-redef]
|
27
|
+
from pydantic.fields import ModelField as ModelField # type: ignore[attr-defined, no-redef]
|
28
|
+
from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore[no-redef]
|
29
|
+
from pydantic.typing import get_args as get_args # type: ignore[no-redef]
|
30
|
+
from pydantic.typing import get_origin as get_origin # type: ignore[no-redef]
|
31
|
+
from pydantic.typing import is_literal_type as is_literal_type # type: ignore[no-redef]
|
32
|
+
from pydantic.typing import is_union as is_union # type: ignore[no-redef]
|
54
33
|
|
34
|
+
from .datetime_utils import serialize_datetime
|
35
|
+
from .serialization import convert_and_respect_annotation_metadata
|
36
|
+
from typing_extensions import TypeAlias
|
55
37
|
|
56
|
-
T =
|
57
|
-
Model =
|
58
|
-
type_adapter_cache:
|
38
|
+
T = TypeVar("T")
|
39
|
+
Model = TypeVar("Model", bound=pydantic.BaseModel)
|
40
|
+
type_adapter_cache: Dict[Type, pydantic.TypeAdapter] = {}
|
59
41
|
annotated_types = {"ExecuteApiResponse"}
|
60
42
|
|
61
43
|
|
62
|
-
def parse_obj_as(type_:
|
44
|
+
def parse_obj_as(type_: Type[T], object_: Any) -> T:
|
63
45
|
if hasattr(type_, "__name__") and type_.__name__ in annotated_types:
|
64
46
|
dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read")
|
65
47
|
else:
|
66
48
|
dealiased_object = object_
|
67
49
|
if IS_PYDANTIC_V2:
|
68
|
-
adapter = pydantic.TypeAdapter(type_) if type_ not in type_adapter_cache else type_adapter_cache[type_] # type: ignore
|
50
|
+
adapter = pydantic.TypeAdapter(type_) if type_ not in type_adapter_cache else type_adapter_cache[type_] # type: ignore[attr-defined]
|
69
51
|
if type_ not in type_adapter_cache:
|
70
52
|
type_adapter_cache[type_] = adapter
|
71
53
|
return adapter.validate_python(dealiased_object)
|
72
|
-
|
73
|
-
return pydantic.parse_obj_as(type_, dealiased_object)
|
54
|
+
return pydantic.parse_obj_as(type_, dealiased_object)
|
74
55
|
|
75
56
|
|
76
|
-
def to_jsonable_with_fallback(
|
77
|
-
obj: typing.Any, fallback_serializer: typing.Callable[[typing.Any], typing.Any]
|
78
|
-
) -> typing.Any:
|
57
|
+
def to_jsonable_with_fallback(obj: Any, fallback_serializer: Callable[[Any], Any]) -> Any:
|
79
58
|
if IS_PYDANTIC_V2:
|
80
59
|
from pydantic_core import to_jsonable_python
|
81
60
|
|
82
61
|
return to_jsonable_python(obj, fallback=fallback_serializer)
|
83
|
-
|
84
|
-
return fallback_serializer(obj)
|
62
|
+
return fallback_serializer(obj)
|
85
63
|
|
86
64
|
|
87
65
|
class UniversalBaseModel(pydantic.BaseModel):
|
88
66
|
if IS_PYDANTIC_V2:
|
89
|
-
model_config:
|
67
|
+
model_config: ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict( # type: ignore[typeddict-unknown-key]
|
90
68
|
# Allow fields beginning with `model_` to be used in the model
|
91
69
|
protected_namespaces=(),
|
92
|
-
)
|
70
|
+
)
|
93
71
|
|
94
|
-
@pydantic.model_serializer(mode="
|
95
|
-
def serialize_model(self
|
96
|
-
serialized =
|
72
|
+
@pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined]
|
73
|
+
def serialize_model(self) -> Any: # type: ignore[name-defined]
|
74
|
+
serialized = self.model_dump()
|
97
75
|
data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()}
|
98
76
|
return data
|
99
77
|
|
@@ -104,34 +82,28 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
104
82
|
json_encoders = {dt.datetime: serialize_datetime}
|
105
83
|
|
106
84
|
@classmethod
|
107
|
-
def model_construct(
|
108
|
-
cls: typing.Type["Model"], _fields_set: typing.Optional[typing.Set[str]] = None, **values: typing.Any
|
109
|
-
) -> "Model":
|
85
|
+
def model_construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model":
|
110
86
|
dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
|
111
87
|
return cls.construct(_fields_set, **dealiased_object)
|
112
88
|
|
113
89
|
@classmethod
|
114
|
-
def construct(
|
115
|
-
cls: typing.Type["Model"], _fields_set: typing.Optional[typing.Set[str]] = None, **values: typing.Any
|
116
|
-
) -> "Model":
|
90
|
+
def construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model":
|
117
91
|
dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
|
118
92
|
if IS_PYDANTIC_V2:
|
119
|
-
return super().model_construct(_fields_set, **dealiased_object) # type: ignore
|
120
|
-
|
121
|
-
return super().construct(_fields_set, **dealiased_object)
|
93
|
+
return super().model_construct(_fields_set, **dealiased_object) # type: ignore[misc]
|
94
|
+
return super().construct(_fields_set, **dealiased_object)
|
122
95
|
|
123
|
-
def json(self, **kwargs:
|
124
|
-
kwargs_with_defaults
|
96
|
+
def json(self, **kwargs: Any) -> str:
|
97
|
+
kwargs_with_defaults = {
|
125
98
|
"by_alias": True,
|
126
99
|
"exclude_unset": True,
|
127
100
|
**kwargs,
|
128
101
|
}
|
129
102
|
if IS_PYDANTIC_V2:
|
130
|
-
return super().model_dump_json(**kwargs_with_defaults) # type: ignore
|
131
|
-
|
132
|
-
return super().json(**kwargs_with_defaults)
|
103
|
+
return super().model_dump_json(**kwargs_with_defaults) # type: ignore[misc]
|
104
|
+
return super().json(**kwargs_with_defaults)
|
133
105
|
|
134
|
-
def dict(self, **kwargs:
|
106
|
+
def dict(self, **kwargs: Any) -> Dict[str, Any]:
|
135
107
|
"""
|
136
108
|
Override the default dict method to `exclude_unset` by default. This function patches
|
137
109
|
`exclude_unset` to work include fields within non-None default values.
|
@@ -142,25 +114,21 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
142
114
|
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
|
143
115
|
# that we have less control over, and this is less intrusive than custom serializers for now.
|
144
116
|
if IS_PYDANTIC_V2:
|
145
|
-
|
146
|
-
**kwargs,
|
147
|
-
"warnings": False,
|
148
|
-
}
|
149
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {
|
117
|
+
kwargs_with_defaults_exclude_unset = {
|
150
118
|
**kwargs,
|
151
119
|
"by_alias": True,
|
152
120
|
"exclude_unset": True,
|
153
121
|
"exclude_none": False,
|
154
122
|
}
|
155
|
-
kwargs_with_defaults_exclude_none
|
123
|
+
kwargs_with_defaults_exclude_none = {
|
156
124
|
**kwargs,
|
157
125
|
"by_alias": True,
|
158
126
|
"exclude_none": True,
|
159
127
|
"exclude_unset": False,
|
160
128
|
}
|
161
129
|
dict_dump = deep_union_pydantic_dicts(
|
162
|
-
super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore
|
163
|
-
super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore
|
130
|
+
super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore[misc]
|
131
|
+
super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore[misc]
|
164
132
|
)
|
165
133
|
|
166
134
|
else:
|
@@ -180,7 +148,7 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
180
148
|
if default is not None:
|
181
149
|
self.__fields_set__.add(name)
|
182
150
|
|
183
|
-
kwargs_with_defaults_exclude_unset_include_fields
|
151
|
+
kwargs_with_defaults_exclude_unset_include_fields = {
|
184
152
|
"by_alias": True,
|
185
153
|
"exclude_unset": True,
|
186
154
|
"include": _fields_set,
|
@@ -192,12 +160,10 @@ class UniversalBaseModel(pydantic.BaseModel):
|
|
192
160
|
return convert_and_respect_annotation_metadata(object_=dict_dump, annotation=self.__class__, direction="write")
|
193
161
|
|
194
162
|
|
195
|
-
def _union_list_of_pydantic_dicts(
|
196
|
-
|
197
|
-
) -> typing.List[typing.Any]:
|
198
|
-
converted_list: typing.List[typing.Any] = []
|
163
|
+
def _union_list_of_pydantic_dicts(source: List[Any], destination: List[Any]) -> List[Any]:
|
164
|
+
converted_list: List[Any] = []
|
199
165
|
for i, item in enumerate(source):
|
200
|
-
destination_value = destination[i]
|
166
|
+
destination_value = destination[i]
|
201
167
|
if isinstance(item, dict):
|
202
168
|
converted_list.append(deep_union_pydantic_dicts(item, destination_value))
|
203
169
|
elif isinstance(item, list):
|
@@ -207,9 +173,7 @@ def _union_list_of_pydantic_dicts(
|
|
207
173
|
return converted_list
|
208
174
|
|
209
175
|
|
210
|
-
def deep_union_pydantic_dicts(
|
211
|
-
source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any]
|
212
|
-
) -> typing.Dict[str, typing.Any]:
|
176
|
+
def deep_union_pydantic_dicts(source: Dict[str, Any], destination: Dict[str, Any]) -> Dict[str, Any]:
|
213
177
|
for key, value in source.items():
|
214
178
|
node = destination.setdefault(key, {})
|
215
179
|
if isinstance(value, dict):
|
@@ -227,18 +191,16 @@ def deep_union_pydantic_dicts(
|
|
227
191
|
|
228
192
|
if IS_PYDANTIC_V2:
|
229
193
|
|
230
|
-
class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore
|
194
|
+
class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore[misc, name-defined, type-arg]
|
231
195
|
pass
|
232
196
|
|
233
|
-
UniversalRootModel:
|
197
|
+
UniversalRootModel: TypeAlias = V2RootModel # type: ignore[misc]
|
234
198
|
else:
|
235
|
-
UniversalRootModel:
|
199
|
+
UniversalRootModel: TypeAlias = UniversalBaseModel # type: ignore[misc, no-redef]
|
236
200
|
|
237
201
|
|
238
|
-
def encode_by_type(o:
|
239
|
-
encoders_by_class_tuples:
|
240
|
-
defaultdict(tuple)
|
241
|
-
)
|
202
|
+
def encode_by_type(o: Any) -> Any:
|
203
|
+
encoders_by_class_tuples: Dict[Callable[[Any], Any], Tuple[Any, ...]] = defaultdict(tuple)
|
242
204
|
for type_, encoder in encoders_by_type.items():
|
243
205
|
encoders_by_class_tuples[encoder] += (type_,)
|
244
206
|
|
@@ -249,9 +211,9 @@ def encode_by_type(o: typing.Any) -> typing.Any:
|
|
249
211
|
return encoder(o)
|
250
212
|
|
251
213
|
|
252
|
-
def update_forward_refs(model:
|
214
|
+
def update_forward_refs(model: Type["Model"], **localns: Any) -> None:
|
253
215
|
if IS_PYDANTIC_V2:
|
254
|
-
model.model_rebuild(raise_errors=False) # type: ignore
|
216
|
+
model.model_rebuild(raise_errors=False) # type: ignore[attr-defined]
|
255
217
|
else:
|
256
218
|
try:
|
257
219
|
model.update_forward_refs(**localns)
|
@@ -260,46 +222,41 @@ def update_forward_refs(model: typing.Type["Model"], **localns: typing.Any) -> N
|
|
260
222
|
|
261
223
|
|
262
224
|
# Mirrors Pydantic's internal typing
|
263
|
-
AnyCallable =
|
225
|
+
AnyCallable = Callable[..., Any]
|
264
226
|
|
265
227
|
|
266
228
|
def universal_root_validator(
|
267
229
|
pre: bool = False,
|
268
|
-
) ->
|
230
|
+
) -> Callable[[AnyCallable], AnyCallable]:
|
269
231
|
def decorator(func: AnyCallable) -> AnyCallable:
|
270
232
|
if IS_PYDANTIC_V2:
|
271
|
-
return pydantic.model_validator(mode="before" if pre else "after")(func) # type: ignore
|
272
|
-
|
273
|
-
return pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1
|
233
|
+
return cast(AnyCallable, pydantic.model_validator(mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
|
234
|
+
return cast(AnyCallable, pydantic.root_validator(pre=pre)(func)) # type: ignore[call-overload]
|
274
235
|
|
275
236
|
return decorator
|
276
237
|
|
277
238
|
|
278
|
-
def universal_field_validator(field_name: str, pre: bool = False) ->
|
239
|
+
def universal_field_validator(field_name: str, pre: bool = False) -> Callable[[AnyCallable], AnyCallable]:
|
279
240
|
def decorator(func: AnyCallable) -> AnyCallable:
|
280
241
|
if IS_PYDANTIC_V2:
|
281
|
-
return pydantic.field_validator(field_name, mode="before" if pre else "after")(func) # type: ignore
|
282
|
-
|
283
|
-
return pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1
|
242
|
+
return cast(AnyCallable, pydantic.field_validator(field_name, mode="before" if pre else "after")(func)) # type: ignore[attr-defined]
|
243
|
+
return cast(AnyCallable, pydantic.validator(field_name, pre=pre)(func))
|
284
244
|
|
285
245
|
return decorator
|
286
246
|
|
287
247
|
|
288
|
-
PydanticField =
|
248
|
+
PydanticField = Union[ModelField, pydantic.fields.FieldInfo]
|
289
249
|
|
290
250
|
|
291
|
-
def _get_model_fields(
|
292
|
-
model: typing.Type["Model"],
|
293
|
-
) -> typing.Mapping[str, PydanticField]:
|
251
|
+
def _get_model_fields(model: Type["Model"]) -> Mapping[str, PydanticField]:
|
294
252
|
if IS_PYDANTIC_V2:
|
295
|
-
return model.model_fields # type: ignore
|
296
|
-
|
297
|
-
return model.__fields__ # type: ignore # Pydantic v1
|
253
|
+
return cast(Mapping[str, PydanticField], model.model_fields) # type: ignore[attr-defined]
|
254
|
+
return cast(Mapping[str, PydanticField], model.__fields__)
|
298
255
|
|
299
256
|
|
300
|
-
def _get_field_default(field: PydanticField) ->
|
257
|
+
def _get_field_default(field: PydanticField) -> Any:
|
301
258
|
try:
|
302
|
-
value = field.get_default() # type: ignore
|
259
|
+
value = field.get_default() # type: ignore[union-attr]
|
303
260
|
except:
|
304
261
|
value = field.default
|
305
262
|
if IS_PYDANTIC_V2:
|
@@ -160,7 +160,12 @@ def _convert_mapping(
|
|
160
160
|
direction: typing.Literal["read", "write"],
|
161
161
|
) -> typing.Mapping[str, object]:
|
162
162
|
converted_object: typing.Dict[str, object] = {}
|
163
|
-
|
163
|
+
try:
|
164
|
+
annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
|
165
|
+
except NameError:
|
166
|
+
# The TypedDict contains a circular reference, so
|
167
|
+
# we use the __annotations__ attribute directly.
|
168
|
+
annotations = getattr(expected_type, "__annotations__", {})
|
164
169
|
aliases_to_field_names = _get_alias_to_field_name(annotations)
|
165
170
|
for key, value in object_.items():
|
166
171
|
if direction == "read" and key in aliases_to_field_names:
|
vellum/client/errors/__init__.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
from ..core.api_error import ApiError
|
4
3
|
import typing
|
5
4
|
|
5
|
+
from ..core.api_error import ApiError
|
6
|
+
|
6
7
|
|
7
8
|
class BadRequestError(ApiError):
|
8
|
-
def __init__(self, body: typing.Optional[typing.Any]):
|
9
|
-
super().__init__(status_code=400, body=body)
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
10
|
+
super().__init__(status_code=400, headers=headers, body=body)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
from ..core.api_error import ApiError
|
4
3
|
import typing
|
5
4
|
|
5
|
+
from ..core.api_error import ApiError
|
6
|
+
|
6
7
|
|
7
8
|
class ForbiddenError(ApiError):
|
8
|
-
def __init__(self, body: typing.Optional[typing.Any]):
|
9
|
-
super().__init__(status_code=403, body=body)
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
10
|
+
super().__init__(status_code=403, headers=headers, body=body)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
2
2
|
|
3
|
-
from ..core.api_error import ApiError
|
4
3
|
import typing
|
5
4
|
|
5
|
+
from ..core.api_error import ApiError
|
6
|
+
|
6
7
|
|
7
8
|
class InternalServerError(ApiError):
|
8
|
-
def __init__(self, body: typing.Optional[typing.Any]):
|
9
|
-
super().__init__(status_code=500, body=body)
|
9
|
+
def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
|
10
|
+
super().__init__(status_code=500, headers=headers, body=body)
|