vellum-ai 0.9.16__py3-none-any.whl → 0.9.16rc2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/client/README.md +242 -0
- vellum/client/core/__init__.py +47 -0
- vellum/client/core/api_error.py +15 -0
- vellum/client/core/client_wrapper.py +59 -0
- vellum/client/core/datetime_utils.py +28 -0
- vellum/client/core/file.py +62 -0
- vellum/client/core/http_client.py +487 -0
- vellum/client/core/jsonable_encoder.py +101 -0
- vellum/client/core/pydantic_utilities.py +296 -0
- vellum/client/core/query_encoder.py +58 -0
- vellum/client/core/remove_none_from_dict.py +11 -0
- vellum/client/core/request_options.py +32 -0
- vellum/client/core/serialization.py +272 -0
- vellum/client/environment.py +17 -0
- vellum/client/errors/__init__.py +8 -0
- vellum/client/errors/bad_request_error.py +9 -0
- vellum/client/errors/forbidden_error.py +9 -0
- vellum/client/errors/internal_server_error.py +9 -0
- vellum/client/errors/not_found_error.py +9 -0
- vellum/client/resources/__init__.py +47 -0
- vellum/client/resources/ad_hoc/__init__.py +2 -0
- vellum/client/resources/ad_hoc/client.py +459 -0
- vellum/client/resources/container_images/__init__.py +2 -0
- vellum/client/resources/container_images/client.py +502 -0
- vellum/client/resources/deployments/__init__.py +5 -0
- vellum/client/resources/deployments/client.py +975 -0
- vellum/client/resources/deployments/types/__init__.py +6 -0
- vellum/client/resources/deployments/types/deployments_list_request_status.py +5 -0
- vellum/client/resources/deployments/types/list_deployment_release_tags_request_source.py +5 -0
- vellum/client/resources/document_indexes/__init__.py +5 -0
- vellum/client/resources/document_indexes/client.py +1154 -0
- vellum/client/resources/document_indexes/types/__init__.py +5 -0
- vellum/client/resources/document_indexes/types/document_indexes_list_request_status.py +5 -0
- vellum/client/resources/documents/__init__.py +2 -0
- vellum/client/resources/documents/client.py +781 -0
- vellum/client/resources/folder_entities/__init__.py +5 -0
- vellum/client/resources/folder_entities/client.py +333 -0
- vellum/client/resources/folder_entities/types/__init__.py +5 -0
- vellum/client/resources/folder_entities/types/folder_entities_list_request_entity_status.py +5 -0
- vellum/client/resources/metric_definitions/__init__.py +2 -0
- vellum/client/resources/metric_definitions/client.py +178 -0
- vellum/client/resources/sandboxes/__init__.py +2 -0
- vellum/client/resources/sandboxes/client.py +481 -0
- vellum/client/resources/test_suite_runs/__init__.py +2 -0
- vellum/client/resources/test_suite_runs/client.py +445 -0
- vellum/client/resources/test_suites/__init__.py +2 -0
- vellum/client/resources/test_suites/client.py +688 -0
- vellum/client/resources/workflow_deployments/__init__.py +5 -0
- vellum/client/resources/workflow_deployments/client.py +693 -0
- vellum/client/resources/workflow_deployments/types/__init__.py +6 -0
- vellum/client/resources/workflow_deployments/types/list_workflow_release_tags_request_source.py +5 -0
- vellum/client/resources/workflow_deployments/types/workflow_deployments_list_request_status.py +5 -0
- vellum/client/resources/workflow_sandboxes/__init__.py +2 -0
- vellum/client/resources/workflow_sandboxes/client.py +190 -0
- vellum/client/resources/workflows/__init__.py +5 -0
- vellum/client/resources/workflows/client.py +333 -0
- vellum/client/resources/workflows/types/__init__.py +5 -0
- vellum/client/resources/workflows/types/workflows_pull_request_format.py +5 -0
- vellum/client/resources/workspace_secrets/__init__.py +2 -0
- vellum/client/resources/workspace_secrets/client.py +266 -0
- vellum/client/types/__init__.py +979 -0
- vellum/client/types/ad_hoc_execute_prompt_event.py +14 -0
- vellum/client/types/ad_hoc_expand_meta.py +37 -0
- vellum/client/types/ad_hoc_fulfilled_prompt_execution_meta.py +27 -0
- vellum/client/types/ad_hoc_initiated_prompt_execution_meta.py +24 -0
- vellum/client/types/ad_hoc_rejected_prompt_execution_meta.py +25 -0
- vellum/client/types/ad_hoc_streaming_prompt_execution_meta.py +23 -0
- vellum/client/types/add_openai_api_key_enum.py +3 -0
- vellum/client/types/api_node_result.py +25 -0
- vellum/client/types/api_node_result_data.py +28 -0
- vellum/client/types/array_chat_message_content.py +25 -0
- vellum/client/types/array_chat_message_content_item.py +11 -0
- vellum/client/types/array_chat_message_content_item_request.py +14 -0
- vellum/client/types/array_chat_message_content_request.py +25 -0
- vellum/client/types/array_input.py +36 -0
- vellum/client/types/array_variable_value.py +27 -0
- vellum/client/types/array_variable_value_item.py +29 -0
- vellum/client/types/array_vellum_value.py +31 -0
- vellum/client/types/array_vellum_value_request.py +31 -0
- vellum/client/types/audio_chat_message_content.py +25 -0
- vellum/client/types/audio_chat_message_content_request.py +25 -0
- vellum/client/types/audio_variable_value.py +25 -0
- vellum/client/types/audio_vellum_value.py +25 -0
- vellum/client/types/audio_vellum_value_request.py +25 -0
- vellum/client/types/basic_vectorizer_intfloat_multilingual_e_5_large.py +24 -0
- vellum/client/types/basic_vectorizer_intfloat_multilingual_e_5_large_request.py +24 -0
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1.py +26 -0
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1_request.py +26 -0
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1.py +26 -0
- vellum/client/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1_request.py +26 -0
- vellum/client/types/chat_history_input.py +30 -0
- vellum/client/types/chat_history_input_request.py +30 -0
- vellum/client/types/chat_history_variable_value.py +21 -0
- vellum/client/types/chat_history_vellum_value.py +25 -0
- vellum/client/types/chat_history_vellum_value_request.py +25 -0
- vellum/client/types/chat_message.py +27 -0
- vellum/client/types/chat_message_content.py +16 -0
- vellum/client/types/chat_message_content_request.py +16 -0
- vellum/client/types/chat_message_prompt_block.py +39 -0
- vellum/client/types/chat_message_request.py +27 -0
- vellum/client/types/chat_message_role.py +5 -0
- vellum/client/types/code_execution_node_array_result.py +28 -0
- vellum/client/types/code_execution_node_chat_history_result.py +22 -0
- vellum/client/types/code_execution_node_error_result.py +22 -0
- vellum/client/types/code_execution_node_function_call_result.py +22 -0
- vellum/client/types/code_execution_node_json_result.py +21 -0
- vellum/client/types/code_execution_node_number_result.py +21 -0
- vellum/client/types/code_execution_node_result.py +31 -0
- vellum/client/types/code_execution_node_result_data.py +27 -0
- vellum/client/types/code_execution_node_result_output.py +22 -0
- vellum/client/types/code_execution_node_search_results_result.py +22 -0
- vellum/client/types/code_execution_node_string_result.py +21 -0
- vellum/client/types/code_execution_package.py +20 -0
- vellum/client/types/code_execution_runtime.py +5 -0
- vellum/client/types/code_executor_input.py +24 -0
- vellum/client/types/code_executor_response.py +27 -0
- vellum/client/types/code_executor_secret_input.py +29 -0
- vellum/client/types/compile_prompt_deployment_expand_meta_request.py +32 -0
- vellum/client/types/compile_prompt_meta.py +25 -0
- vellum/client/types/components_schemas_pdf_search_result_meta_source.py +5 -0
- vellum/client/types/components_schemas_pdf_search_result_meta_source_request.py +5 -0
- vellum/client/types/condition_combinator.py +5 -0
- vellum/client/types/conditional_node_result.py +25 -0
- vellum/client/types/conditional_node_result_data.py +19 -0
- vellum/client/types/container_image_read.py +28 -0
- vellum/client/types/create_test_suite_test_case_request.py +48 -0
- vellum/client/types/deployment_provider_payload_response.py +22 -0
- vellum/client/types/deployment_provider_payload_response_payload.py +5 -0
- vellum/client/types/deployment_read.py +73 -0
- vellum/client/types/deployment_release_tag_deployment_history_item.py +21 -0
- vellum/client/types/deployment_release_tag_read.py +37 -0
- vellum/client/types/docker_service_token.py +21 -0
- vellum/client/types/document_document_to_document_index.py +39 -0
- vellum/client/types/document_index_chunking.py +8 -0
- vellum/client/types/document_index_chunking_request.py +10 -0
- vellum/client/types/document_index_indexing_config.py +22 -0
- vellum/client/types/document_index_indexing_config_request.py +22 -0
- vellum/client/types/document_index_read.py +52 -0
- vellum/client/types/document_processing_state.py +7 -0
- vellum/client/types/document_read.py +49 -0
- vellum/client/types/document_status.py +5 -0
- vellum/client/types/enriched_normalized_completion.py +59 -0
- vellum/client/types/entity_status.py +5 -0
- vellum/client/types/entity_visibility.py +5 -0
- vellum/client/types/environment_enum.py +5 -0
- vellum/client/types/ephemeral_prompt_cache_config.py +20 -0
- vellum/client/types/ephemeral_prompt_cache_config_type_enum.py +5 -0
- vellum/client/types/error_input.py +30 -0
- vellum/client/types/error_variable_value.py +21 -0
- vellum/client/types/error_vellum_value.py +25 -0
- vellum/client/types/error_vellum_value_request.py +25 -0
- vellum/client/types/execute_prompt_event.py +11 -0
- vellum/client/types/execute_prompt_response.py +7 -0
- vellum/client/types/execute_workflow_response.py +29 -0
- vellum/client/types/execute_workflow_workflow_result_event.py +9 -0
- vellum/client/types/execution_array_vellum_value.py +37 -0
- vellum/client/types/execution_chat_history_vellum_value.py +31 -0
- vellum/client/types/execution_error_vellum_value.py +31 -0
- vellum/client/types/execution_function_call_vellum_value.py +31 -0
- vellum/client/types/execution_json_vellum_value.py +30 -0
- vellum/client/types/execution_number_vellum_value.py +30 -0
- vellum/client/types/execution_search_results_vellum_value.py +31 -0
- vellum/client/types/execution_string_vellum_value.py +30 -0
- vellum/client/types/execution_vellum_value.py +22 -0
- vellum/client/types/external_test_case_execution.py +31 -0
- vellum/client/types/external_test_case_execution_request.py +31 -0
- vellum/client/types/finish_reason_enum.py +5 -0
- vellum/client/types/folder_entity.py +16 -0
- vellum/client/types/folder_entity_document_index.py +26 -0
- vellum/client/types/folder_entity_document_index_data.py +25 -0
- vellum/client/types/folder_entity_folder.py +26 -0
- vellum/client/types/folder_entity_folder_data.py +24 -0
- vellum/client/types/folder_entity_prompt_sandbox.py +26 -0
- vellum/client/types/folder_entity_prompt_sandbox_data.py +26 -0
- vellum/client/types/folder_entity_test_suite.py +26 -0
- vellum/client/types/folder_entity_test_suite_data.py +25 -0
- vellum/client/types/folder_entity_workflow_sandbox.py +26 -0
- vellum/client/types/folder_entity_workflow_sandbox_data.py +26 -0
- vellum/client/types/fulfilled_ad_hoc_execute_prompt_event.py +28 -0
- vellum/client/types/fulfilled_enum.py +5 -0
- vellum/client/types/fulfilled_execute_prompt_event.py +28 -0
- vellum/client/types/fulfilled_execute_prompt_response.py +37 -0
- vellum/client/types/fulfilled_execute_workflow_workflow_result_event.py +36 -0
- vellum/client/types/fulfilled_prompt_execution_meta.py +27 -0
- vellum/client/types/fulfilled_workflow_node_result_event.py +40 -0
- vellum/client/types/function_call.py +27 -0
- vellum/client/types/function_call_chat_message_content.py +25 -0
- vellum/client/types/function_call_chat_message_content_request.py +25 -0
- vellum/client/types/function_call_chat_message_content_value.py +25 -0
- vellum/client/types/function_call_chat_message_content_value_request.py +25 -0
- vellum/client/types/function_call_input.py +30 -0
- vellum/client/types/function_call_request.py +27 -0
- vellum/client/types/function_call_variable_value.py +21 -0
- vellum/client/types/function_call_vellum_value.py +25 -0
- vellum/client/types/function_call_vellum_value_request.py +25 -0
- vellum/client/types/function_definition.py +31 -0
- vellum/client/types/generate_options_request.py +26 -0
- vellum/client/types/generate_request.py +33 -0
- vellum/client/types/generate_response.py +38 -0
- vellum/client/types/generate_result.py +29 -0
- vellum/client/types/generate_result_data.py +23 -0
- vellum/client/types/generate_result_error.py +22 -0
- vellum/client/types/generate_stream_response.py +20 -0
- vellum/client/types/generate_stream_result.py +23 -0
- vellum/client/types/generate_stream_result_data.py +21 -0
- vellum/client/types/google_vertex_ai_vectorizer_config.py +20 -0
- vellum/client/types/google_vertex_ai_vectorizer_config_request.py +20 -0
- vellum/client/types/google_vertex_ai_vectorizer_text_embedding_004.py +21 -0
- vellum/client/types/google_vertex_ai_vectorizer_text_embedding_004_request.py +21 -0
- vellum/client/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002.py +21 -0
- vellum/client/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002_request.py +21 -0
- vellum/client/types/hkunlp_instructor_xl_vectorizer.py +25 -0
- vellum/client/types/hkunlp_instructor_xl_vectorizer_request.py +25 -0
- vellum/client/types/image_chat_message_content.py +25 -0
- vellum/client/types/image_chat_message_content_request.py +25 -0
- vellum/client/types/image_variable_value.py +25 -0
- vellum/client/types/image_vellum_value.py +25 -0
- vellum/client/types/image_vellum_value_request.py +25 -0
- vellum/client/types/indexing_config_vectorizer.py +30 -0
- vellum/client/types/indexing_config_vectorizer_request.py +30 -0
- vellum/client/types/indexing_state_enum.py +7 -0
- vellum/client/types/initiated_ad_hoc_execute_prompt_event.py +26 -0
- vellum/client/types/initiated_execute_prompt_event.py +26 -0
- vellum/client/types/initiated_prompt_execution_meta.py +26 -0
- vellum/client/types/initiated_workflow_node_result_event.py +39 -0
- vellum/client/types/instructor_vectorizer_config.py +25 -0
- vellum/client/types/instructor_vectorizer_config_request.py +25 -0
- vellum/client/types/iteration_state_enum.py +5 -0
- vellum/client/types/jinja_prompt_block.py +28 -0
- vellum/client/types/json_input.py +29 -0
- vellum/client/types/json_input_request.py +29 -0
- vellum/client/types/json_variable_value.py +20 -0
- vellum/client/types/json_vellum_value.py +24 -0
- vellum/client/types/json_vellum_value_request.py +24 -0
- vellum/client/types/logical_operator.py +29 -0
- vellum/client/types/logprobs_enum.py +5 -0
- vellum/client/types/map_node_result.py +25 -0
- vellum/client/types/map_node_result_data.py +21 -0
- vellum/client/types/merge_node_result.py +25 -0
- vellum/client/types/merge_node_result_data.py +19 -0
- vellum/client/types/metadata_filter_config_request.py +36 -0
- vellum/client/types/metadata_filter_rule_combinator.py +5 -0
- vellum/client/types/metadata_filter_rule_request.py +31 -0
- vellum/client/types/metadata_filters_request.py +7 -0
- vellum/client/types/metric_definition_execution.py +20 -0
- vellum/client/types/metric_definition_input.py +9 -0
- vellum/client/types/metric_node_result.py +23 -0
- vellum/client/types/ml_model_usage.py +25 -0
- vellum/client/types/named_scenario_input_chat_history_variable_value_request.py +26 -0
- vellum/client/types/named_scenario_input_json_variable_value_request.py +25 -0
- vellum/client/types/named_scenario_input_request.py +12 -0
- vellum/client/types/named_scenario_input_string_variable_value_request.py +25 -0
- vellum/client/types/named_test_case_array_variable_value.py +32 -0
- vellum/client/types/named_test_case_array_variable_value_request.py +34 -0
- vellum/client/types/named_test_case_chat_history_variable_value.py +26 -0
- vellum/client/types/named_test_case_chat_history_variable_value_request.py +26 -0
- vellum/client/types/named_test_case_error_variable_value.py +26 -0
- vellum/client/types/named_test_case_error_variable_value_request.py +26 -0
- vellum/client/types/named_test_case_function_call_variable_value.py +26 -0
- vellum/client/types/named_test_case_function_call_variable_value_request.py +26 -0
- vellum/client/types/named_test_case_json_variable_value.py +25 -0
- vellum/client/types/named_test_case_json_variable_value_request.py +25 -0
- vellum/client/types/named_test_case_number_variable_value.py +25 -0
- vellum/client/types/named_test_case_number_variable_value_request.py +25 -0
- vellum/client/types/named_test_case_search_results_variable_value.py +26 -0
- vellum/client/types/named_test_case_search_results_variable_value_request.py +26 -0
- vellum/client/types/named_test_case_string_variable_value.py +25 -0
- vellum/client/types/named_test_case_string_variable_value_request.py +25 -0
- vellum/client/types/named_test_case_variable_value.py +22 -0
- vellum/client/types/named_test_case_variable_value_request.py +22 -0
- vellum/client/types/node_input_compiled_array_value.py +29 -0
- vellum/client/types/node_input_compiled_chat_history_value.py +23 -0
- vellum/client/types/node_input_compiled_error_value.py +23 -0
- vellum/client/types/node_input_compiled_function_call_value.py +23 -0
- vellum/client/types/node_input_compiled_json_value.py +22 -0
- vellum/client/types/node_input_compiled_number_value.py +22 -0
- vellum/client/types/node_input_compiled_search_results_value.py +23 -0
- vellum/client/types/node_input_compiled_string_value.py +22 -0
- vellum/client/types/node_input_variable_compiled_value.py +22 -0
- vellum/client/types/node_output_compiled_array_value.py +34 -0
- vellum/client/types/node_output_compiled_chat_history_value.py +28 -0
- vellum/client/types/node_output_compiled_error_value.py +28 -0
- vellum/client/types/node_output_compiled_function_call_value.py +28 -0
- vellum/client/types/node_output_compiled_json_value.py +27 -0
- vellum/client/types/node_output_compiled_number_value.py +27 -0
- vellum/client/types/node_output_compiled_search_results_value.py +28 -0
- vellum/client/types/node_output_compiled_string_value.py +27 -0
- vellum/client/types/node_output_compiled_value.py +22 -0
- vellum/client/types/normalized_log_probs.py +21 -0
- vellum/client/types/normalized_token_log_probs.py +22 -0
- vellum/client/types/number_input.py +29 -0
- vellum/client/types/number_variable_value.py +20 -0
- vellum/client/types/number_vellum_value.py +24 -0
- vellum/client/types/number_vellum_value_request.py +24 -0
- vellum/client/types/open_ai_vectorizer_config.py +24 -0
- vellum/client/types/open_ai_vectorizer_config_request.py +24 -0
- vellum/client/types/open_ai_vectorizer_text_embedding_3_large.py +25 -0
- vellum/client/types/open_ai_vectorizer_text_embedding_3_large_request.py +25 -0
- vellum/client/types/open_ai_vectorizer_text_embedding_3_small.py +25 -0
- vellum/client/types/open_ai_vectorizer_text_embedding_3_small_request.py +25 -0
- vellum/client/types/open_ai_vectorizer_text_embedding_ada_002.py +25 -0
- vellum/client/types/open_ai_vectorizer_text_embedding_ada_002_request.py +25 -0
- vellum/client/types/paginated_container_image_read_list.py +23 -0
- vellum/client/types/paginated_deployment_release_tag_read_list.py +23 -0
- vellum/client/types/paginated_document_index_read_list.py +23 -0
- vellum/client/types/paginated_folder_entity_list.py +23 -0
- vellum/client/types/paginated_slim_deployment_read_list.py +29 -0
- vellum/client/types/paginated_slim_document_list.py +23 -0
- vellum/client/types/paginated_slim_workflow_deployment_list.py +29 -0
- vellum/client/types/paginated_test_suite_run_execution_list.py +29 -0
- vellum/client/types/paginated_test_suite_test_case_list.py +29 -0
- vellum/client/types/paginated_workflow_release_tag_read_list.py +23 -0
- vellum/client/types/pdf_search_result_meta_source.py +32 -0
- vellum/client/types/pdf_search_result_meta_source_request.py +32 -0
- vellum/client/types/plain_text_prompt_block.py +28 -0
- vellum/client/types/price.py +21 -0
- vellum/client/types/processing_failure_reason_enum.py +5 -0
- vellum/client/types/prompt_block.py +12 -0
- vellum/client/types/prompt_block_state.py +5 -0
- vellum/client/types/prompt_deployment_expand_meta_request.py +52 -0
- vellum/client/types/prompt_deployment_input_request.py +8 -0
- vellum/client/types/prompt_execution_meta.py +32 -0
- vellum/client/types/prompt_node_execution_meta.py +24 -0
- vellum/client/types/prompt_node_result.py +25 -0
- vellum/client/types/prompt_node_result_data.py +25 -0
- vellum/client/types/prompt_output.py +9 -0
- vellum/client/types/prompt_parameters.py +27 -0
- vellum/client/types/prompt_request_chat_history_input.py +26 -0
- vellum/client/types/prompt_request_input.py +8 -0
- vellum/client/types/prompt_request_json_input.py +25 -0
- vellum/client/types/prompt_request_string_input.py +25 -0
- vellum/client/types/prompt_settings.py +19 -0
- vellum/client/types/raw_prompt_execution_overrides_request.py +28 -0
- vellum/client/types/reducto_chunker_config.py +23 -0
- vellum/client/types/reducto_chunker_config_request.py +23 -0
- vellum/client/types/reducto_chunking.py +25 -0
- vellum/client/types/reducto_chunking_request.py +25 -0
- vellum/client/types/rejected_ad_hoc_execute_prompt_event.py +28 -0
- vellum/client/types/rejected_execute_prompt_event.py +28 -0
- vellum/client/types/rejected_execute_prompt_response.py +37 -0
- vellum/client/types/rejected_execute_workflow_workflow_result_event.py +28 -0
- vellum/client/types/rejected_prompt_execution_meta.py +25 -0
- vellum/client/types/rejected_workflow_node_result_event.py +39 -0
- vellum/client/types/release_tag_source.py +5 -0
- vellum/client/types/replace_test_suite_test_case_request.py +53 -0
- vellum/client/types/rich_text_child_block.py +7 -0
- vellum/client/types/rich_text_prompt_block.py +29 -0
- vellum/client/types/sandbox_scenario.py +33 -0
- vellum/client/types/scenario_input.py +10 -0
- vellum/client/types/scenario_input_chat_history_variable_value.py +26 -0
- vellum/client/types/scenario_input_json_variable_value.py +25 -0
- vellum/client/types/scenario_input_string_variable_value.py +25 -0
- vellum/client/types/search_filters_request.py +38 -0
- vellum/client/types/search_node_result.py +25 -0
- vellum/client/types/search_node_result_data.py +27 -0
- vellum/client/types/search_request_options_request.py +50 -0
- vellum/client/types/search_response.py +23 -0
- vellum/client/types/search_result.py +40 -0
- vellum/client/types/search_result_document.py +37 -0
- vellum/client/types/search_result_document_request.py +37 -0
- vellum/client/types/search_result_merging_request.py +22 -0
- vellum/client/types/search_result_meta.py +20 -0
- vellum/client/types/search_result_meta_request.py +20 -0
- vellum/client/types/search_result_request.py +40 -0
- vellum/client/types/search_results_input.py +30 -0
- vellum/client/types/search_results_variable_value.py +21 -0
- vellum/client/types/search_results_vellum_value.py +25 -0
- vellum/client/types/search_results_vellum_value_request.py +25 -0
- vellum/client/types/search_weights_request.py +27 -0
- vellum/client/types/secret_type_enum.py +5 -0
- vellum/client/types/sentence_chunker_config.py +24 -0
- vellum/client/types/sentence_chunker_config_request.py +24 -0
- vellum/client/types/sentence_chunking.py +25 -0
- vellum/client/types/sentence_chunking_request.py +25 -0
- vellum/client/types/slim_deployment_read.py +63 -0
- vellum/client/types/slim_document.py +70 -0
- vellum/client/types/slim_workflow_deployment.py +72 -0
- vellum/client/types/streaming_ad_hoc_execute_prompt_event.py +33 -0
- vellum/client/types/streaming_execute_prompt_event.py +33 -0
- vellum/client/types/streaming_prompt_execution_meta.py +23 -0
- vellum/client/types/streaming_workflow_node_result_event.py +40 -0
- vellum/client/types/string_chat_message_content.py +24 -0
- vellum/client/types/string_chat_message_content_request.py +24 -0
- vellum/client/types/string_input.py +29 -0
- vellum/client/types/string_input_request.py +29 -0
- vellum/client/types/string_variable_value.py +20 -0
- vellum/client/types/string_vellum_value.py +24 -0
- vellum/client/types/string_vellum_value_request.py +24 -0
- vellum/client/types/submit_completion_actual_request.py +48 -0
- vellum/client/types/submit_workflow_execution_actual_request.py +10 -0
- vellum/client/types/subworkflow_node_result.py +25 -0
- vellum/client/types/subworkflow_node_result_data.py +19 -0
- vellum/client/types/templating_node_array_result.py +28 -0
- vellum/client/types/templating_node_chat_history_result.py +22 -0
- vellum/client/types/templating_node_error_result.py +22 -0
- vellum/client/types/templating_node_function_call_result.py +22 -0
- vellum/client/types/templating_node_json_result.py +21 -0
- vellum/client/types/templating_node_number_result.py +21 -0
- vellum/client/types/templating_node_result.py +31 -0
- vellum/client/types/templating_node_result_data.py +26 -0
- vellum/client/types/templating_node_result_output.py +22 -0
- vellum/client/types/templating_node_search_results_result.py +22 -0
- vellum/client/types/templating_node_string_result.py +21 -0
- vellum/client/types/terminal_node_array_result.py +33 -0
- vellum/client/types/terminal_node_chat_history_result.py +27 -0
- vellum/client/types/terminal_node_error_result.py +27 -0
- vellum/client/types/terminal_node_function_call_result.py +27 -0
- vellum/client/types/terminal_node_json_result.py +26 -0
- vellum/client/types/terminal_node_number_result.py +26 -0
- vellum/client/types/terminal_node_result.py +31 -0
- vellum/client/types/terminal_node_result_data.py +26 -0
- vellum/client/types/terminal_node_result_output.py +22 -0
- vellum/client/types/terminal_node_search_results_result.py +27 -0
- vellum/client/types/terminal_node_string_result.py +26 -0
- vellum/client/types/test_case_array_variable_value.py +33 -0
- vellum/client/types/test_case_chat_history_variable_value.py +27 -0
- vellum/client/types/test_case_error_variable_value.py +27 -0
- vellum/client/types/test_case_function_call_variable_value.py +27 -0
- vellum/client/types/test_case_json_variable_value.py +26 -0
- vellum/client/types/test_case_number_variable_value.py +26 -0
- vellum/client/types/test_case_search_results_variable_value.py +27 -0
- vellum/client/types/test_case_string_variable_value.py +26 -0
- vellum/client/types/test_case_variable_value.py +22 -0
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config.py +29 -0
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_deployment_release_tag_exec_config_request.py +31 -0
- vellum/client/types/test_suite_run_exec_config.py +10 -0
- vellum/client/types/test_suite_run_exec_config_request.py +12 -0
- vellum/client/types/test_suite_run_execution.py +30 -0
- vellum/client/types/test_suite_run_execution_array_output.py +33 -0
- vellum/client/types/test_suite_run_execution_chat_history_output.py +27 -0
- vellum/client/types/test_suite_run_execution_error_output.py +27 -0
- vellum/client/types/test_suite_run_execution_function_call_output.py +27 -0
- vellum/client/types/test_suite_run_execution_json_output.py +26 -0
- vellum/client/types/test_suite_run_execution_metric_definition.py +21 -0
- vellum/client/types/test_suite_run_execution_metric_result.py +24 -0
- vellum/client/types/test_suite_run_execution_number_output.py +26 -0
- vellum/client/types/test_suite_run_execution_output.py +22 -0
- vellum/client/types/test_suite_run_execution_search_results_output.py +27 -0
- vellum/client/types/test_suite_run_execution_string_output.py +26 -0
- vellum/client/types/test_suite_run_external_exec_config.py +36 -0
- vellum/client/types/test_suite_run_external_exec_config_data.py +29 -0
- vellum/client/types/test_suite_run_external_exec_config_data_request.py +31 -0
- vellum/client/types/test_suite_run_external_exec_config_request.py +38 -0
- vellum/client/types/test_suite_run_metric_error_output.py +26 -0
- vellum/client/types/test_suite_run_metric_json_output.py +25 -0
- vellum/client/types/test_suite_run_metric_number_output.py +25 -0
- vellum/client/types/test_suite_run_metric_output.py +14 -0
- vellum/client/types/test_suite_run_metric_string_output.py +25 -0
- vellum/client/types/test_suite_run_read.py +46 -0
- vellum/client/types/test_suite_run_state.py +5 -0
- vellum/client/types/test_suite_run_test_suite.py +21 -0
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config.py +29 -0
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_workflow_release_tag_exec_config_request.py +31 -0
- vellum/client/types/test_suite_test_case.py +30 -0
- vellum/client/types/test_suite_test_case_bulk_operation_request.py +14 -0
- vellum/client/types/test_suite_test_case_bulk_result.py +14 -0
- vellum/client/types/test_suite_test_case_create_bulk_operation_request.py +38 -0
- vellum/client/types/test_suite_test_case_created_bulk_result.py +26 -0
- vellum/client/types/test_suite_test_case_created_bulk_result_data.py +23 -0
- vellum/client/types/test_suite_test_case_delete_bulk_operation_data_request.py +19 -0
- vellum/client/types/test_suite_test_case_delete_bulk_operation_request.py +33 -0
- vellum/client/types/test_suite_test_case_deleted_bulk_result.py +30 -0
- vellum/client/types/test_suite_test_case_deleted_bulk_result_data.py +23 -0
- vellum/client/types/test_suite_test_case_rejected_bulk_result.py +32 -0
- vellum/client/types/test_suite_test_case_replace_bulk_operation_request.py +38 -0
- vellum/client/types/test_suite_test_case_replaced_bulk_result.py +30 -0
- vellum/client/types/test_suite_test_case_replaced_bulk_result_data.py +23 -0
- vellum/client/types/test_suite_test_case_upsert_bulk_operation_request.py +38 -0
- vellum/client/types/token_overlapping_window_chunker_config.py +24 -0
- vellum/client/types/token_overlapping_window_chunker_config_request.py +24 -0
- vellum/client/types/token_overlapping_window_chunking.py +25 -0
- vellum/client/types/token_overlapping_window_chunking_request.py +25 -0
- vellum/client/types/unit_enum.py +5 -0
- vellum/client/types/upload_document_response.py +22 -0
- vellum/client/types/upsert_test_suite_test_case_request.py +49 -0
- vellum/client/types/variable_prompt_block.py +28 -0
- vellum/client/types/vellum_audio.py +24 -0
- vellum/client/types/vellum_audio_request.py +24 -0
- vellum/client/types/vellum_error.py +21 -0
- vellum/client/types/vellum_error_code_enum.py +15 -0
- vellum/client/types/vellum_error_request.py +21 -0
- vellum/client/types/vellum_image.py +20 -0
- vellum/client/types/vellum_image_request.py +20 -0
- vellum/client/types/vellum_value.py +29 -0
- vellum/client/types/vellum_value_logical_condition_group_request.py +38 -0
- vellum/client/types/vellum_value_logical_condition_request.py +34 -0
- vellum/client/types/vellum_value_logical_expression_request.py +12 -0
- vellum/client/types/vellum_value_request.py +29 -0
- vellum/client/types/vellum_variable.py +33 -0
- vellum/client/types/vellum_variable_extensions.py +23 -0
- vellum/client/types/vellum_variable_type.py +20 -0
- vellum/client/types/workflow_deployment_read.py +77 -0
- vellum/client/types/workflow_event_error.py +21 -0
- vellum/client/types/workflow_execution_actual_chat_history_request.py +49 -0
- vellum/client/types/workflow_execution_actual_json_request.py +48 -0
- vellum/client/types/workflow_execution_actual_string_request.py +48 -0
- vellum/client/types/workflow_execution_event_error_code.py +17 -0
- vellum/client/types/workflow_execution_event_type.py +5 -0
- vellum/client/types/workflow_execution_node_result_event.py +34 -0
- vellum/client/types/workflow_execution_workflow_result_event.py +36 -0
- vellum/client/types/workflow_expand_meta_request.py +22 -0
- vellum/client/types/workflow_node_result_data.py +28 -0
- vellum/client/types/workflow_node_result_event.py +14 -0
- vellum/client/types/workflow_node_result_event_state.py +7 -0
- vellum/client/types/workflow_output.py +24 -0
- vellum/client/types/workflow_output_array.py +37 -0
- vellum/client/types/workflow_output_chat_history.py +31 -0
- vellum/client/types/workflow_output_error.py +31 -0
- vellum/client/types/workflow_output_function_call.py +31 -0
- vellum/client/types/workflow_output_image.py +31 -0
- vellum/client/types/workflow_output_json.py +30 -0
- vellum/client/types/workflow_output_number.py +30 -0
- vellum/client/types/workflow_output_search_results.py +31 -0
- vellum/client/types/workflow_output_string.py +30 -0
- vellum/client/types/workflow_push_deployment_config_request.py +22 -0
- vellum/client/types/workflow_push_exec_config.py +3 -0
- vellum/client/types/workflow_push_response.py +20 -0
- vellum/client/types/workflow_release_tag_read.py +37 -0
- vellum/client/types/workflow_release_tag_workflow_deployment_history_item.py +28 -0
- vellum/client/types/workflow_request_chat_history_input_request.py +30 -0
- vellum/client/types/workflow_request_input_request.py +14 -0
- vellum/client/types/workflow_request_json_input_request.py +29 -0
- vellum/client/types/workflow_request_number_input_request.py +29 -0
- vellum/client/types/workflow_request_string_input_request.py +29 -0
- vellum/client/types/workflow_result_event.py +39 -0
- vellum/client/types/workflow_result_event_output_data.py +22 -0
- vellum/client/types/workflow_result_event_output_data_array.py +41 -0
- vellum/client/types/workflow_result_event_output_data_chat_history.py +35 -0
- vellum/client/types/workflow_result_event_output_data_error.py +35 -0
- vellum/client/types/workflow_result_event_output_data_function_call.py +35 -0
- vellum/client/types/workflow_result_event_output_data_json.py +34 -0
- vellum/client/types/workflow_result_event_output_data_number.py +34 -0
- vellum/client/types/workflow_result_event_output_data_search_results.py +35 -0
- vellum/client/types/workflow_result_event_output_data_string.py +37 -0
- vellum/client/types/workflow_stream_event.py +7 -0
- vellum/client/types/workspace_secret_read.py +25 -0
- vellum/core/__init__.py +2 -46
- vellum/core/api_error.py +2 -14
- vellum/core/client_wrapper.py +2 -58
- vellum/core/datetime_utils.py +2 -27
- vellum/core/file.py +2 -61
- vellum/core/http_client.py +2 -486
- vellum/core/jsonable_encoder.py +2 -100
- vellum/core/pydantic_utilities.py +2 -295
- vellum/core/query_encoder.py +2 -57
- vellum/core/remove_none_from_dict.py +2 -10
- vellum/core/request_options.py +2 -31
- vellum/core/serialization.py +2 -271
- vellum/environment.py +2 -16
- vellum/errors/__init__.py +2 -7
- vellum/errors/bad_request_error.py +2 -8
- vellum/errors/forbidden_error.py +2 -8
- vellum/errors/internal_server_error.py +2 -8
- vellum/errors/not_found_error.py +2 -8
- vellum/{lib/test_suites → evaluations}/resources.py +20 -51
- vellum/plugins/vellum_mypy.py +11 -0
- vellum/resources/__init__.py +2 -46
- vellum/resources/ad_hoc/__init__.py +2 -1
- vellum/resources/ad_hoc/client.py +2 -458
- vellum/resources/container_images/__init__.py +2 -1
- vellum/resources/container_images/client.py +2 -501
- vellum/resources/deployments/__init__.py +2 -4
- vellum/resources/deployments/client.py +2 -974
- vellum/resources/deployments/types/__init__.py +2 -5
- vellum/resources/deployments/types/deployments_list_request_status.py +2 -4
- vellum/resources/deployments/types/list_deployment_release_tags_request_source.py +2 -4
- vellum/resources/document_indexes/__init__.py +2 -4
- vellum/resources/document_indexes/client.py +2 -1153
- vellum/resources/document_indexes/types/__init__.py +2 -4
- vellum/resources/document_indexes/types/document_indexes_list_request_status.py +2 -4
- vellum/resources/documents/__init__.py +2 -1
- vellum/resources/documents/client.py +2 -780
- vellum/resources/folder_entities/__init__.py +2 -4
- vellum/resources/folder_entities/client.py +2 -332
- vellum/resources/folder_entities/types/__init__.py +2 -4
- vellum/resources/folder_entities/types/folder_entities_list_request_entity_status.py +2 -4
- vellum/resources/metric_definitions/__init__.py +2 -1
- vellum/resources/metric_definitions/client.py +2 -177
- vellum/resources/sandboxes/__init__.py +2 -1
- vellum/resources/sandboxes/client.py +2 -480
- vellum/resources/test_suite_runs/__init__.py +2 -1
- vellum/resources/test_suite_runs/client.py +2 -444
- vellum/resources/test_suites/__init__.py +2 -1
- vellum/resources/test_suites/client.py +2 -687
- vellum/resources/workflow_deployments/__init__.py +2 -4
- vellum/resources/workflow_deployments/client.py +2 -692
- vellum/resources/workflow_deployments/types/__init__.py +2 -5
- vellum/resources/workflow_deployments/types/list_workflow_release_tags_request_source.py +2 -4
- vellum/resources/workflow_deployments/types/workflow_deployments_list_request_status.py +2 -4
- vellum/resources/workflow_sandboxes/__init__.py +2 -1
- vellum/resources/workflow_sandboxes/client.py +2 -189
- vellum/resources/workflows/__init__.py +2 -4
- vellum/resources/workflows/client.py +2 -332
- vellum/resources/workflows/types/__init__.py +2 -4
- vellum/resources/workflows/types/workflows_pull_request_format.py +2 -4
- vellum/resources/workspace_secrets/__init__.py +2 -1
- vellum/resources/workspace_secrets/client.py +2 -265
- vellum/types/__init__.py +2 -978
- vellum/types/ad_hoc_execute_prompt_event.py +2 -13
- vellum/types/ad_hoc_expand_meta.py +2 -36
- vellum/types/ad_hoc_fulfilled_prompt_execution_meta.py +2 -26
- vellum/types/ad_hoc_initiated_prompt_execution_meta.py +2 -23
- vellum/types/ad_hoc_rejected_prompt_execution_meta.py +2 -24
- vellum/types/ad_hoc_streaming_prompt_execution_meta.py +2 -22
- vellum/types/add_openai_api_key_enum.py +2 -2
- vellum/types/api_node_result.py +2 -24
- vellum/types/api_node_result_data.py +2 -27
- vellum/types/array_chat_message_content.py +2 -24
- vellum/types/array_chat_message_content_item.py +2 -10
- vellum/types/array_chat_message_content_item_request.py +2 -13
- vellum/types/array_chat_message_content_request.py +2 -24
- vellum/types/array_input.py +2 -35
- vellum/types/array_variable_value.py +2 -26
- vellum/types/array_variable_value_item.py +2 -28
- vellum/types/array_vellum_value.py +2 -30
- vellum/types/array_vellum_value_request.py +2 -30
- vellum/types/audio_chat_message_content.py +2 -24
- vellum/types/audio_chat_message_content_request.py +2 -24
- vellum/types/audio_variable_value.py +2 -24
- vellum/types/audio_vellum_value.py +2 -24
- vellum/types/audio_vellum_value_request.py +2 -24
- vellum/types/basic_vectorizer_intfloat_multilingual_e_5_large.py +2 -23
- vellum/types/basic_vectorizer_intfloat_multilingual_e_5_large_request.py +2 -23
- vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1.py +2 -25
- vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_cos_v_1_request.py +2 -25
- vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1.py +2 -25
- vellum/types/basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1_request.py +2 -25
- vellum/types/chat_history_input.py +2 -29
- vellum/types/chat_history_input_request.py +2 -29
- vellum/types/chat_history_variable_value.py +2 -20
- vellum/types/chat_history_vellum_value.py +2 -24
- vellum/types/chat_history_vellum_value_request.py +2 -24
- vellum/types/chat_message.py +2 -26
- vellum/types/chat_message_content.py +2 -15
- vellum/types/chat_message_content_request.py +2 -15
- vellum/types/chat_message_prompt_block.py +2 -38
- vellum/types/chat_message_request.py +2 -26
- vellum/types/chat_message_role.py +2 -4
- vellum/types/code_execution_node_array_result.py +2 -27
- vellum/types/code_execution_node_chat_history_result.py +2 -21
- vellum/types/code_execution_node_error_result.py +2 -21
- vellum/types/code_execution_node_function_call_result.py +2 -21
- vellum/types/code_execution_node_json_result.py +2 -20
- vellum/types/code_execution_node_number_result.py +2 -20
- vellum/types/code_execution_node_result.py +2 -30
- vellum/types/code_execution_node_result_data.py +2 -26
- vellum/types/code_execution_node_result_output.py +2 -21
- vellum/types/code_execution_node_search_results_result.py +2 -21
- vellum/types/code_execution_node_string_result.py +2 -20
- vellum/types/code_execution_package.py +2 -19
- vellum/types/code_execution_runtime.py +2 -4
- vellum/types/code_executor_input.py +2 -23
- vellum/types/code_executor_response.py +2 -26
- vellum/types/code_executor_secret_input.py +2 -28
- vellum/types/compile_prompt_deployment_expand_meta_request.py +2 -31
- vellum/types/compile_prompt_meta.py +2 -24
- vellum/types/components_schemas_pdf_search_result_meta_source.py +2 -4
- vellum/types/components_schemas_pdf_search_result_meta_source_request.py +2 -4
- vellum/types/condition_combinator.py +2 -4
- vellum/types/conditional_node_result.py +2 -24
- vellum/types/conditional_node_result_data.py +2 -18
- vellum/types/container_image_read.py +2 -27
- vellum/types/create_test_suite_test_case_request.py +2 -47
- vellum/types/deployment_provider_payload_response.py +2 -21
- vellum/types/deployment_provider_payload_response_payload.py +2 -4
- vellum/types/deployment_read.py +2 -72
- vellum/types/deployment_release_tag_deployment_history_item.py +2 -20
- vellum/types/deployment_release_tag_read.py +2 -36
- vellum/types/docker_service_token.py +2 -20
- vellum/types/document_document_to_document_index.py +2 -38
- vellum/types/document_index_chunking.py +2 -7
- vellum/types/document_index_chunking_request.py +2 -9
- vellum/types/document_index_indexing_config.py +2 -21
- vellum/types/document_index_indexing_config_request.py +2 -21
- vellum/types/document_index_read.py +2 -51
- vellum/types/document_processing_state.py +2 -6
- vellum/types/document_read.py +2 -48
- vellum/types/document_status.py +2 -4
- vellum/types/enriched_normalized_completion.py +2 -58
- vellum/types/entity_status.py +2 -4
- vellum/types/entity_visibility.py +2 -4
- vellum/types/environment_enum.py +2 -4
- vellum/types/ephemeral_prompt_cache_config.py +2 -19
- vellum/types/ephemeral_prompt_cache_config_type_enum.py +2 -4
- vellum/types/error_input.py +2 -29
- vellum/types/error_variable_value.py +2 -20
- vellum/types/error_vellum_value.py +2 -24
- vellum/types/error_vellum_value_request.py +2 -24
- vellum/types/execute_prompt_event.py +2 -10
- vellum/types/execute_prompt_response.py +2 -6
- vellum/types/execute_workflow_response.py +2 -28
- vellum/types/execute_workflow_workflow_result_event.py +2 -8
- vellum/types/execution_array_vellum_value.py +2 -36
- vellum/types/execution_chat_history_vellum_value.py +2 -30
- vellum/types/execution_error_vellum_value.py +2 -30
- vellum/types/execution_function_call_vellum_value.py +2 -30
- vellum/types/execution_json_vellum_value.py +2 -29
- vellum/types/execution_number_vellum_value.py +2 -29
- vellum/types/execution_search_results_vellum_value.py +2 -30
- vellum/types/execution_string_vellum_value.py +2 -29
- vellum/types/execution_vellum_value.py +2 -21
- vellum/types/external_test_case_execution.py +2 -30
- vellum/types/external_test_case_execution_request.py +2 -30
- vellum/types/finish_reason_enum.py +2 -4
- vellum/types/folder_entity.py +2 -15
- vellum/types/folder_entity_document_index.py +2 -25
- vellum/types/folder_entity_document_index_data.py +2 -24
- vellum/types/folder_entity_folder.py +2 -25
- vellum/types/folder_entity_folder_data.py +2 -23
- vellum/types/folder_entity_prompt_sandbox.py +2 -25
- vellum/types/folder_entity_prompt_sandbox_data.py +2 -25
- vellum/types/folder_entity_test_suite.py +2 -25
- vellum/types/folder_entity_test_suite_data.py +2 -24
- vellum/types/folder_entity_workflow_sandbox.py +2 -25
- vellum/types/folder_entity_workflow_sandbox_data.py +2 -25
- vellum/types/fulfilled_ad_hoc_execute_prompt_event.py +2 -27
- vellum/types/fulfilled_enum.py +2 -4
- vellum/types/fulfilled_execute_prompt_event.py +2 -27
- vellum/types/fulfilled_execute_prompt_response.py +2 -36
- vellum/types/fulfilled_execute_workflow_workflow_result_event.py +2 -35
- vellum/types/fulfilled_prompt_execution_meta.py +2 -26
- vellum/types/fulfilled_workflow_node_result_event.py +2 -39
- vellum/types/function_call.py +2 -26
- vellum/types/function_call_chat_message_content.py +2 -24
- vellum/types/function_call_chat_message_content_request.py +2 -24
- vellum/types/function_call_chat_message_content_value.py +2 -24
- vellum/types/function_call_chat_message_content_value_request.py +2 -24
- vellum/types/function_call_input.py +2 -29
- vellum/types/function_call_request.py +2 -26
- vellum/types/function_call_variable_value.py +2 -20
- vellum/types/function_call_vellum_value.py +2 -24
- vellum/types/function_call_vellum_value_request.py +2 -24
- vellum/types/function_definition.py +2 -30
- vellum/types/generate_options_request.py +2 -25
- vellum/types/generate_request.py +2 -32
- vellum/types/generate_response.py +2 -24
- vellum/types/generate_result.py +2 -28
- vellum/types/generate_result_data.py +2 -22
- vellum/types/generate_result_error.py +2 -21
- vellum/types/generate_stream_response.py +2 -19
- vellum/types/generate_stream_result.py +2 -22
- vellum/types/generate_stream_result_data.py +2 -20
- vellum/types/google_vertex_ai_vectorizer_config.py +2 -19
- vellum/types/google_vertex_ai_vectorizer_config_request.py +2 -19
- vellum/types/google_vertex_ai_vectorizer_text_embedding_004.py +2 -20
- vellum/types/google_vertex_ai_vectorizer_text_embedding_004_request.py +2 -20
- vellum/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002.py +2 -20
- vellum/types/google_vertex_ai_vectorizer_text_multilingual_embedding_002_request.py +2 -20
- vellum/types/hkunlp_instructor_xl_vectorizer.py +2 -24
- vellum/types/hkunlp_instructor_xl_vectorizer_request.py +2 -24
- vellum/types/image_chat_message_content.py +2 -24
- vellum/types/image_chat_message_content_request.py +2 -24
- vellum/types/image_variable_value.py +2 -24
- vellum/types/image_vellum_value.py +2 -24
- vellum/types/image_vellum_value_request.py +2 -24
- vellum/types/indexing_config_vectorizer.py +2 -29
- vellum/types/indexing_config_vectorizer_request.py +2 -29
- vellum/types/indexing_state_enum.py +2 -6
- vellum/types/initiated_ad_hoc_execute_prompt_event.py +2 -25
- vellum/types/initiated_execute_prompt_event.py +2 -25
- vellum/types/initiated_prompt_execution_meta.py +2 -25
- vellum/types/initiated_workflow_node_result_event.py +2 -38
- vellum/types/instructor_vectorizer_config.py +2 -24
- vellum/types/instructor_vectorizer_config_request.py +2 -24
- vellum/types/iteration_state_enum.py +2 -4
- vellum/types/jinja_prompt_block.py +2 -27
- vellum/types/json_input.py +2 -28
- vellum/types/json_input_request.py +2 -28
- vellum/types/json_variable_value.py +2 -19
- vellum/types/json_vellum_value.py +2 -23
- vellum/types/json_vellum_value_request.py +2 -23
- vellum/types/logical_operator.py +2 -28
- vellum/types/logprobs_enum.py +2 -4
- vellum/types/map_node_result.py +2 -24
- vellum/types/map_node_result_data.py +2 -20
- vellum/types/merge_node_result.py +2 -24
- vellum/types/merge_node_result_data.py +2 -18
- vellum/types/metadata_filter_config_request.py +2 -35
- vellum/types/metadata_filter_rule_combinator.py +2 -4
- vellum/types/metadata_filter_rule_request.py +2 -30
- vellum/types/metadata_filters_request.py +2 -6
- vellum/types/metric_definition_execution.py +2 -19
- vellum/types/metric_definition_input.py +2 -8
- vellum/types/metric_node_result.py +2 -22
- vellum/types/ml_model_usage.py +2 -24
- vellum/types/named_scenario_input_chat_history_variable_value_request.py +2 -25
- vellum/types/named_scenario_input_json_variable_value_request.py +2 -24
- vellum/types/named_scenario_input_request.py +2 -11
- vellum/types/named_scenario_input_string_variable_value_request.py +2 -24
- vellum/types/named_test_case_array_variable_value.py +2 -31
- vellum/types/named_test_case_array_variable_value_request.py +2 -33
- vellum/types/named_test_case_chat_history_variable_value.py +2 -25
- vellum/types/named_test_case_chat_history_variable_value_request.py +2 -25
- vellum/types/named_test_case_error_variable_value.py +2 -25
- vellum/types/named_test_case_error_variable_value_request.py +2 -25
- vellum/types/named_test_case_function_call_variable_value.py +2 -25
- vellum/types/named_test_case_function_call_variable_value_request.py +2 -25
- vellum/types/named_test_case_json_variable_value.py +2 -24
- vellum/types/named_test_case_json_variable_value_request.py +2 -24
- vellum/types/named_test_case_number_variable_value.py +2 -24
- vellum/types/named_test_case_number_variable_value_request.py +2 -24
- vellum/types/named_test_case_search_results_variable_value.py +2 -25
- vellum/types/named_test_case_search_results_variable_value_request.py +2 -25
- vellum/types/named_test_case_string_variable_value.py +2 -24
- vellum/types/named_test_case_string_variable_value_request.py +2 -24
- vellum/types/named_test_case_variable_value.py +2 -21
- vellum/types/named_test_case_variable_value_request.py +2 -21
- vellum/types/node_input_compiled_array_value.py +2 -28
- vellum/types/node_input_compiled_chat_history_value.py +2 -22
- vellum/types/node_input_compiled_error_value.py +2 -22
- vellum/types/node_input_compiled_function_call_value.py +2 -22
- vellum/types/node_input_compiled_json_value.py +2 -21
- vellum/types/node_input_compiled_number_value.py +2 -21
- vellum/types/node_input_compiled_search_results_value.py +2 -22
- vellum/types/node_input_compiled_string_value.py +2 -21
- vellum/types/node_input_variable_compiled_value.py +2 -21
- vellum/types/node_output_compiled_array_value.py +2 -33
- vellum/types/node_output_compiled_chat_history_value.py +2 -27
- vellum/types/node_output_compiled_error_value.py +2 -27
- vellum/types/node_output_compiled_function_call_value.py +2 -27
- vellum/types/node_output_compiled_json_value.py +2 -26
- vellum/types/node_output_compiled_number_value.py +2 -26
- vellum/types/node_output_compiled_search_results_value.py +2 -27
- vellum/types/node_output_compiled_string_value.py +2 -26
- vellum/types/node_output_compiled_value.py +2 -21
- vellum/types/normalized_log_probs.py +2 -20
- vellum/types/normalized_token_log_probs.py +2 -21
- vellum/types/number_input.py +2 -28
- vellum/types/number_variable_value.py +2 -19
- vellum/types/number_vellum_value.py +2 -23
- vellum/types/number_vellum_value_request.py +2 -23
- vellum/types/open_ai_vectorizer_config.py +2 -23
- vellum/types/open_ai_vectorizer_config_request.py +2 -23
- vellum/types/open_ai_vectorizer_text_embedding_3_large.py +2 -24
- vellum/types/open_ai_vectorizer_text_embedding_3_large_request.py +2 -24
- vellum/types/open_ai_vectorizer_text_embedding_3_small.py +2 -24
- vellum/types/open_ai_vectorizer_text_embedding_3_small_request.py +2 -24
- vellum/types/open_ai_vectorizer_text_embedding_ada_002.py +2 -24
- vellum/types/open_ai_vectorizer_text_embedding_ada_002_request.py +2 -24
- vellum/types/paginated_container_image_read_list.py +2 -22
- vellum/types/paginated_deployment_release_tag_read_list.py +2 -22
- vellum/types/paginated_document_index_read_list.py +2 -22
- vellum/types/paginated_folder_entity_list.py +2 -22
- vellum/types/paginated_slim_deployment_read_list.py +2 -28
- vellum/types/paginated_slim_document_list.py +2 -22
- vellum/types/paginated_slim_workflow_deployment_list.py +2 -28
- vellum/types/paginated_test_suite_run_execution_list.py +2 -28
- vellum/types/paginated_test_suite_test_case_list.py +2 -28
- vellum/types/paginated_workflow_release_tag_read_list.py +2 -22
- vellum/types/pdf_search_result_meta_source.py +2 -31
- vellum/types/pdf_search_result_meta_source_request.py +2 -31
- vellum/types/plain_text_prompt_block.py +2 -27
- vellum/types/price.py +2 -20
- vellum/types/processing_failure_reason_enum.py +2 -4
- vellum/types/prompt_block.py +2 -11
- vellum/types/prompt_block_state.py +2 -4
- vellum/types/prompt_deployment_expand_meta_request.py +2 -51
- vellum/types/prompt_deployment_input_request.py +2 -7
- vellum/types/prompt_execution_meta.py +2 -31
- vellum/types/prompt_node_execution_meta.py +2 -23
- vellum/types/prompt_node_result.py +2 -24
- vellum/types/prompt_node_result_data.py +2 -24
- vellum/types/prompt_output.py +2 -8
- vellum/types/prompt_parameters.py +2 -26
- vellum/types/prompt_request_chat_history_input.py +2 -25
- vellum/types/prompt_request_input.py +2 -7
- vellum/types/prompt_request_json_input.py +2 -24
- vellum/types/prompt_request_string_input.py +2 -24
- vellum/types/prompt_settings.py +2 -18
- vellum/types/raw_prompt_execution_overrides_request.py +2 -27
- vellum/types/reducto_chunker_config.py +2 -22
- vellum/types/reducto_chunker_config_request.py +2 -22
- vellum/types/reducto_chunking.py +2 -24
- vellum/types/reducto_chunking_request.py +2 -24
- vellum/types/rejected_ad_hoc_execute_prompt_event.py +2 -27
- vellum/types/rejected_execute_prompt_event.py +2 -27
- vellum/types/rejected_execute_prompt_response.py +2 -36
- vellum/types/rejected_execute_workflow_workflow_result_event.py +2 -27
- vellum/types/rejected_prompt_execution_meta.py +2 -24
- vellum/types/rejected_workflow_node_result_event.py +2 -38
- vellum/types/release_tag_source.py +2 -4
- vellum/types/replace_test_suite_test_case_request.py +2 -52
- vellum/types/rich_text_child_block.py +2 -6
- vellum/types/rich_text_prompt_block.py +2 -28
- vellum/types/sandbox_scenario.py +2 -32
- vellum/types/scenario_input.py +2 -9
- vellum/types/scenario_input_chat_history_variable_value.py +2 -25
- vellum/types/scenario_input_json_variable_value.py +2 -24
- vellum/types/scenario_input_string_variable_value.py +2 -24
- vellum/types/search_filters_request.py +2 -37
- vellum/types/search_node_result.py +2 -24
- vellum/types/search_node_result_data.py +2 -26
- vellum/types/search_request_options_request.py +2 -49
- vellum/types/search_response.py +2 -22
- vellum/types/search_result.py +2 -39
- vellum/types/search_result_document.py +2 -36
- vellum/types/search_result_document_request.py +2 -36
- vellum/types/search_result_merging_request.py +2 -21
- vellum/types/search_result_meta.py +2 -19
- vellum/types/search_result_meta_request.py +2 -19
- vellum/types/search_result_request.py +2 -39
- vellum/types/search_results_input.py +2 -29
- vellum/types/search_results_variable_value.py +2 -20
- vellum/types/search_results_vellum_value.py +2 -24
- vellum/types/search_results_vellum_value_request.py +2 -24
- vellum/types/search_weights_request.py +2 -26
- vellum/types/secret_type_enum.py +2 -4
- vellum/types/sentence_chunker_config.py +2 -23
- vellum/types/sentence_chunker_config_request.py +2 -23
- vellum/types/sentence_chunking.py +2 -24
- vellum/types/sentence_chunking_request.py +2 -24
- vellum/types/slim_deployment_read.py +2 -62
- vellum/types/slim_document.py +2 -69
- vellum/types/slim_workflow_deployment.py +2 -71
- vellum/types/streaming_ad_hoc_execute_prompt_event.py +2 -32
- vellum/types/streaming_execute_prompt_event.py +2 -32
- vellum/types/streaming_prompt_execution_meta.py +2 -22
- vellum/types/streaming_workflow_node_result_event.py +2 -39
- vellum/types/string_chat_message_content.py +2 -23
- vellum/types/string_chat_message_content_request.py +2 -23
- vellum/types/string_input.py +2 -28
- vellum/types/string_input_request.py +2 -28
- vellum/types/string_variable_value.py +2 -19
- vellum/types/string_vellum_value.py +2 -23
- vellum/types/string_vellum_value_request.py +2 -23
- vellum/types/submit_completion_actual_request.py +2 -47
- vellum/types/submit_workflow_execution_actual_request.py +2 -9
- vellum/types/subworkflow_node_result.py +2 -24
- vellum/types/subworkflow_node_result_data.py +2 -18
- vellum/types/templating_node_array_result.py +2 -27
- vellum/types/templating_node_chat_history_result.py +2 -21
- vellum/types/templating_node_error_result.py +2 -21
- vellum/types/templating_node_function_call_result.py +2 -21
- vellum/types/templating_node_json_result.py +2 -20
- vellum/types/templating_node_number_result.py +2 -20
- vellum/types/templating_node_result.py +2 -30
- vellum/types/templating_node_result_data.py +2 -25
- vellum/types/templating_node_result_output.py +2 -21
- vellum/types/templating_node_search_results_result.py +2 -21
- vellum/types/templating_node_string_result.py +2 -20
- vellum/types/terminal_node_array_result.py +2 -32
- vellum/types/terminal_node_chat_history_result.py +2 -26
- vellum/types/terminal_node_error_result.py +2 -26
- vellum/types/terminal_node_function_call_result.py +2 -26
- vellum/types/terminal_node_json_result.py +2 -25
- vellum/types/terminal_node_number_result.py +2 -25
- vellum/types/terminal_node_result.py +2 -30
- vellum/types/terminal_node_result_data.py +2 -25
- vellum/types/terminal_node_result_output.py +2 -21
- vellum/types/terminal_node_search_results_result.py +2 -26
- vellum/types/terminal_node_string_result.py +2 -25
- vellum/types/test_case_array_variable_value.py +2 -32
- vellum/types/test_case_chat_history_variable_value.py +2 -26
- vellum/types/test_case_error_variable_value.py +2 -26
- vellum/types/test_case_function_call_variable_value.py +2 -26
- vellum/types/test_case_json_variable_value.py +2 -25
- vellum/types/test_case_number_variable_value.py +2 -25
- vellum/types/test_case_search_results_variable_value.py +2 -26
- vellum/types/test_case_string_variable_value.py +2 -25
- vellum/types/test_case_variable_value.py +2 -21
- vellum/types/test_suite_run_deployment_release_tag_exec_config.py +2 -28
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data.py +2 -26
- vellum/types/test_suite_run_deployment_release_tag_exec_config_data_request.py +2 -26
- vellum/types/test_suite_run_deployment_release_tag_exec_config_request.py +2 -30
- vellum/types/test_suite_run_exec_config.py +2 -9
- vellum/types/test_suite_run_exec_config_request.py +2 -11
- vellum/types/test_suite_run_execution.py +2 -29
- vellum/types/test_suite_run_execution_array_output.py +2 -32
- vellum/types/test_suite_run_execution_chat_history_output.py +2 -26
- vellum/types/test_suite_run_execution_error_output.py +2 -26
- vellum/types/test_suite_run_execution_function_call_output.py +2 -26
- vellum/types/test_suite_run_execution_json_output.py +2 -25
- vellum/types/test_suite_run_execution_metric_definition.py +2 -20
- vellum/types/test_suite_run_execution_metric_result.py +2 -23
- vellum/types/test_suite_run_execution_number_output.py +2 -25
- vellum/types/test_suite_run_execution_output.py +2 -21
- vellum/types/test_suite_run_execution_search_results_output.py +2 -26
- vellum/types/test_suite_run_execution_string_output.py +2 -25
- vellum/types/test_suite_run_external_exec_config.py +2 -35
- vellum/types/test_suite_run_external_exec_config_data.py +2 -28
- vellum/types/test_suite_run_external_exec_config_data_request.py +2 -30
- vellum/types/test_suite_run_external_exec_config_request.py +2 -37
- vellum/types/test_suite_run_metric_error_output.py +2 -25
- vellum/types/test_suite_run_metric_json_output.py +2 -24
- vellum/types/test_suite_run_metric_number_output.py +2 -24
- vellum/types/test_suite_run_metric_output.py +2 -13
- vellum/types/test_suite_run_metric_string_output.py +2 -24
- vellum/types/test_suite_run_read.py +2 -45
- vellum/types/test_suite_run_state.py +2 -4
- vellum/types/test_suite_run_test_suite.py +2 -20
- vellum/types/test_suite_run_workflow_release_tag_exec_config.py +2 -28
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data.py +2 -26
- vellum/types/test_suite_run_workflow_release_tag_exec_config_data_request.py +2 -26
- vellum/types/test_suite_run_workflow_release_tag_exec_config_request.py +2 -30
- vellum/types/test_suite_test_case.py +2 -29
- vellum/types/test_suite_test_case_bulk_operation_request.py +2 -13
- vellum/types/test_suite_test_case_bulk_result.py +2 -13
- vellum/types/test_suite_test_case_create_bulk_operation_request.py +2 -37
- vellum/types/test_suite_test_case_created_bulk_result.py +2 -25
- vellum/types/test_suite_test_case_created_bulk_result_data.py +2 -22
- vellum/types/test_suite_test_case_delete_bulk_operation_data_request.py +2 -18
- vellum/types/test_suite_test_case_delete_bulk_operation_request.py +2 -32
- vellum/types/test_suite_test_case_deleted_bulk_result.py +2 -29
- vellum/types/test_suite_test_case_deleted_bulk_result_data.py +2 -22
- vellum/types/test_suite_test_case_rejected_bulk_result.py +2 -31
- vellum/types/test_suite_test_case_replace_bulk_operation_request.py +2 -37
- vellum/types/test_suite_test_case_replaced_bulk_result.py +2 -29
- vellum/types/test_suite_test_case_replaced_bulk_result_data.py +2 -22
- vellum/types/test_suite_test_case_upsert_bulk_operation_request.py +2 -37
- vellum/types/token_overlapping_window_chunker_config.py +2 -23
- vellum/types/token_overlapping_window_chunker_config_request.py +2 -23
- vellum/types/token_overlapping_window_chunking.py +2 -24
- vellum/types/token_overlapping_window_chunking_request.py +2 -24
- vellum/types/unit_enum.py +2 -4
- vellum/types/upload_document_response.py +2 -21
- vellum/types/upsert_test_suite_test_case_request.py +2 -48
- vellum/types/variable_prompt_block.py +2 -27
- vellum/types/vellum_audio.py +2 -23
- vellum/types/vellum_audio_request.py +2 -23
- vellum/types/vellum_error.py +2 -20
- vellum/types/vellum_error_code_enum.py +2 -14
- vellum/types/vellum_error_request.py +2 -20
- vellum/types/vellum_image.py +2 -19
- vellum/types/vellum_image_request.py +2 -19
- vellum/types/vellum_value.py +2 -28
- vellum/types/vellum_value_logical_condition_group_request.py +2 -37
- vellum/types/vellum_value_logical_condition_request.py +2 -33
- vellum/types/vellum_value_logical_expression_request.py +2 -11
- vellum/types/vellum_value_request.py +2 -28
- vellum/types/vellum_variable.py +2 -32
- vellum/types/vellum_variable_extensions.py +2 -22
- vellum/types/vellum_variable_type.py +2 -19
- vellum/types/workflow_deployment_read.py +2 -76
- vellum/types/workflow_event_error.py +2 -20
- vellum/types/workflow_execution_actual_chat_history_request.py +2 -48
- vellum/types/workflow_execution_actual_json_request.py +2 -47
- vellum/types/workflow_execution_actual_string_request.py +2 -47
- vellum/types/workflow_execution_event_error_code.py +2 -16
- vellum/types/workflow_execution_event_type.py +2 -4
- vellum/types/workflow_execution_node_result_event.py +2 -33
- vellum/types/workflow_execution_workflow_result_event.py +2 -35
- vellum/types/workflow_expand_meta_request.py +2 -21
- vellum/types/workflow_node_result_data.py +2 -27
- vellum/types/workflow_node_result_event.py +2 -13
- vellum/types/workflow_node_result_event_state.py +2 -6
- vellum/types/workflow_output.py +2 -23
- vellum/types/workflow_output_array.py +2 -36
- vellum/types/workflow_output_chat_history.py +2 -30
- vellum/types/workflow_output_error.py +2 -30
- vellum/types/workflow_output_function_call.py +2 -30
- vellum/types/workflow_output_image.py +2 -30
- vellum/types/workflow_output_json.py +2 -29
- vellum/types/workflow_output_number.py +2 -29
- vellum/types/workflow_output_search_results.py +2 -30
- vellum/types/workflow_output_string.py +2 -29
- vellum/types/workflow_push_deployment_config_request.py +2 -21
- vellum/types/workflow_push_exec_config.py +2 -2
- vellum/types/workflow_push_response.py +2 -19
- vellum/types/workflow_release_tag_read.py +2 -36
- vellum/types/workflow_release_tag_workflow_deployment_history_item.py +2 -27
- vellum/types/workflow_request_chat_history_input_request.py +2 -29
- vellum/types/workflow_request_input_request.py +2 -13
- vellum/types/workflow_request_json_input_request.py +2 -28
- vellum/types/workflow_request_number_input_request.py +2 -28
- vellum/types/workflow_request_string_input_request.py +2 -28
- vellum/types/workflow_result_event.py +2 -38
- vellum/types/workflow_result_event_output_data.py +2 -21
- vellum/types/workflow_result_event_output_data_array.py +2 -40
- vellum/types/workflow_result_event_output_data_chat_history.py +2 -34
- vellum/types/workflow_result_event_output_data_error.py +2 -34
- vellum/types/workflow_result_event_output_data_function_call.py +2 -34
- vellum/types/workflow_result_event_output_data_json.py +2 -33
- vellum/types/workflow_result_event_output_data_number.py +2 -33
- vellum/types/workflow_result_event_output_data_search_results.py +2 -34
- vellum/types/workflow_result_event_output_data_string.py +2 -36
- vellum/types/workflow_stream_event.py +2 -6
- vellum/types/workspace_secret_read.py +2 -24
- {vellum_ai-0.9.16.dist-info → vellum_ai-0.9.16rc2.dist-info}/LICENSE +11 -3
- vellum_ai-0.9.16rc2.dist-info/METADATA +119 -0
- vellum_ai-0.9.16rc2.dist-info/RECORD +1101 -0
- vellum_ai-0.9.16rc2.dist-info/entry_points.txt +3 -0
- vellum_cli/__init__.py +0 -0
- vellum_ee/__init__.py +0 -0
- vellum/lib/__init__.py +0 -5
- vellum_ai-0.9.16.dist-info/METADATA +0 -148
- vellum_ai-0.9.16.dist-info/RECORD +0 -558
- /vellum/{client.py → client/__init__.py} +0 -0
- /vellum/{lib/test_suites → evaluations}/__init__.py +0 -0
- /vellum/{lib/test_suites → evaluations}/constants.py +0 -0
- /vellum/{lib/test_suites → evaluations}/exceptions.py +0 -0
- /vellum/{lib → evaluations}/utils/__init__.py +0 -0
- /vellum/{lib → evaluations}/utils/env.py +0 -0
- /vellum/{lib → evaluations}/utils/exceptions.py +0 -0
- /vellum/{lib → evaluations}/utils/paginator.py +0 -0
- /vellum/{lib → evaluations}/utils/typing.py +0 -0
- /vellum/{lib → evaluations}/utils/uuid.py +0 -0
- {vellum_ai-0.9.16.dist-info → vellum_ai-0.9.16rc2.dist-info}/WHEEL +0 -0
@@ -1,296 +1,3 @@
|
|
1
|
-
# This file
|
1
|
+
# WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
|
2
2
|
|
3
|
-
|
4
|
-
import datetime as dt
|
5
|
-
import typing
|
6
|
-
from collections import defaultdict
|
7
|
-
|
8
|
-
import typing_extensions
|
9
|
-
|
10
|
-
import pydantic
|
11
|
-
|
12
|
-
from .datetime_utils import serialize_datetime
|
13
|
-
from .serialization import convert_and_respect_annotation_metadata
|
14
|
-
|
15
|
-
IS_PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
|
16
|
-
|
17
|
-
if IS_PYDANTIC_V2:
|
18
|
-
# isort will try to reformat the comments on these imports, which breaks mypy
|
19
|
-
# isort: off
|
20
|
-
from pydantic.v1.datetime_parse import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
21
|
-
parse_date as parse_date,
|
22
|
-
)
|
23
|
-
from pydantic.v1.datetime_parse import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
24
|
-
parse_datetime as parse_datetime,
|
25
|
-
)
|
26
|
-
from pydantic.v1.json import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
27
|
-
ENCODERS_BY_TYPE as encoders_by_type,
|
28
|
-
)
|
29
|
-
from pydantic.v1.typing import ( # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
30
|
-
get_args as get_args,
|
31
|
-
)
|
32
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
33
|
-
get_origin as get_origin,
|
34
|
-
)
|
35
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
36
|
-
is_literal_type as is_literal_type,
|
37
|
-
)
|
38
|
-
from pydantic.v1.typing import ( # pyright: ignore[reportMissingImports] # Pydantic v2
|
39
|
-
is_union as is_union,
|
40
|
-
)
|
41
|
-
from pydantic.v1.fields import ModelField as ModelField # type: ignore # pyright: ignore[reportMissingImports] # Pydantic v2
|
42
|
-
else:
|
43
|
-
from pydantic.datetime_parse import parse_date as parse_date # type: ignore # Pydantic v1
|
44
|
-
from pydantic.datetime_parse import parse_datetime as parse_datetime # type: ignore # Pydantic v1
|
45
|
-
from pydantic.fields import ModelField as ModelField # type: ignore # Pydantic v1
|
46
|
-
from pydantic.json import ENCODERS_BY_TYPE as encoders_by_type # type: ignore # Pydantic v1
|
47
|
-
from pydantic.typing import get_args as get_args # type: ignore # Pydantic v1
|
48
|
-
from pydantic.typing import get_origin as get_origin # type: ignore # Pydantic v1
|
49
|
-
from pydantic.typing import is_literal_type as is_literal_type # type: ignore # Pydantic v1
|
50
|
-
from pydantic.typing import is_union as is_union # type: ignore # Pydantic v1
|
51
|
-
|
52
|
-
# isort: on
|
53
|
-
|
54
|
-
|
55
|
-
T = typing.TypeVar("T")
|
56
|
-
Model = typing.TypeVar("Model", bound=pydantic.BaseModel)
|
57
|
-
|
58
|
-
|
59
|
-
def parse_obj_as(type_: typing.Type[T], object_: typing.Any) -> T:
|
60
|
-
dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read")
|
61
|
-
if IS_PYDANTIC_V2:
|
62
|
-
adapter = pydantic.TypeAdapter(type_) # type: ignore # Pydantic v2
|
63
|
-
return adapter.validate_python(dealiased_object)
|
64
|
-
else:
|
65
|
-
return pydantic.parse_obj_as(type_, dealiased_object)
|
66
|
-
|
67
|
-
|
68
|
-
def to_jsonable_with_fallback(
|
69
|
-
obj: typing.Any, fallback_serializer: typing.Callable[[typing.Any], typing.Any]
|
70
|
-
) -> typing.Any:
|
71
|
-
if IS_PYDANTIC_V2:
|
72
|
-
from pydantic_core import to_jsonable_python
|
73
|
-
|
74
|
-
return to_jsonable_python(obj, fallback=fallback_serializer)
|
75
|
-
else:
|
76
|
-
return fallback_serializer(obj)
|
77
|
-
|
78
|
-
|
79
|
-
class UniversalBaseModel(pydantic.BaseModel):
|
80
|
-
if IS_PYDANTIC_V2:
|
81
|
-
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
82
|
-
# Allow fields begining with `model_` to be used in the model
|
83
|
-
protected_namespaces=(),
|
84
|
-
) # type: ignore # Pydantic v2
|
85
|
-
|
86
|
-
@pydantic.model_serializer(mode="wrap", when_used="json") # type: ignore # Pydantic v2
|
87
|
-
def serialize_model(self, handler: pydantic.SerializerFunctionWrapHandler) -> typing.Any: # type: ignore # Pydantic v2
|
88
|
-
serialized = handler(self)
|
89
|
-
data = {k: serialize_datetime(v) if isinstance(v, dt.datetime) else v for k, v in serialized.items()}
|
90
|
-
return data
|
91
|
-
|
92
|
-
else:
|
93
|
-
|
94
|
-
class Config:
|
95
|
-
smart_union = True
|
96
|
-
json_encoders = {dt.datetime: serialize_datetime}
|
97
|
-
|
98
|
-
@classmethod
|
99
|
-
def model_construct(
|
100
|
-
cls: typing.Type["Model"], _fields_set: typing.Optional[typing.Set[str]] = None, **values: typing.Any
|
101
|
-
) -> "Model":
|
102
|
-
dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
|
103
|
-
return cls.construct(_fields_set, **dealiased_object)
|
104
|
-
|
105
|
-
@classmethod
|
106
|
-
def construct(
|
107
|
-
cls: typing.Type["Model"], _fields_set: typing.Optional[typing.Set[str]] = None, **values: typing.Any
|
108
|
-
) -> "Model":
|
109
|
-
dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read")
|
110
|
-
if IS_PYDANTIC_V2:
|
111
|
-
return super().model_construct(_fields_set, **dealiased_object) # type: ignore # Pydantic v2
|
112
|
-
else:
|
113
|
-
return super().construct(_fields_set, **dealiased_object)
|
114
|
-
|
115
|
-
def json(self, **kwargs: typing.Any) -> str:
|
116
|
-
kwargs_with_defaults: typing.Any = {
|
117
|
-
"by_alias": True,
|
118
|
-
"exclude_unset": True,
|
119
|
-
**kwargs,
|
120
|
-
}
|
121
|
-
if IS_PYDANTIC_V2:
|
122
|
-
return super().model_dump_json(**kwargs_with_defaults) # type: ignore # Pydantic v2
|
123
|
-
else:
|
124
|
-
return super().json(**kwargs_with_defaults)
|
125
|
-
|
126
|
-
def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
127
|
-
"""
|
128
|
-
Override the default dict method to `exclude_unset` by default. This function patches
|
129
|
-
`exclude_unset` to work include fields within non-None default values.
|
130
|
-
"""
|
131
|
-
# Note: the logic here is multi-plexed given the levers exposed in Pydantic V1 vs V2
|
132
|
-
# Pydantic V1's .dict can be extremely slow, so we do not want to call it twice.
|
133
|
-
#
|
134
|
-
# We'd ideally do the same for Pydantic V2, but it shells out to a library to serialize models
|
135
|
-
# that we have less control over, and this is less intrusive than custom serializers for now.
|
136
|
-
if IS_PYDANTIC_V2:
|
137
|
-
kwargs_with_defaults_exclude_unset: typing.Any = {
|
138
|
-
**kwargs,
|
139
|
-
"by_alias": True,
|
140
|
-
"exclude_unset": True,
|
141
|
-
"exclude_none": False,
|
142
|
-
}
|
143
|
-
kwargs_with_defaults_exclude_none: typing.Any = {
|
144
|
-
**kwargs,
|
145
|
-
"by_alias": True,
|
146
|
-
"exclude_none": True,
|
147
|
-
"exclude_unset": False,
|
148
|
-
}
|
149
|
-
dict_dump = deep_union_pydantic_dicts(
|
150
|
-
super().model_dump(**kwargs_with_defaults_exclude_unset), # type: ignore # Pydantic v2
|
151
|
-
super().model_dump(**kwargs_with_defaults_exclude_none), # type: ignore # Pydantic v2
|
152
|
-
)
|
153
|
-
|
154
|
-
else:
|
155
|
-
_fields_set = self.__fields_set__.copy()
|
156
|
-
|
157
|
-
fields = _get_model_fields(self.__class__)
|
158
|
-
for name, field in fields.items():
|
159
|
-
if name not in _fields_set:
|
160
|
-
default = _get_field_default(field)
|
161
|
-
|
162
|
-
# If the default values are non-null act like they've been set
|
163
|
-
# This effectively allows exclude_unset to work like exclude_none where
|
164
|
-
# the latter passes through intentionally set none values.
|
165
|
-
if default is not None or ("exclude_unset" in kwargs and not kwargs["exclude_unset"]):
|
166
|
-
_fields_set.add(name)
|
167
|
-
|
168
|
-
if default is not None:
|
169
|
-
self.__fields_set__.add(name)
|
170
|
-
|
171
|
-
kwargs_with_defaults_exclude_unset_include_fields: typing.Any = {
|
172
|
-
"by_alias": True,
|
173
|
-
"exclude_unset": True,
|
174
|
-
"include": _fields_set,
|
175
|
-
**kwargs,
|
176
|
-
}
|
177
|
-
|
178
|
-
dict_dump = super().dict(**kwargs_with_defaults_exclude_unset_include_fields)
|
179
|
-
|
180
|
-
return convert_and_respect_annotation_metadata(object_=dict_dump, annotation=self.__class__, direction="write")
|
181
|
-
|
182
|
-
|
183
|
-
def _union_list_of_pydantic_dicts(
|
184
|
-
source: typing.List[typing.Any], destination: typing.List[typing.Any]
|
185
|
-
) -> typing.List[typing.Any]:
|
186
|
-
converted_list: typing.List[typing.Any] = []
|
187
|
-
for i, item in enumerate(source):
|
188
|
-
destination_value = destination[i] # type: ignore
|
189
|
-
if isinstance(item, dict):
|
190
|
-
converted_list.append(deep_union_pydantic_dicts(item, destination_value))
|
191
|
-
elif isinstance(item, list):
|
192
|
-
converted_list.append(_union_list_of_pydantic_dicts(item, destination_value))
|
193
|
-
else:
|
194
|
-
converted_list.append(item)
|
195
|
-
return converted_list
|
196
|
-
|
197
|
-
|
198
|
-
def deep_union_pydantic_dicts(
|
199
|
-
source: typing.Dict[str, typing.Any], destination: typing.Dict[str, typing.Any]
|
200
|
-
) -> typing.Dict[str, typing.Any]:
|
201
|
-
for key, value in source.items():
|
202
|
-
node = destination.setdefault(key, {})
|
203
|
-
if isinstance(value, dict):
|
204
|
-
deep_union_pydantic_dicts(value, node)
|
205
|
-
# Note: we do not do this same processing for sets given we do not have sets of models
|
206
|
-
# and given the sets are unordered, the processing of the set and matching objects would
|
207
|
-
# be non-trivial.
|
208
|
-
elif isinstance(value, list):
|
209
|
-
destination[key] = _union_list_of_pydantic_dicts(value, node)
|
210
|
-
else:
|
211
|
-
destination[key] = value
|
212
|
-
|
213
|
-
return destination
|
214
|
-
|
215
|
-
|
216
|
-
if IS_PYDANTIC_V2:
|
217
|
-
|
218
|
-
class V2RootModel(UniversalBaseModel, pydantic.RootModel): # type: ignore # Pydantic v2
|
219
|
-
pass
|
220
|
-
|
221
|
-
UniversalRootModel: typing_extensions.TypeAlias = V2RootModel # type: ignore
|
222
|
-
else:
|
223
|
-
UniversalRootModel: typing_extensions.TypeAlias = UniversalBaseModel # type: ignore
|
224
|
-
|
225
|
-
|
226
|
-
def encode_by_type(o: typing.Any) -> typing.Any:
|
227
|
-
encoders_by_class_tuples: typing.Dict[typing.Callable[[typing.Any], typing.Any], typing.Tuple[typing.Any, ...]] = (
|
228
|
-
defaultdict(tuple)
|
229
|
-
)
|
230
|
-
for type_, encoder in encoders_by_type.items():
|
231
|
-
encoders_by_class_tuples[encoder] += (type_,)
|
232
|
-
|
233
|
-
if type(o) in encoders_by_type:
|
234
|
-
return encoders_by_type[type(o)](o)
|
235
|
-
for encoder, classes_tuple in encoders_by_class_tuples.items():
|
236
|
-
if isinstance(o, classes_tuple):
|
237
|
-
return encoder(o)
|
238
|
-
|
239
|
-
|
240
|
-
def update_forward_refs(model: typing.Type["Model"], **localns: typing.Any) -> None:
|
241
|
-
if IS_PYDANTIC_V2:
|
242
|
-
model.model_rebuild(raise_errors=False) # type: ignore # Pydantic v2
|
243
|
-
else:
|
244
|
-
model.update_forward_refs(**localns)
|
245
|
-
|
246
|
-
|
247
|
-
# Mirrors Pydantic's internal typing
|
248
|
-
AnyCallable = typing.Callable[..., typing.Any]
|
249
|
-
|
250
|
-
|
251
|
-
def universal_root_validator(
|
252
|
-
pre: bool = False,
|
253
|
-
) -> typing.Callable[[AnyCallable], AnyCallable]:
|
254
|
-
def decorator(func: AnyCallable) -> AnyCallable:
|
255
|
-
if IS_PYDANTIC_V2:
|
256
|
-
return pydantic.model_validator(mode="before" if pre else "after")(func) # type: ignore # Pydantic v2
|
257
|
-
else:
|
258
|
-
return pydantic.root_validator(pre=pre)(func) # type: ignore # Pydantic v1
|
259
|
-
|
260
|
-
return decorator
|
261
|
-
|
262
|
-
|
263
|
-
def universal_field_validator(field_name: str, pre: bool = False) -> typing.Callable[[AnyCallable], AnyCallable]:
|
264
|
-
def decorator(func: AnyCallable) -> AnyCallable:
|
265
|
-
if IS_PYDANTIC_V2:
|
266
|
-
return pydantic.field_validator(field_name, mode="before" if pre else "after")(func) # type: ignore # Pydantic v2
|
267
|
-
else:
|
268
|
-
return pydantic.validator(field_name, pre=pre)(func) # type: ignore # Pydantic v1
|
269
|
-
|
270
|
-
return decorator
|
271
|
-
|
272
|
-
|
273
|
-
PydanticField = typing.Union[ModelField, pydantic.fields.FieldInfo]
|
274
|
-
|
275
|
-
|
276
|
-
def _get_model_fields(
|
277
|
-
model: typing.Type["Model"],
|
278
|
-
) -> typing.Mapping[str, PydanticField]:
|
279
|
-
if IS_PYDANTIC_V2:
|
280
|
-
return model.model_fields # type: ignore # Pydantic v2
|
281
|
-
else:
|
282
|
-
return model.__fields__ # type: ignore # Pydantic v1
|
283
|
-
|
284
|
-
|
285
|
-
def _get_field_default(field: PydanticField) -> typing.Any:
|
286
|
-
try:
|
287
|
-
value = field.get_default() # type: ignore # Pydantic < v1.10.15
|
288
|
-
except:
|
289
|
-
value = field.default
|
290
|
-
if IS_PYDANTIC_V2:
|
291
|
-
from pydantic_core import PydanticUndefined
|
292
|
-
|
293
|
-
if value == PydanticUndefined:
|
294
|
-
return None
|
295
|
-
return value
|
296
|
-
return value
|
3
|
+
from vellum.client.core.pydantic_utilities import *
|
vellum/core/query_encoder.py
CHANGED
@@ -1,58 +1,3 @@
|
|
1
|
-
# This file
|
1
|
+
# WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
|
2
2
|
|
3
|
-
from
|
4
|
-
|
5
|
-
import pydantic
|
6
|
-
|
7
|
-
|
8
|
-
# Flattens dicts to be of the form {"key[subkey][subkey2]": value} where value is not a dict
|
9
|
-
def traverse_query_dict(dict_flat: Dict[str, Any], key_prefix: Optional[str] = None) -> List[Tuple[str, Any]]:
|
10
|
-
result = []
|
11
|
-
for k, v in dict_flat.items():
|
12
|
-
key = f"{key_prefix}[{k}]" if key_prefix is not None else k
|
13
|
-
if isinstance(v, dict):
|
14
|
-
result.extend(traverse_query_dict(v, key))
|
15
|
-
elif isinstance(v, list):
|
16
|
-
for arr_v in v:
|
17
|
-
if isinstance(arr_v, dict):
|
18
|
-
result.extend(traverse_query_dict(arr_v, key))
|
19
|
-
else:
|
20
|
-
result.append((key, arr_v))
|
21
|
-
else:
|
22
|
-
result.append((key, v))
|
23
|
-
return result
|
24
|
-
|
25
|
-
|
26
|
-
def single_query_encoder(query_key: str, query_value: Any) -> List[Tuple[str, Any]]:
|
27
|
-
if isinstance(query_value, pydantic.BaseModel) or isinstance(query_value, dict):
|
28
|
-
if isinstance(query_value, pydantic.BaseModel):
|
29
|
-
obj_dict = query_value.dict(by_alias=True)
|
30
|
-
else:
|
31
|
-
obj_dict = query_value
|
32
|
-
return traverse_query_dict(obj_dict, query_key)
|
33
|
-
elif isinstance(query_value, list):
|
34
|
-
encoded_values: List[Tuple[str, Any]] = []
|
35
|
-
for value in query_value:
|
36
|
-
if isinstance(value, pydantic.BaseModel) or isinstance(value, dict):
|
37
|
-
if isinstance(value, pydantic.BaseModel):
|
38
|
-
obj_dict = value.dict(by_alias=True)
|
39
|
-
elif isinstance(value, dict):
|
40
|
-
obj_dict = value
|
41
|
-
|
42
|
-
encoded_values.extend(single_query_encoder(query_key, obj_dict))
|
43
|
-
else:
|
44
|
-
encoded_values.append((query_key, value))
|
45
|
-
|
46
|
-
return encoded_values
|
47
|
-
|
48
|
-
return [(query_key, query_value)]
|
49
|
-
|
50
|
-
|
51
|
-
def encode_query(query: Optional[Dict[str, Any]]) -> Optional[List[Tuple[str, Any]]]:
|
52
|
-
if query is None:
|
53
|
-
return None
|
54
|
-
|
55
|
-
encoded_query = []
|
56
|
-
for k, v in query.items():
|
57
|
-
encoded_query.extend(single_query_encoder(k, v))
|
58
|
-
return encoded_query
|
3
|
+
from vellum.client.core.query_encoder import *
|
@@ -1,11 +1,3 @@
|
|
1
|
-
# This file
|
1
|
+
# WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
|
2
2
|
|
3
|
-
from
|
4
|
-
|
5
|
-
|
6
|
-
def remove_none_from_dict(original: Mapping[str, Optional[Any]]) -> Dict[str, Any]:
|
7
|
-
new: Dict[str, Any] = {}
|
8
|
-
for key, value in original.items():
|
9
|
-
if value is not None:
|
10
|
-
new[key] = value
|
11
|
-
return new
|
3
|
+
from vellum.client.core.remove_none_from_dict import *
|
vellum/core/request_options.py
CHANGED
@@ -1,32 +1,3 @@
|
|
1
|
-
# This file
|
1
|
+
# WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
|
2
2
|
|
3
|
-
import
|
4
|
-
|
5
|
-
try:
|
6
|
-
from typing import NotRequired # type: ignore
|
7
|
-
except ImportError:
|
8
|
-
from typing_extensions import NotRequired
|
9
|
-
|
10
|
-
|
11
|
-
class RequestOptions(typing.TypedDict, total=False):
|
12
|
-
"""
|
13
|
-
Additional options for request-specific configuration when calling APIs via the SDK.
|
14
|
-
This is used primarily as an optional final parameter for service functions.
|
15
|
-
|
16
|
-
Attributes:
|
17
|
-
- timeout_in_seconds: int. The number of seconds to await an API call before timing out.
|
18
|
-
|
19
|
-
- max_retries: int. The max number of retries to attempt if the API call fails.
|
20
|
-
|
21
|
-
- additional_headers: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's header dict
|
22
|
-
|
23
|
-
- additional_query_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's query parameters dict
|
24
|
-
|
25
|
-
- additional_body_parameters: typing.Dict[str, typing.Any]. A dictionary containing additional parameters to spread into the request's body parameters dict
|
26
|
-
"""
|
27
|
-
|
28
|
-
timeout_in_seconds: NotRequired[int]
|
29
|
-
max_retries: NotRequired[int]
|
30
|
-
additional_headers: NotRequired[typing.Dict[str, typing.Any]]
|
31
|
-
additional_query_parameters: NotRequired[typing.Dict[str, typing.Any]]
|
32
|
-
additional_body_parameters: NotRequired[typing.Dict[str, typing.Any]]
|
3
|
+
from vellum.client.core.request_options import *
|
vellum/core/serialization.py
CHANGED
@@ -1,272 +1,3 @@
|
|
1
|
-
# This file
|
1
|
+
# WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
|
2
2
|
|
3
|
-
import
|
4
|
-
import inspect
|
5
|
-
import typing
|
6
|
-
|
7
|
-
import typing_extensions
|
8
|
-
|
9
|
-
import pydantic
|
10
|
-
|
11
|
-
|
12
|
-
class FieldMetadata:
|
13
|
-
"""
|
14
|
-
Metadata class used to annotate fields to provide additional information.
|
15
|
-
|
16
|
-
Example:
|
17
|
-
class MyDict(TypedDict):
|
18
|
-
field: typing.Annotated[str, FieldMetadata(alias="field_name")]
|
19
|
-
|
20
|
-
Will serialize: `{"field": "value"}`
|
21
|
-
To: `{"field_name": "value"}`
|
22
|
-
"""
|
23
|
-
|
24
|
-
alias: str
|
25
|
-
|
26
|
-
def __init__(self, *, alias: str) -> None:
|
27
|
-
self.alias = alias
|
28
|
-
|
29
|
-
|
30
|
-
def convert_and_respect_annotation_metadata(
|
31
|
-
*,
|
32
|
-
object_: typing.Any,
|
33
|
-
annotation: typing.Any,
|
34
|
-
inner_type: typing.Optional[typing.Any] = None,
|
35
|
-
direction: typing.Literal["read", "write"],
|
36
|
-
) -> typing.Any:
|
37
|
-
"""
|
38
|
-
Respect the metadata annotations on a field, such as aliasing. This function effectively
|
39
|
-
manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for
|
40
|
-
TypedDicts, which cannot support aliasing out of the box, and can be extended for additional
|
41
|
-
utilities, such as defaults.
|
42
|
-
|
43
|
-
Parameters
|
44
|
-
----------
|
45
|
-
object_ : typing.Any
|
46
|
-
|
47
|
-
annotation : type
|
48
|
-
The type we're looking to apply typing annotations from
|
49
|
-
|
50
|
-
inner_type : typing.Optional[type]
|
51
|
-
|
52
|
-
Returns
|
53
|
-
-------
|
54
|
-
typing.Any
|
55
|
-
"""
|
56
|
-
|
57
|
-
if object_ is None:
|
58
|
-
return None
|
59
|
-
if inner_type is None:
|
60
|
-
inner_type = annotation
|
61
|
-
|
62
|
-
clean_type = _remove_annotations(inner_type)
|
63
|
-
# Pydantic models
|
64
|
-
if (
|
65
|
-
inspect.isclass(clean_type)
|
66
|
-
and issubclass(clean_type, pydantic.BaseModel)
|
67
|
-
and isinstance(object_, typing.Mapping)
|
68
|
-
):
|
69
|
-
return _convert_mapping(object_, clean_type, direction)
|
70
|
-
# TypedDicts
|
71
|
-
if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping):
|
72
|
-
return _convert_mapping(object_, clean_type, direction)
|
73
|
-
|
74
|
-
if (
|
75
|
-
typing_extensions.get_origin(clean_type) == typing.Dict
|
76
|
-
or typing_extensions.get_origin(clean_type) == dict
|
77
|
-
or clean_type == typing.Dict
|
78
|
-
) and isinstance(object_, typing.Dict):
|
79
|
-
key_type = typing_extensions.get_args(clean_type)[0]
|
80
|
-
value_type = typing_extensions.get_args(clean_type)[1]
|
81
|
-
|
82
|
-
return {
|
83
|
-
key: convert_and_respect_annotation_metadata(
|
84
|
-
object_=value,
|
85
|
-
annotation=annotation,
|
86
|
-
inner_type=value_type,
|
87
|
-
direction=direction,
|
88
|
-
)
|
89
|
-
for key, value in object_.items()
|
90
|
-
}
|
91
|
-
|
92
|
-
# If you're iterating on a string, do not bother to coerce it to a sequence.
|
93
|
-
if not isinstance(object_, str):
|
94
|
-
if (
|
95
|
-
typing_extensions.get_origin(clean_type) == typing.Set
|
96
|
-
or typing_extensions.get_origin(clean_type) == set
|
97
|
-
or clean_type == typing.Set
|
98
|
-
) and isinstance(object_, typing.Set):
|
99
|
-
inner_type = typing_extensions.get_args(clean_type)[0]
|
100
|
-
return {
|
101
|
-
convert_and_respect_annotation_metadata(
|
102
|
-
object_=item,
|
103
|
-
annotation=annotation,
|
104
|
-
inner_type=inner_type,
|
105
|
-
direction=direction,
|
106
|
-
)
|
107
|
-
for item in object_
|
108
|
-
}
|
109
|
-
elif (
|
110
|
-
(
|
111
|
-
typing_extensions.get_origin(clean_type) == typing.List
|
112
|
-
or typing_extensions.get_origin(clean_type) == list
|
113
|
-
or clean_type == typing.List
|
114
|
-
)
|
115
|
-
and isinstance(object_, typing.List)
|
116
|
-
) or (
|
117
|
-
(
|
118
|
-
typing_extensions.get_origin(clean_type) == typing.Sequence
|
119
|
-
or typing_extensions.get_origin(clean_type) == collections.abc.Sequence
|
120
|
-
or clean_type == typing.Sequence
|
121
|
-
)
|
122
|
-
and isinstance(object_, typing.Sequence)
|
123
|
-
):
|
124
|
-
inner_type = typing_extensions.get_args(clean_type)[0]
|
125
|
-
return [
|
126
|
-
convert_and_respect_annotation_metadata(
|
127
|
-
object_=item,
|
128
|
-
annotation=annotation,
|
129
|
-
inner_type=inner_type,
|
130
|
-
direction=direction,
|
131
|
-
)
|
132
|
-
for item in object_
|
133
|
-
]
|
134
|
-
|
135
|
-
if typing_extensions.get_origin(clean_type) == typing.Union:
|
136
|
-
# We should be able to ~relatively~ safely try to convert keys against all
|
137
|
-
# member types in the union, the edge case here is if one member aliases a field
|
138
|
-
# of the same name to a different name from another member
|
139
|
-
# Or if another member aliases a field of the same name that another member does not.
|
140
|
-
for member in typing_extensions.get_args(clean_type):
|
141
|
-
object_ = convert_and_respect_annotation_metadata(
|
142
|
-
object_=object_,
|
143
|
-
annotation=annotation,
|
144
|
-
inner_type=member,
|
145
|
-
direction=direction,
|
146
|
-
)
|
147
|
-
return object_
|
148
|
-
|
149
|
-
annotated_type = _get_annotation(annotation)
|
150
|
-
if annotated_type is None:
|
151
|
-
return object_
|
152
|
-
|
153
|
-
# If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.)
|
154
|
-
# Then we can safely call it on the recursive conversion.
|
155
|
-
return object_
|
156
|
-
|
157
|
-
|
158
|
-
def _convert_mapping(
|
159
|
-
object_: typing.Mapping[str, object],
|
160
|
-
expected_type: typing.Any,
|
161
|
-
direction: typing.Literal["read", "write"],
|
162
|
-
) -> typing.Mapping[str, object]:
|
163
|
-
converted_object: typing.Dict[str, object] = {}
|
164
|
-
annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
|
165
|
-
aliases_to_field_names = _get_alias_to_field_name(annotations)
|
166
|
-
for key, value in object_.items():
|
167
|
-
if direction == "read" and key in aliases_to_field_names:
|
168
|
-
dealiased_key = aliases_to_field_names.get(key)
|
169
|
-
if dealiased_key is not None:
|
170
|
-
type_ = annotations.get(dealiased_key)
|
171
|
-
else:
|
172
|
-
type_ = annotations.get(key)
|
173
|
-
# Note you can't get the annotation by the field name if you're in read mode, so you must check the aliases map
|
174
|
-
#
|
175
|
-
# So this is effectively saying if we're in write mode, and we don't have a type, or if we're in read mode and we don't have an alias
|
176
|
-
# then we can just pass the value through as is
|
177
|
-
if type_ is None:
|
178
|
-
converted_object[key] = value
|
179
|
-
elif direction == "read" and key not in aliases_to_field_names:
|
180
|
-
converted_object[key] = convert_and_respect_annotation_metadata(
|
181
|
-
object_=value, annotation=type_, direction=direction
|
182
|
-
)
|
183
|
-
else:
|
184
|
-
converted_object[_alias_key(key, type_, direction, aliases_to_field_names)] = (
|
185
|
-
convert_and_respect_annotation_metadata(object_=value, annotation=type_, direction=direction)
|
186
|
-
)
|
187
|
-
return converted_object
|
188
|
-
|
189
|
-
|
190
|
-
def _get_annotation(type_: typing.Any) -> typing.Optional[typing.Any]:
|
191
|
-
maybe_annotated_type = typing_extensions.get_origin(type_)
|
192
|
-
if maybe_annotated_type is None:
|
193
|
-
return None
|
194
|
-
|
195
|
-
if maybe_annotated_type == typing_extensions.NotRequired:
|
196
|
-
type_ = typing_extensions.get_args(type_)[0]
|
197
|
-
maybe_annotated_type = typing_extensions.get_origin(type_)
|
198
|
-
|
199
|
-
if maybe_annotated_type == typing_extensions.Annotated:
|
200
|
-
return type_
|
201
|
-
|
202
|
-
return None
|
203
|
-
|
204
|
-
|
205
|
-
def _remove_annotations(type_: typing.Any) -> typing.Any:
|
206
|
-
maybe_annotated_type = typing_extensions.get_origin(type_)
|
207
|
-
if maybe_annotated_type is None:
|
208
|
-
return type_
|
209
|
-
|
210
|
-
if maybe_annotated_type == typing_extensions.NotRequired:
|
211
|
-
return _remove_annotations(typing_extensions.get_args(type_)[0])
|
212
|
-
|
213
|
-
if maybe_annotated_type == typing_extensions.Annotated:
|
214
|
-
return _remove_annotations(typing_extensions.get_args(type_)[0])
|
215
|
-
|
216
|
-
return type_
|
217
|
-
|
218
|
-
|
219
|
-
def get_alias_to_field_mapping(type_: typing.Any) -> typing.Dict[str, str]:
|
220
|
-
annotations = typing_extensions.get_type_hints(type_, include_extras=True)
|
221
|
-
return _get_alias_to_field_name(annotations)
|
222
|
-
|
223
|
-
|
224
|
-
def get_field_to_alias_mapping(type_: typing.Any) -> typing.Dict[str, str]:
|
225
|
-
annotations = typing_extensions.get_type_hints(type_, include_extras=True)
|
226
|
-
return _get_field_to_alias_name(annotations)
|
227
|
-
|
228
|
-
|
229
|
-
def _get_alias_to_field_name(
|
230
|
-
field_to_hint: typing.Dict[str, typing.Any],
|
231
|
-
) -> typing.Dict[str, str]:
|
232
|
-
aliases = {}
|
233
|
-
for field, hint in field_to_hint.items():
|
234
|
-
maybe_alias = _get_alias_from_type(hint)
|
235
|
-
if maybe_alias is not None:
|
236
|
-
aliases[maybe_alias] = field
|
237
|
-
return aliases
|
238
|
-
|
239
|
-
|
240
|
-
def _get_field_to_alias_name(
|
241
|
-
field_to_hint: typing.Dict[str, typing.Any],
|
242
|
-
) -> typing.Dict[str, str]:
|
243
|
-
aliases = {}
|
244
|
-
for field, hint in field_to_hint.items():
|
245
|
-
maybe_alias = _get_alias_from_type(hint)
|
246
|
-
if maybe_alias is not None:
|
247
|
-
aliases[field] = maybe_alias
|
248
|
-
return aliases
|
249
|
-
|
250
|
-
|
251
|
-
def _get_alias_from_type(type_: typing.Any) -> typing.Optional[str]:
|
252
|
-
maybe_annotated_type = _get_annotation(type_)
|
253
|
-
|
254
|
-
if maybe_annotated_type is not None:
|
255
|
-
# The actual annotations are 1 onward, the first is the annotated type
|
256
|
-
annotations = typing_extensions.get_args(maybe_annotated_type)[1:]
|
257
|
-
|
258
|
-
for annotation in annotations:
|
259
|
-
if isinstance(annotation, FieldMetadata) and annotation.alias is not None:
|
260
|
-
return annotation.alias
|
261
|
-
return None
|
262
|
-
|
263
|
-
|
264
|
-
def _alias_key(
|
265
|
-
key: str,
|
266
|
-
type_: typing.Any,
|
267
|
-
direction: typing.Literal["read", "write"],
|
268
|
-
aliases_to_field_names: typing.Dict[str, str],
|
269
|
-
) -> str:
|
270
|
-
if direction == "read":
|
271
|
-
return aliases_to_field_names.get(key, key)
|
272
|
-
return _get_alias_from_type(type_=type_) or key
|
3
|
+
from vellum.client.core.serialization import *
|