vellum_ai 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/core/file_utilities.rb +26 -0
- data/lib/environment.rb +11 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +88 -0
- data/lib/types_export.rb +255 -0
- data/lib/vellum_ai/deployments/client.rb +157 -0
- data/lib/vellum_ai/deployments/types/deployments_list_request_status.rb +8 -0
- data/lib/vellum_ai/document_indexes/client.rb +135 -0
- data/lib/vellum_ai/documents/client.rb +245 -0
- data/lib/vellum_ai/model_versions/client.rb +61 -0
- data/lib/vellum_ai/registered_prompts/client.rb +154 -0
- data/lib/vellum_ai/sandboxes/client.rb +132 -0
- data/lib/vellum_ai/test_suites/client.rb +130 -0
- data/lib/vellum_ai/types/api_node_result.rb +52 -0
- data/lib/vellum_ai/types/api_node_result_data.rb +80 -0
- data/lib/vellum_ai/types/array_chat_message_content.rb +50 -0
- data/lib/vellum_ai/types/array_chat_message_content_item.rb +103 -0
- data/lib/vellum_ai/types/array_chat_message_content_item_request.rb +103 -0
- data/lib/vellum_ai/types/array_chat_message_content_request.rb +50 -0
- data/lib/vellum_ai/types/block_type_enum.rb +11 -0
- data/lib/vellum_ai/types/chat_history_enum.rb +5 -0
- data/lib/vellum_ai/types/chat_history_input_request.rb +55 -0
- data/lib/vellum_ai/types/chat_message.rb +62 -0
- data/lib/vellum_ai/types/chat_message_content.rb +116 -0
- data/lib/vellum_ai/types/chat_message_content_request.rb +116 -0
- data/lib/vellum_ai/types/chat_message_request.rb +62 -0
- data/lib/vellum_ai/types/chat_message_role.rb +6 -0
- data/lib/vellum_ai/types/code_execution_node_chat_history_result.rb +54 -0
- data/lib/vellum_ai/types/code_execution_node_error_result.rb +56 -0
- data/lib/vellum_ai/types/code_execution_node_json_result.rb +50 -0
- data/lib/vellum_ai/types/code_execution_node_number_result.rb +50 -0
- data/lib/vellum_ai/types/code_execution_node_result.rb +52 -0
- data/lib/vellum_ai/types/code_execution_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/code_execution_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/code_execution_node_search_results_result.rb +54 -0
- data/lib/vellum_ai/types/code_execution_node_string_result.rb +50 -0
- data/lib/vellum_ai/types/conditional_node_result.rb +52 -0
- data/lib/vellum_ai/types/conditional_node_result_data.rb +45 -0
- data/lib/vellum_ai/types/deployment_provider_payload_response.rb +45 -0
- data/lib/vellum_ai/types/deployment_read.rb +115 -0
- data/lib/vellum_ai/types/document_document_to_document_index.rb +70 -0
- data/lib/vellum_ai/types/document_index_read.rb +98 -0
- data/lib/vellum_ai/types/document_read.rb +121 -0
- data/lib/vellum_ai/types/document_status.rb +5 -0
- data/lib/vellum_ai/types/enriched_normalized_completion.rb +118 -0
- data/lib/vellum_ai/types/entity_status.rb +6 -0
- data/lib/vellum_ai/types/environment_enum.rb +6 -0
- data/lib/vellum_ai/types/error_enum.rb +5 -0
- data/lib/vellum_ai/types/error_variable_value.rb +51 -0
- data/lib/vellum_ai/types/execute_prompt_api_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_prompt_event.rb +116 -0
- data/lib/vellum_ai/types/execute_prompt_response.rb +90 -0
- data/lib/vellum_ai/types/execute_workflow_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_workflow_response.rb +67 -0
- data/lib/vellum_ai/types/execute_workflow_stream_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_workflow_workflow_result_event.rb +90 -0
- data/lib/vellum_ai/types/finish_reason_enum.rb +6 -0
- data/lib/vellum_ai/types/fulfilled_enum.rb +5 -0
- data/lib/vellum_ai/types/fulfilled_execute_prompt_event.rb +66 -0
- data/lib/vellum_ai/types/fulfilled_execute_prompt_response.rb +71 -0
- data/lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb +61 -0
- data/lib/vellum_ai/types/fulfilled_function_call.rb +56 -0
- data/lib/vellum_ai/types/fulfilled_prompt_execution_meta.rb +52 -0
- data/lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb +90 -0
- data/lib/vellum_ai/types/function_call.rb +90 -0
- data/lib/vellum_ai/types/function_call_chat_message_content.rb +52 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_request.rb +52 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_value.rb +56 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_value_request.rb +56 -0
- data/lib/vellum_ai/types/function_call_enum.rb +5 -0
- data/lib/vellum_ai/types/function_call_variable_value.rb +51 -0
- data/lib/vellum_ai/types/generate_error_response.rb +45 -0
- data/lib/vellum_ai/types/generate_options_request.rb +50 -0
- data/lib/vellum_ai/types/generate_request.rb +60 -0
- data/lib/vellum_ai/types/generate_response.rb +49 -0
- data/lib/vellum_ai/types/generate_result.rb +62 -0
- data/lib/vellum_ai/types/generate_result_data.rb +49 -0
- data/lib/vellum_ai/types/generate_result_error.rb +45 -0
- data/lib/vellum_ai/types/generate_stream_response.rb +51 -0
- data/lib/vellum_ai/types/generate_stream_result.rb +67 -0
- data/lib/vellum_ai/types/generate_stream_result_data.rb +56 -0
- data/lib/vellum_ai/types/image_chat_message_content.rb +52 -0
- data/lib/vellum_ai/types/image_chat_message_content_request.rb +52 -0
- data/lib/vellum_ai/types/image_enum.rb +5 -0
- data/lib/vellum_ai/types/indexing_state_enum.rb +12 -0
- data/lib/vellum_ai/types/initiated_enum.rb +5 -0
- data/lib/vellum_ai/types/initiated_execute_prompt_event.rb +57 -0
- data/lib/vellum_ai/types/initiated_prompt_execution_meta.rb +68 -0
- data/lib/vellum_ai/types/initiated_workflow_node_result_event.rb +90 -0
- data/lib/vellum_ai/types/json_enum.rb +5 -0
- data/lib/vellum_ai/types/json_input_request.rb +51 -0
- data/lib/vellum_ai/types/json_variable_value.rb +45 -0
- data/lib/vellum_ai/types/logical_operator.rb +25 -0
- data/lib/vellum_ai/types/logprobs_enum.rb +6 -0
- data/lib/vellum_ai/types/metadata_filter_config_request.rb +85 -0
- data/lib/vellum_ai/types/metadata_filter_rule_combinator.rb +6 -0
- data/lib/vellum_ai/types/metadata_filter_rule_request.rb +84 -0
- data/lib/vellum_ai/types/model_version_build_config.rb +66 -0
- data/lib/vellum_ai/types/model_version_exec_config.rb +90 -0
- data/lib/vellum_ai/types/model_version_exec_config_parameters.rb +98 -0
- data/lib/vellum_ai/types/model_version_read.rb +133 -0
- data/lib/vellum_ai/types/model_version_read_status_enum.rb +11 -0
- data/lib/vellum_ai/types/model_version_sandbox_snapshot.rb +61 -0
- data/lib/vellum_ai/types/named_test_case_chat_history_variable_value_request.rb +54 -0
- data/lib/vellum_ai/types/named_test_case_error_variable_value_request.rb +56 -0
- data/lib/vellum_ai/types/named_test_case_json_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_number_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_search_results_variable_value_request.rb +54 -0
- data/lib/vellum_ai/types/named_test_case_string_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_variable_value_request.rb +142 -0
- data/lib/vellum_ai/types/node_input_compiled_chat_history_value.rb +59 -0
- data/lib/vellum_ai/types/node_input_compiled_error_value.rb +61 -0
- data/lib/vellum_ai/types/node_input_compiled_json_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_compiled_number_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_compiled_search_results_value.rb +59 -0
- data/lib/vellum_ai/types/node_input_compiled_string_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +142 -0
- data/lib/vellum_ai/types/node_output_compiled_chat_history_value.rb +54 -0
- data/lib/vellum_ai/types/node_output_compiled_error_value.rb +56 -0
- data/lib/vellum_ai/types/node_output_compiled_json_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_number_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_search_results_value.rb +54 -0
- data/lib/vellum_ai/types/node_output_compiled_string_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_value.rb +142 -0
- data/lib/vellum_ai/types/normalized_log_probs.rb +54 -0
- data/lib/vellum_ai/types/normalized_token_log_probs.rb +61 -0
- data/lib/vellum_ai/types/number_enum.rb +5 -0
- data/lib/vellum_ai/types/paginated_slim_deployment_read_list.rb +64 -0
- data/lib/vellum_ai/types/paginated_slim_document_list.rb +64 -0
- data/lib/vellum_ai/types/paginated_slim_workflow_deployment_list.rb +64 -0
- data/lib/vellum_ai/types/processing_failure_reason_enum.rb +9 -0
- data/lib/vellum_ai/types/processing_state_enum.rb +11 -0
- data/lib/vellum_ai/types/prompt_deployment_expand_meta_request_request.rb +74 -0
- data/lib/vellum_ai/types/prompt_deployment_input_request.rb +103 -0
- data/lib/vellum_ai/types/prompt_execution_meta.rb +76 -0
- data/lib/vellum_ai/types/prompt_node_result.rb +52 -0
- data/lib/vellum_ai/types/prompt_node_result_data.rb +55 -0
- data/lib/vellum_ai/types/prompt_output.rb +116 -0
- data/lib/vellum_ai/types/prompt_template_block.rb +62 -0
- data/lib/vellum_ai/types/prompt_template_block_data.rb +54 -0
- data/lib/vellum_ai/types/prompt_template_block_data_request.rb +54 -0
- data/lib/vellum_ai/types/prompt_template_block_properties.rb +104 -0
- data/lib/vellum_ai/types/prompt_template_block_properties_request.rb +104 -0
- data/lib/vellum_ai/types/prompt_template_block_request.rb +62 -0
- data/lib/vellum_ai/types/provider_enum.rb +20 -0
- data/lib/vellum_ai/types/raw_prompt_execution_overrides_request.rb +55 -0
- data/lib/vellum_ai/types/register_prompt_error_response.rb +45 -0
- data/lib/vellum_ai/types/register_prompt_model_parameters_request.rb +98 -0
- data/lib/vellum_ai/types/register_prompt_prompt.rb +50 -0
- data/lib/vellum_ai/types/register_prompt_prompt_info_request.rb +60 -0
- data/lib/vellum_ai/types/register_prompt_response.rb +110 -0
- data/lib/vellum_ai/types/registered_prompt_deployment.rb +55 -0
- data/lib/vellum_ai/types/registered_prompt_input_variable_request.rb +56 -0
- data/lib/vellum_ai/types/registered_prompt_model_version.rb +50 -0
- data/lib/vellum_ai/types/registered_prompt_sandbox.rb +50 -0
- data/lib/vellum_ai/types/registered_prompt_sandbox_snapshot.rb +45 -0
- data/lib/vellum_ai/types/rejected_enum.rb +5 -0
- data/lib/vellum_ai/types/rejected_execute_prompt_event.rb +68 -0
- data/lib/vellum_ai/types/rejected_execute_prompt_response.rb +73 -0
- data/lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb +63 -0
- data/lib/vellum_ai/types/rejected_function_call.rb +62 -0
- data/lib/vellum_ai/types/rejected_prompt_execution_meta.rb +52 -0
- data/lib/vellum_ai/types/rejected_workflow_node_result_event.rb +92 -0
- data/lib/vellum_ai/types/sandbox_scenario.rb +59 -0
- data/lib/vellum_ai/types/scenario_input.rb +70 -0
- data/lib/vellum_ai/types/scenario_input_request.rb +70 -0
- data/lib/vellum_ai/types/scenario_input_type_enum.rb +6 -0
- data/lib/vellum_ai/types/search_error_response.rb +45 -0
- data/lib/vellum_ai/types/search_filters_request.rb +56 -0
- data/lib/vellum_ai/types/search_node_result.rb +52 -0
- data/lib/vellum_ai/types/search_node_result_data.rb +70 -0
- data/lib/vellum_ai/types/search_request_options_request.rb +79 -0
- data/lib/vellum_ai/types/search_response.rb +49 -0
- data/lib/vellum_ai/types/search_result.rb +66 -0
- data/lib/vellum_ai/types/search_result_document.rb +60 -0
- data/lib/vellum_ai/types/search_result_document_request.rb +55 -0
- data/lib/vellum_ai/types/search_result_merging_request.rb +45 -0
- data/lib/vellum_ai/types/search_result_request.rb +66 -0
- data/lib/vellum_ai/types/search_results_enum.rb +5 -0
- data/lib/vellum_ai/types/search_weights_request.rb +50 -0
- data/lib/vellum_ai/types/slim_deployment_read.rb +109 -0
- data/lib/vellum_ai/types/slim_document.rb +126 -0
- data/lib/vellum_ai/types/slim_workflow_deployment.rb +118 -0
- data/lib/vellum_ai/types/streaming_enum.rb +5 -0
- data/lib/vellum_ai/types/streaming_execute_prompt_event.rb +85 -0
- data/lib/vellum_ai/types/streaming_prompt_execution_meta.rb +46 -0
- data/lib/vellum_ai/types/streaming_workflow_node_result_event.rb +99 -0
- data/lib/vellum_ai/types/string_chat_message_content.rb +46 -0
- data/lib/vellum_ai/types/string_chat_message_content_request.rb +46 -0
- data/lib/vellum_ai/types/string_enum.rb +5 -0
- data/lib/vellum_ai/types/string_input_request.rb +51 -0
- data/lib/vellum_ai/types/string_variable_value.rb +45 -0
- data/lib/vellum_ai/types/submit_completion_actual_request.rb +67 -0
- data/lib/vellum_ai/types/submit_completion_actuals_error_response.rb +45 -0
- data/lib/vellum_ai/types/submit_workflow_execution_actual_request.rb +103 -0
- data/lib/vellum_ai/types/templating_node_chat_history_result.rb +54 -0
- data/lib/vellum_ai/types/templating_node_error_result.rb +56 -0
- data/lib/vellum_ai/types/templating_node_json_result.rb +50 -0
- data/lib/vellum_ai/types/templating_node_number_result.rb +50 -0
- data/lib/vellum_ai/types/templating_node_result.rb +52 -0
- data/lib/vellum_ai/types/templating_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/templating_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/templating_node_search_results_result.rb +54 -0
- data/lib/vellum_ai/types/templating_node_string_result.rb +50 -0
- data/lib/vellum_ai/types/terminal_node_chat_history_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_error_result.rb +61 -0
- data/lib/vellum_ai/types/terminal_node_json_result.rb +55 -0
- data/lib/vellum_ai/types/terminal_node_number_result.rb +55 -0
- data/lib/vellum_ai/types/terminal_node_result.rb +52 -0
- data/lib/vellum_ai/types/terminal_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/terminal_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/terminal_node_search_results_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_string_result.rb +55 -0
- data/lib/vellum_ai/types/test_case_chat_history_variable_value.rb +54 -0
- data/lib/vellum_ai/types/test_case_error_variable_value.rb +56 -0
- data/lib/vellum_ai/types/test_case_json_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_number_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_search_results_variable_value.rb +54 -0
- data/lib/vellum_ai/types/test_case_string_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_variable_value.rb +142 -0
- data/lib/vellum_ai/types/test_suite_test_case.rb +68 -0
- data/lib/vellum_ai/types/upload_document_error_response.rb +45 -0
- data/lib/vellum_ai/types/upload_document_response.rb +45 -0
- data/lib/vellum_ai/types/vellum_error.rb +51 -0
- data/lib/vellum_ai/types/vellum_error_code_enum.rb +10 -0
- data/lib/vellum_ai/types/vellum_error_request.rb +51 -0
- data/lib/vellum_ai/types/vellum_image.rb +50 -0
- data/lib/vellum_ai/types/vellum_image_request.rb +50 -0
- data/lib/vellum_ai/types/vellum_variable.rb +56 -0
- data/lib/vellum_ai/types/vellum_variable_type.rb +16 -0
- data/lib/vellum_ai/types/workflow_event_error.rb +51 -0
- data/lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb +77 -0
- data/lib/vellum_ai/types/workflow_execution_actual_json_request.rb +73 -0
- data/lib/vellum_ai/types/workflow_execution_actual_string_request.rb +73 -0
- data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +13 -0
- data/lib/vellum_ai/types/workflow_execution_event_type.rb +6 -0
- data/lib/vellum_ai/types/workflow_execution_node_result_event.rb +68 -0
- data/lib/vellum_ai/types/workflow_execution_workflow_result_event.rb +68 -0
- data/lib/vellum_ai/types/workflow_node_result_data.rb +155 -0
- data/lib/vellum_ai/types/workflow_node_result_event.rb +116 -0
- data/lib/vellum_ai/types/workflow_node_result_event_state.rb +11 -0
- data/lib/vellum_ai/types/workflow_output.rb +168 -0
- data/lib/vellum_ai/types/workflow_output_chat_history.rb +60 -0
- data/lib/vellum_ai/types/workflow_output_error.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_function_call.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_image.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_json.rb +56 -0
- data/lib/vellum_ai/types/workflow_output_number.rb +56 -0
- data/lib/vellum_ai/types/workflow_output_search_results.rb +60 -0
- data/lib/vellum_ai/types/workflow_output_string.rb +56 -0
- data/lib/vellum_ai/types/workflow_request_chat_history_input_request.rb +54 -0
- data/lib/vellum_ai/types/workflow_request_input_request.rb +116 -0
- data/lib/vellum_ai/types/workflow_request_json_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_request_number_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_request_string_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_result_event.rb +95 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data.rb +142 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_chat_history.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_error.rb +85 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_json.rb +79 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_number.rb +79 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_string.rb +79 -0
- data/lib/vellum_ai/types/workflow_stream_event.rb +90 -0
- data/lib/vellum_ai/workflow_deployments/client.rb +82 -0
- data/lib/vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status.rb +8 -0
- data/lib/vellum_ai.rb +476 -0
- metadata +381 -0
@@ -0,0 +1,133 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "provider_enum"
|
5
|
+
require_relative "model_version_build_config"
|
6
|
+
require_relative "model_version_exec_config"
|
7
|
+
require_relative "model_version_read_status_enum"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Vellum
|
11
|
+
class ModelVersionRead
|
12
|
+
attr_reader :id, :created, :label, :provider, :external_id, :build_config, :exec_config, :status,
|
13
|
+
:additional_properties
|
14
|
+
|
15
|
+
# @param id [String] Vellum-generated ID that uniquely identifies this model version.
|
16
|
+
# @param created [DateTime] Timestamp of when this model version was created.
|
17
|
+
# @param label [String] Human-friendly name for this model version.
|
18
|
+
# @param provider [PROVIDER_ENUM] Which LLM provider this model version is associated with.
|
19
|
+
# - `ANTHROPIC` - Anthropic
|
20
|
+
# - `AWS_BEDROCK` - AWS Bedrock
|
21
|
+
# - `AZURE_OPENAI` - Azure OpenAI
|
22
|
+
# - `COHERE` - Cohere
|
23
|
+
# - `GOOGLE` - Google
|
24
|
+
# - `HOSTED` - Hosted
|
25
|
+
# - `MOSAICML` - MosaicML
|
26
|
+
# - `OPENAI` - OpenAI
|
27
|
+
# - `FIREWORKS_AI` - Fireworks AI
|
28
|
+
# - `HUGGINGFACE` - HuggingFace
|
29
|
+
# - `MYSTIC` - Mystic
|
30
|
+
# - `PYQ` - Pyq
|
31
|
+
# - `REPLICATE` - Replicate
|
32
|
+
# @param external_id [String] The unique id of this model version as it exists in the above provider's system.
|
33
|
+
# @param build_config [ModelVersionBuildConfig] Configuration used to build this model version.
|
34
|
+
# @param exec_config [ModelVersionExecConfig] Configuration used to execute this model version.
|
35
|
+
# @param status [MODEL_VERSION_READ_STATUS_ENUM]
|
36
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
37
|
+
# @return [ModelVersionRead]
|
38
|
+
def initialize(id:, created:, label:, provider:, external_id:, build_config:, exec_config:, status: nil,
|
39
|
+
additional_properties: nil)
|
40
|
+
# @type [String] Vellum-generated ID that uniquely identifies this model version.
|
41
|
+
@id = id
|
42
|
+
# @type [DateTime] Timestamp of when this model version was created.
|
43
|
+
@created = created
|
44
|
+
# @type [String] Human-friendly name for this model version.
|
45
|
+
@label = label
|
46
|
+
# @type [PROVIDER_ENUM] Which LLM provider this model version is associated with.
|
47
|
+
# - `ANTHROPIC` - Anthropic
|
48
|
+
# - `AWS_BEDROCK` - AWS Bedrock
|
49
|
+
# - `AZURE_OPENAI` - Azure OpenAI
|
50
|
+
# - `COHERE` - Cohere
|
51
|
+
# - `GOOGLE` - Google
|
52
|
+
# - `HOSTED` - Hosted
|
53
|
+
# - `MOSAICML` - MosaicML
|
54
|
+
# - `OPENAI` - OpenAI
|
55
|
+
# - `FIREWORKS_AI` - Fireworks AI
|
56
|
+
# - `HUGGINGFACE` - HuggingFace
|
57
|
+
# - `MYSTIC` - Mystic
|
58
|
+
# - `PYQ` - Pyq
|
59
|
+
# - `REPLICATE` - Replicate
|
60
|
+
@provider = provider
|
61
|
+
# @type [String] The unique id of this model version as it exists in the above provider's system.
|
62
|
+
@external_id = external_id
|
63
|
+
# @type [ModelVersionBuildConfig] Configuration used to build this model version.
|
64
|
+
@build_config = build_config
|
65
|
+
# @type [ModelVersionExecConfig] Configuration used to execute this model version.
|
66
|
+
@exec_config = exec_config
|
67
|
+
# @type [MODEL_VERSION_READ_STATUS_ENUM]
|
68
|
+
@status = status
|
69
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
70
|
+
@additional_properties = additional_properties
|
71
|
+
end
|
72
|
+
|
73
|
+
# Deserialize a JSON object to an instance of ModelVersionRead
|
74
|
+
#
|
75
|
+
# @param json_object [JSON]
|
76
|
+
# @return [ModelVersionRead]
|
77
|
+
def self.from_json(json_object:)
|
78
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
79
|
+
parsed_json = JSON.parse(json_object)
|
80
|
+
id = struct.id
|
81
|
+
created = DateTime.parse(parsed_json["created"])
|
82
|
+
label = struct.label
|
83
|
+
provider = PROVIDER_ENUM.key(parsed_json["provider"]) || parsed_json["provider"]
|
84
|
+
external_id = struct.external_id
|
85
|
+
if parsed_json["build_config"].nil?
|
86
|
+
build_config = nil
|
87
|
+
else
|
88
|
+
build_config = parsed_json["build_config"].to_json
|
89
|
+
build_config = ModelVersionBuildConfig.from_json(json_object: build_config)
|
90
|
+
end
|
91
|
+
if parsed_json["exec_config"].nil?
|
92
|
+
exec_config = nil
|
93
|
+
else
|
94
|
+
exec_config = parsed_json["exec_config"].to_json
|
95
|
+
exec_config = ModelVersionExecConfig.from_json(json_object: exec_config)
|
96
|
+
end
|
97
|
+
status = MODEL_VERSION_READ_STATUS_ENUM.key(parsed_json["status"]) || parsed_json["status"]
|
98
|
+
new(id: id, created: created, label: label, provider: provider, external_id: external_id,
|
99
|
+
build_config: build_config, exec_config: exec_config, status: status, additional_properties: struct)
|
100
|
+
end
|
101
|
+
|
102
|
+
# Serialize an instance of ModelVersionRead to a JSON object
|
103
|
+
#
|
104
|
+
# @return [JSON]
|
105
|
+
def to_json(*_args)
|
106
|
+
{
|
107
|
+
"id": @id,
|
108
|
+
"created": @created,
|
109
|
+
"label": @label,
|
110
|
+
"provider": PROVIDER_ENUM[@provider] || @provider,
|
111
|
+
"external_id": @external_id,
|
112
|
+
"build_config": @build_config,
|
113
|
+
"exec_config": @exec_config,
|
114
|
+
"status": MODEL_VERSION_READ_STATUS_ENUM[@status] || @status
|
115
|
+
}.to_json
|
116
|
+
end
|
117
|
+
|
118
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
119
|
+
#
|
120
|
+
# @param obj [Object]
|
121
|
+
# @return [Void]
|
122
|
+
def self.validate_raw(obj:)
|
123
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
124
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
125
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
126
|
+
obj.provider.is_a?(PROVIDER_ENUM) != false || raise("Passed value for field obj.provider is not the expected type, validation failed.")
|
127
|
+
obj.external_id.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
|
128
|
+
ModelVersionBuildConfig.validate_raw(obj: obj.build_config)
|
129
|
+
ModelVersionExecConfig.validate_raw(obj: obj.exec_config)
|
130
|
+
obj.status&.is_a?(MODEL_VERSION_READ_STATUS_ENUM) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class ModelVersionSandboxSnapshot
|
7
|
+
attr_reader :id, :prompt_index, :prompt_id, :sandbox_id, :additional_properties
|
8
|
+
|
9
|
+
# @param id [String] The ID of the sandbox snapshot.
|
10
|
+
# @param prompt_index [Integer] The index of the prompt in the sandbox snapshot.
|
11
|
+
# @param prompt_id [String] The id of the prompt in the sandbox snapshot.
|
12
|
+
# @param sandbox_id [String]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [ModelVersionSandboxSnapshot]
|
15
|
+
def initialize(id:, prompt_index: nil, prompt_id: nil, sandbox_id: nil, additional_properties: nil)
|
16
|
+
# @type [String] The ID of the sandbox snapshot.
|
17
|
+
@id = id
|
18
|
+
# @type [Integer] The index of the prompt in the sandbox snapshot.
|
19
|
+
@prompt_index = prompt_index
|
20
|
+
# @type [String] The id of the prompt in the sandbox snapshot.
|
21
|
+
@prompt_id = prompt_id
|
22
|
+
# @type [String]
|
23
|
+
@sandbox_id = sandbox_id
|
24
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
@additional_properties = additional_properties
|
26
|
+
end
|
27
|
+
|
28
|
+
# Deserialize a JSON object to an instance of ModelVersionSandboxSnapshot
|
29
|
+
#
|
30
|
+
# @param json_object [JSON]
|
31
|
+
# @return [ModelVersionSandboxSnapshot]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
JSON.parse(json_object)
|
35
|
+
id = struct.id
|
36
|
+
prompt_index = struct.prompt_index
|
37
|
+
prompt_id = struct.prompt_id
|
38
|
+
sandbox_id = struct.sandbox_id
|
39
|
+
new(id: id, prompt_index: prompt_index, prompt_id: prompt_id, sandbox_id: sandbox_id,
|
40
|
+
additional_properties: struct)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Serialize an instance of ModelVersionSandboxSnapshot to a JSON object
|
44
|
+
#
|
45
|
+
# @return [JSON]
|
46
|
+
def to_json(*_args)
|
47
|
+
{ "id": @id, "prompt_index": @prompt_index, "prompt_id": @prompt_id, "sandbox_id": @sandbox_id }.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
51
|
+
#
|
52
|
+
# @param obj [Object]
|
53
|
+
# @return [Void]
|
54
|
+
def self.validate_raw(obj:)
|
55
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
56
|
+
obj.prompt_index&.is_a?(Integer) != false || raise("Passed value for field obj.prompt_index is not the expected type, validation failed.")
|
57
|
+
obj.prompt_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_id is not the expected type, validation failed.")
|
58
|
+
obj.sandbox_id&.is_a?(String) != false || raise("Passed value for field obj.sandbox_id is not the expected type, validation failed.")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_message_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class NamedTestCaseChatHistoryVariableValueRequest
|
8
|
+
attr_reader :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param name [String]
|
11
|
+
# @param value [Array<ChatMessageRequest>]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [NamedTestCaseChatHistoryVariableValueRequest]
|
14
|
+
def initialize(name:, value: nil, additional_properties: nil)
|
15
|
+
# @type [String]
|
16
|
+
@name = name
|
17
|
+
# @type [Array<ChatMessageRequest>]
|
18
|
+
@value = value
|
19
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
@additional_properties = additional_properties
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of NamedTestCaseChatHistoryVariableValueRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [NamedTestCaseChatHistoryVariableValueRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
name = struct.name
|
31
|
+
value = parsed_json["value"].map do |v|
|
32
|
+
v = v.to_json
|
33
|
+
ChatMessageRequest.from_json(json_object: v)
|
34
|
+
end
|
35
|
+
new(name: name, value: value, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of NamedTestCaseChatHistoryVariableValueRequest to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "name": @name, "value": @value }.to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
46
|
+
#
|
47
|
+
# @param obj [Object]
|
48
|
+
# @return [Void]
|
49
|
+
def self.validate_raw(obj:)
|
50
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
51
|
+
obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_error_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class NamedTestCaseErrorVariableValueRequest
|
8
|
+
attr_reader :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param name [String]
|
11
|
+
# @param value [VellumErrorRequest]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [NamedTestCaseErrorVariableValueRequest]
|
14
|
+
def initialize(name:, value: nil, additional_properties: nil)
|
15
|
+
# @type [String]
|
16
|
+
@name = name
|
17
|
+
# @type [VellumErrorRequest]
|
18
|
+
@value = value
|
19
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
@additional_properties = additional_properties
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of NamedTestCaseErrorVariableValueRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [NamedTestCaseErrorVariableValueRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
name = struct.name
|
31
|
+
if parsed_json["value"].nil?
|
32
|
+
value = nil
|
33
|
+
else
|
34
|
+
value = parsed_json["value"].to_json
|
35
|
+
value = VellumErrorRequest.from_json(json_object: value)
|
36
|
+
end
|
37
|
+
new(name: name, value: value, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of NamedTestCaseErrorVariableValueRequest to a JSON object
|
41
|
+
#
|
42
|
+
# @return [JSON]
|
43
|
+
def to_json(*_args)
|
44
|
+
{ "name": @name, "value": @value }.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
48
|
+
#
|
49
|
+
# @param obj [Object]
|
50
|
+
# @return [Void]
|
51
|
+
def self.validate_raw(obj:)
|
52
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
53
|
+
obj.value.nil? || VellumErrorRequest.validate_raw(obj: obj.value)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class NamedTestCaseJsonVariableValueRequest
|
7
|
+
attr_reader :name, :value, :additional_properties
|
8
|
+
|
9
|
+
# @param name [String]
|
10
|
+
# @param value [Hash{String => String}]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [NamedTestCaseJsonVariableValueRequest]
|
13
|
+
def initialize(name:, value: nil, additional_properties: nil)
|
14
|
+
# @type [String]
|
15
|
+
@name = name
|
16
|
+
# @type [Hash{String => String}]
|
17
|
+
@value = value
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of NamedTestCaseJsonVariableValueRequest
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [NamedTestCaseJsonVariableValueRequest]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
name = struct.name
|
30
|
+
value = struct.value
|
31
|
+
new(name: name, value: value, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of NamedTestCaseJsonVariableValueRequest to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "name": @name, "value": @value }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
47
|
+
obj.value&.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class NamedTestCaseNumberVariableValueRequest
|
7
|
+
attr_reader :name, :value, :additional_properties
|
8
|
+
|
9
|
+
# @param name [String]
|
10
|
+
# @param value [Float]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [NamedTestCaseNumberVariableValueRequest]
|
13
|
+
def initialize(name:, value: nil, additional_properties: nil)
|
14
|
+
# @type [String]
|
15
|
+
@name = name
|
16
|
+
# @type [Float]
|
17
|
+
@value = value
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of NamedTestCaseNumberVariableValueRequest
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [NamedTestCaseNumberVariableValueRequest]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
name = struct.name
|
30
|
+
value = struct.value
|
31
|
+
new(name: name, value: value, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of NamedTestCaseNumberVariableValueRequest to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "name": @name, "value": @value }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
47
|
+
obj.value&.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "search_result_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class NamedTestCaseSearchResultsVariableValueRequest
|
8
|
+
attr_reader :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param name [String]
|
11
|
+
# @param value [Array<SearchResultRequest>]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [NamedTestCaseSearchResultsVariableValueRequest]
|
14
|
+
def initialize(name:, value: nil, additional_properties: nil)
|
15
|
+
# @type [String]
|
16
|
+
@name = name
|
17
|
+
# @type [Array<SearchResultRequest>]
|
18
|
+
@value = value
|
19
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
@additional_properties = additional_properties
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of NamedTestCaseSearchResultsVariableValueRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [NamedTestCaseSearchResultsVariableValueRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
name = struct.name
|
31
|
+
value = parsed_json["value"].map do |v|
|
32
|
+
v = v.to_json
|
33
|
+
SearchResultRequest.from_json(json_object: v)
|
34
|
+
end
|
35
|
+
new(name: name, value: value, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of NamedTestCaseSearchResultsVariableValueRequest to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "name": @name, "value": @value }.to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
46
|
+
#
|
47
|
+
# @param obj [Object]
|
48
|
+
# @return [Void]
|
49
|
+
def self.validate_raw(obj:)
|
50
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
51
|
+
obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class NamedTestCaseStringVariableValueRequest
|
7
|
+
attr_reader :name, :value, :additional_properties
|
8
|
+
|
9
|
+
# @param name [String]
|
10
|
+
# @param value [String]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [NamedTestCaseStringVariableValueRequest]
|
13
|
+
def initialize(name:, value: nil, additional_properties: nil)
|
14
|
+
# @type [String]
|
15
|
+
@name = name
|
16
|
+
# @type [String]
|
17
|
+
@value = value
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of NamedTestCaseStringVariableValueRequest
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [NamedTestCaseStringVariableValueRequest]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
name = struct.name
|
30
|
+
value = struct.value
|
31
|
+
new(name: name, value: value, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of NamedTestCaseStringVariableValueRequest to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "name": @name, "value": @value }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
47
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "named_test_case_string_variable_value_request"
|
5
|
+
require_relative "named_test_case_number_variable_value_request"
|
6
|
+
require_relative "named_test_case_json_variable_value_request"
|
7
|
+
require_relative "named_test_case_chat_history_variable_value_request"
|
8
|
+
require_relative "named_test_case_search_results_variable_value_request"
|
9
|
+
require_relative "named_test_case_error_variable_value_request"
|
10
|
+
|
11
|
+
module Vellum
|
12
|
+
class NamedTestCaseVariableValueRequest
|
13
|
+
attr_reader :member, :discriminant
|
14
|
+
|
15
|
+
private_class_method :new
|
16
|
+
alias kind_of? is_a?
|
17
|
+
# @param member [Object]
|
18
|
+
# @param discriminant [String]
|
19
|
+
# @return [NamedTestCaseVariableValueRequest]
|
20
|
+
def initialize(member:, discriminant:)
|
21
|
+
# @type [Object]
|
22
|
+
@member = member
|
23
|
+
# @type [String]
|
24
|
+
@discriminant = discriminant
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of NamedTestCaseVariableValueRequest
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [NamedTestCaseVariableValueRequest]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
member = case struct.type
|
34
|
+
when "STRING"
|
35
|
+
NamedTestCaseStringVariableValueRequest.from_json(json_object: json_object)
|
36
|
+
when "NUMBER"
|
37
|
+
NamedTestCaseNumberVariableValueRequest.from_json(json_object: json_object)
|
38
|
+
when "JSON"
|
39
|
+
NamedTestCaseJsonVariableValueRequest.from_json(json_object: json_object)
|
40
|
+
when "CHAT_HISTORY"
|
41
|
+
NamedTestCaseChatHistoryVariableValueRequest.from_json(json_object: json_object)
|
42
|
+
when "SEARCH_RESULTS"
|
43
|
+
NamedTestCaseSearchResultsVariableValueRequest.from_json(json_object: json_object)
|
44
|
+
when "ERROR"
|
45
|
+
NamedTestCaseErrorVariableValueRequest.from_json(json_object: json_object)
|
46
|
+
else
|
47
|
+
NamedTestCaseStringVariableValueRequest.from_json(json_object: json_object)
|
48
|
+
end
|
49
|
+
new(member: member, discriminant: struct.type)
|
50
|
+
end
|
51
|
+
|
52
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
53
|
+
#
|
54
|
+
# @return [JSON]
|
55
|
+
def to_json(*_args)
|
56
|
+
case @discriminant
|
57
|
+
when "STRING"
|
58
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
59
|
+
when "NUMBER"
|
60
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
61
|
+
when "JSON"
|
62
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
63
|
+
when "CHAT_HISTORY"
|
64
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
65
|
+
when "SEARCH_RESULTS"
|
66
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
67
|
+
when "ERROR"
|
68
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
69
|
+
else
|
70
|
+
{ "type": @discriminant, value: @member }.to_json
|
71
|
+
end
|
72
|
+
@member.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
76
|
+
#
|
77
|
+
# @param obj [Object]
|
78
|
+
# @return [Void]
|
79
|
+
def self.validate_raw(obj:)
|
80
|
+
case obj.type
|
81
|
+
when "STRING"
|
82
|
+
NamedTestCaseStringVariableValueRequest.validate_raw(obj: obj)
|
83
|
+
when "NUMBER"
|
84
|
+
NamedTestCaseNumberVariableValueRequest.validate_raw(obj: obj)
|
85
|
+
when "JSON"
|
86
|
+
NamedTestCaseJsonVariableValueRequest.validate_raw(obj: obj)
|
87
|
+
when "CHAT_HISTORY"
|
88
|
+
NamedTestCaseChatHistoryVariableValueRequest.validate_raw(obj: obj)
|
89
|
+
when "SEARCH_RESULTS"
|
90
|
+
NamedTestCaseSearchResultsVariableValueRequest.validate_raw(obj: obj)
|
91
|
+
when "ERROR"
|
92
|
+
NamedTestCaseErrorVariableValueRequest.validate_raw(obj: obj)
|
93
|
+
else
|
94
|
+
raise("Passed value matched no type within the union, validation failed.")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
99
|
+
#
|
100
|
+
# @param obj [Object]
|
101
|
+
# @return [Boolean]
|
102
|
+
def is_a?(obj)
|
103
|
+
@member.is_a?(obj)
|
104
|
+
end
|
105
|
+
|
106
|
+
# @param member [NamedTestCaseStringVariableValueRequest]
|
107
|
+
# @return [NamedTestCaseVariableValueRequest]
|
108
|
+
def self.string(member:)
|
109
|
+
new(member: member, discriminant: "STRING")
|
110
|
+
end
|
111
|
+
|
112
|
+
# @param member [NamedTestCaseNumberVariableValueRequest]
|
113
|
+
# @return [NamedTestCaseVariableValueRequest]
|
114
|
+
def self.number(member:)
|
115
|
+
new(member: member, discriminant: "NUMBER")
|
116
|
+
end
|
117
|
+
|
118
|
+
# @param member [NamedTestCaseJsonVariableValueRequest]
|
119
|
+
# @return [NamedTestCaseVariableValueRequest]
|
120
|
+
def self.json(member:)
|
121
|
+
new(member: member, discriminant: "JSON")
|
122
|
+
end
|
123
|
+
|
124
|
+
# @param member [NamedTestCaseChatHistoryVariableValueRequest]
|
125
|
+
# @return [NamedTestCaseVariableValueRequest]
|
126
|
+
def self.chat_history(member:)
|
127
|
+
new(member: member, discriminant: "CHAT_HISTORY")
|
128
|
+
end
|
129
|
+
|
130
|
+
# @param member [NamedTestCaseSearchResultsVariableValueRequest]
|
131
|
+
# @return [NamedTestCaseVariableValueRequest]
|
132
|
+
def self.search_results(member:)
|
133
|
+
new(member: member, discriminant: "SEARCH_RESULTS")
|
134
|
+
end
|
135
|
+
|
136
|
+
# @param member [NamedTestCaseErrorVariableValueRequest]
|
137
|
+
# @return [NamedTestCaseVariableValueRequest]
|
138
|
+
def self.error(member:)
|
139
|
+
new(member: member, discriminant: "ERROR")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|