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,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class PromptDeploymentExpandMetaRequestRequest
|
7
|
+
attr_reader :model_name, :latency, :deployment_release_tag, :prompt_version_id, :finish_reason,
|
8
|
+
:additional_properties
|
9
|
+
|
10
|
+
# @param model_name [Boolean] If enabled, the response will include the model identifier representing the ML Model invoked by the Prompt Deployment.
|
11
|
+
# @param latency [Boolean] If enabled, the response will include the time in nanoseconds it took to execute the Prompt Deployment.
|
12
|
+
# @param deployment_release_tag [Boolean] If enabled, the response will include the release tag of the Prompt Deployment.
|
13
|
+
# @param prompt_version_id [Boolean] If enabled, the response will include the ID of the Prompt Version backing the deployment.
|
14
|
+
# @param finish_reason [Boolean] If enabled, the response will include the reason provided by the model for why the execution finished.
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [PromptDeploymentExpandMetaRequestRequest]
|
17
|
+
def initialize(model_name: nil, latency: nil, deployment_release_tag: nil, prompt_version_id: nil,
|
18
|
+
finish_reason: nil, additional_properties: nil)
|
19
|
+
# @type [Boolean] If enabled, the response will include the model identifier representing the ML Model invoked by the Prompt Deployment.
|
20
|
+
@model_name = model_name
|
21
|
+
# @type [Boolean] If enabled, the response will include the time in nanoseconds it took to execute the Prompt Deployment.
|
22
|
+
@latency = latency
|
23
|
+
# @type [Boolean] If enabled, the response will include the release tag of the Prompt Deployment.
|
24
|
+
@deployment_release_tag = deployment_release_tag
|
25
|
+
# @type [Boolean] If enabled, the response will include the ID of the Prompt Version backing the deployment.
|
26
|
+
@prompt_version_id = prompt_version_id
|
27
|
+
# @type [Boolean] If enabled, the response will include the reason provided by the model for why the execution finished.
|
28
|
+
@finish_reason = finish_reason
|
29
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
30
|
+
@additional_properties = additional_properties
|
31
|
+
end
|
32
|
+
|
33
|
+
# Deserialize a JSON object to an instance of PromptDeploymentExpandMetaRequestRequest
|
34
|
+
#
|
35
|
+
# @param json_object [JSON]
|
36
|
+
# @return [PromptDeploymentExpandMetaRequestRequest]
|
37
|
+
def self.from_json(json_object:)
|
38
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
39
|
+
JSON.parse(json_object)
|
40
|
+
model_name = struct.model_name
|
41
|
+
latency = struct.latency
|
42
|
+
deployment_release_tag = struct.deployment_release_tag
|
43
|
+
prompt_version_id = struct.prompt_version_id
|
44
|
+
finish_reason = struct.finish_reason
|
45
|
+
new(model_name: model_name, latency: latency, deployment_release_tag: deployment_release_tag,
|
46
|
+
prompt_version_id: prompt_version_id, finish_reason: finish_reason, additional_properties: struct)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serialize an instance of PromptDeploymentExpandMetaRequestRequest to a JSON object
|
50
|
+
#
|
51
|
+
# @return [JSON]
|
52
|
+
def to_json(*_args)
|
53
|
+
{
|
54
|
+
"model_name": @model_name,
|
55
|
+
"latency": @latency,
|
56
|
+
"deployment_release_tag": @deployment_release_tag,
|
57
|
+
"prompt_version_id": @prompt_version_id,
|
58
|
+
"finish_reason": @finish_reason
|
59
|
+
}.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# 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.
|
63
|
+
#
|
64
|
+
# @param obj [Object]
|
65
|
+
# @return [Void]
|
66
|
+
def self.validate_raw(obj:)
|
67
|
+
obj.model_name&.is_a?(Boolean) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.")
|
68
|
+
obj.latency&.is_a?(Boolean) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.")
|
69
|
+
obj.deployment_release_tag&.is_a?(Boolean) != false || raise("Passed value for field obj.deployment_release_tag is not the expected type, validation failed.")
|
70
|
+
obj.prompt_version_id&.is_a?(Boolean) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
|
71
|
+
obj.finish_reason&.is_a?(Boolean) != false || raise("Passed value for field obj.finish_reason is not the expected type, validation failed.")
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "string_input_request"
|
5
|
+
require_relative "json_input_request"
|
6
|
+
require_relative "chat_history_input_request"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class PromptDeploymentInputRequest
|
10
|
+
attr_reader :member, :discriminant
|
11
|
+
|
12
|
+
private_class_method :new
|
13
|
+
alias kind_of? is_a?
|
14
|
+
# @param member [Object]
|
15
|
+
# @param discriminant [String]
|
16
|
+
# @return [PromptDeploymentInputRequest]
|
17
|
+
def initialize(member:, discriminant:)
|
18
|
+
# @type [Object]
|
19
|
+
@member = member
|
20
|
+
# @type [String]
|
21
|
+
@discriminant = discriminant
|
22
|
+
end
|
23
|
+
|
24
|
+
# Deserialize a JSON object to an instance of PromptDeploymentInputRequest
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [PromptDeploymentInputRequest]
|
28
|
+
def self.from_json(json_object:)
|
29
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
+
member = case struct.type
|
31
|
+
when "STRING"
|
32
|
+
StringInputRequest.from_json(json_object: json_object)
|
33
|
+
when "JSON"
|
34
|
+
JsonInputRequest.from_json(json_object: json_object)
|
35
|
+
when "CHAT_HISTORY"
|
36
|
+
ChatHistoryInputRequest.from_json(json_object: json_object)
|
37
|
+
else
|
38
|
+
StringInputRequest.from_json(json_object: json_object)
|
39
|
+
end
|
40
|
+
new(member: member, discriminant: struct.type)
|
41
|
+
end
|
42
|
+
|
43
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
44
|
+
#
|
45
|
+
# @return [JSON]
|
46
|
+
def to_json(*_args)
|
47
|
+
case @discriminant
|
48
|
+
when "STRING"
|
49
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
50
|
+
when "JSON"
|
51
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
52
|
+
when "CHAT_HISTORY"
|
53
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
54
|
+
else
|
55
|
+
{ "type": @discriminant, value: @member }.to_json
|
56
|
+
end
|
57
|
+
@member.to_json
|
58
|
+
end
|
59
|
+
|
60
|
+
# 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.
|
61
|
+
#
|
62
|
+
# @param obj [Object]
|
63
|
+
# @return [Void]
|
64
|
+
def self.validate_raw(obj:)
|
65
|
+
case obj.type
|
66
|
+
when "STRING"
|
67
|
+
StringInputRequest.validate_raw(obj: obj)
|
68
|
+
when "JSON"
|
69
|
+
JsonInputRequest.validate_raw(obj: obj)
|
70
|
+
when "CHAT_HISTORY"
|
71
|
+
ChatHistoryInputRequest.validate_raw(obj: obj)
|
72
|
+
else
|
73
|
+
raise("Passed value matched no type within the union, validation failed.")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Boolean]
|
81
|
+
def is_a?(obj)
|
82
|
+
@member.is_a?(obj)
|
83
|
+
end
|
84
|
+
|
85
|
+
# @param member [StringInputRequest]
|
86
|
+
# @return [PromptDeploymentInputRequest]
|
87
|
+
def self.string(member:)
|
88
|
+
new(member: member, discriminant: "STRING")
|
89
|
+
end
|
90
|
+
|
91
|
+
# @param member [JsonInputRequest]
|
92
|
+
# @return [PromptDeploymentInputRequest]
|
93
|
+
def self.json(member:)
|
94
|
+
new(member: member, discriminant: "JSON")
|
95
|
+
end
|
96
|
+
|
97
|
+
# @param member [ChatHistoryInputRequest]
|
98
|
+
# @return [PromptDeploymentInputRequest]
|
99
|
+
def self.chat_history(member:)
|
100
|
+
new(member: member, discriminant: "CHAT_HISTORY")
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "finish_reason_enum"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`.
|
8
|
+
class PromptExecutionMeta
|
9
|
+
attr_reader :model_name, :latency, :deployment_release_tag, :prompt_version_id, :finish_reason,
|
10
|
+
:additional_properties
|
11
|
+
|
12
|
+
# @param model_name [String]
|
13
|
+
# @param latency [Integer]
|
14
|
+
# @param deployment_release_tag [String]
|
15
|
+
# @param prompt_version_id [String]
|
16
|
+
# @param finish_reason [FINISH_REASON_ENUM]
|
17
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
# @return [PromptExecutionMeta]
|
19
|
+
def initialize(model_name: nil, latency: nil, deployment_release_tag: nil, prompt_version_id: nil,
|
20
|
+
finish_reason: nil, additional_properties: nil)
|
21
|
+
# @type [String]
|
22
|
+
@model_name = model_name
|
23
|
+
# @type [Integer]
|
24
|
+
@latency = latency
|
25
|
+
# @type [String]
|
26
|
+
@deployment_release_tag = deployment_release_tag
|
27
|
+
# @type [String]
|
28
|
+
@prompt_version_id = prompt_version_id
|
29
|
+
# @type [FINISH_REASON_ENUM]
|
30
|
+
@finish_reason = finish_reason
|
31
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
32
|
+
@additional_properties = additional_properties
|
33
|
+
end
|
34
|
+
|
35
|
+
# Deserialize a JSON object to an instance of PromptExecutionMeta
|
36
|
+
#
|
37
|
+
# @param json_object [JSON]
|
38
|
+
# @return [PromptExecutionMeta]
|
39
|
+
def self.from_json(json_object:)
|
40
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
41
|
+
parsed_json = JSON.parse(json_object)
|
42
|
+
model_name = struct.model_name
|
43
|
+
latency = struct.latency
|
44
|
+
deployment_release_tag = struct.deployment_release_tag
|
45
|
+
prompt_version_id = struct.prompt_version_id
|
46
|
+
finish_reason = FINISH_REASON_ENUM.key(parsed_json["finish_reason"]) || parsed_json["finish_reason"]
|
47
|
+
new(model_name: model_name, latency: latency, deployment_release_tag: deployment_release_tag,
|
48
|
+
prompt_version_id: prompt_version_id, finish_reason: finish_reason, additional_properties: struct)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Serialize an instance of PromptExecutionMeta to a JSON object
|
52
|
+
#
|
53
|
+
# @return [JSON]
|
54
|
+
def to_json(*_args)
|
55
|
+
{
|
56
|
+
"model_name": @model_name,
|
57
|
+
"latency": @latency,
|
58
|
+
"deployment_release_tag": @deployment_release_tag,
|
59
|
+
"prompt_version_id": @prompt_version_id,
|
60
|
+
"finish_reason": FINISH_REASON_ENUM[@finish_reason] || @finish_reason
|
61
|
+
}.to_json
|
62
|
+
end
|
63
|
+
|
64
|
+
# 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.
|
65
|
+
#
|
66
|
+
# @param obj [Object]
|
67
|
+
# @return [Void]
|
68
|
+
def self.validate_raw(obj:)
|
69
|
+
obj.model_name&.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.")
|
70
|
+
obj.latency&.is_a?(Integer) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.")
|
71
|
+
obj.deployment_release_tag&.is_a?(String) != false || raise("Passed value for field obj.deployment_release_tag is not the expected type, validation failed.")
|
72
|
+
obj.prompt_version_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
|
73
|
+
obj.finish_reason&.is_a?(FINISH_REASON_ENUM) != false || raise("Passed value for field obj.finish_reason is not the expected type, validation failed.")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_node_result_data"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A Node Result Event emitted from a Prompt Node.
|
8
|
+
class PromptNodeResult
|
9
|
+
attr_reader :data, :additional_properties
|
10
|
+
|
11
|
+
# @param data [PromptNodeResultData]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [PromptNodeResult]
|
14
|
+
def initialize(data:, additional_properties: nil)
|
15
|
+
# @type [PromptNodeResultData]
|
16
|
+
@data = data
|
17
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
@additional_properties = additional_properties
|
19
|
+
end
|
20
|
+
|
21
|
+
# Deserialize a JSON object to an instance of PromptNodeResult
|
22
|
+
#
|
23
|
+
# @param json_object [JSON]
|
24
|
+
# @return [PromptNodeResult]
|
25
|
+
def self.from_json(json_object:)
|
26
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
27
|
+
parsed_json = JSON.parse(json_object)
|
28
|
+
if parsed_json["data"].nil?
|
29
|
+
data = nil
|
30
|
+
else
|
31
|
+
data = parsed_json["data"].to_json
|
32
|
+
data = PromptNodeResultData.from_json(json_object: data)
|
33
|
+
end
|
34
|
+
new(data: data, additional_properties: struct)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Serialize an instance of PromptNodeResult to a JSON object
|
38
|
+
#
|
39
|
+
# @return [JSON]
|
40
|
+
def to_json(*_args)
|
41
|
+
{ "data": @data }.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
# 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.
|
45
|
+
#
|
46
|
+
# @param obj [Object]
|
47
|
+
# @return [Void]
|
48
|
+
def self.validate_raw(obj:)
|
49
|
+
PromptNodeResultData.validate_raw(obj: obj.data)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class PromptNodeResultData
|
7
|
+
attr_reader :output_id, :text, :delta, :additional_properties
|
8
|
+
|
9
|
+
# @param output_id [String]
|
10
|
+
# @param text [String]
|
11
|
+
# @param delta [String]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [PromptNodeResultData]
|
14
|
+
def initialize(output_id:, text: nil, delta: nil, additional_properties: nil)
|
15
|
+
# @type [String]
|
16
|
+
@output_id = output_id
|
17
|
+
# @type [String]
|
18
|
+
@text = text
|
19
|
+
# @type [String]
|
20
|
+
@delta = delta
|
21
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
@additional_properties = additional_properties
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of PromptNodeResultData
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [PromptNodeResultData]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
JSON.parse(json_object)
|
32
|
+
output_id = struct.output_id
|
33
|
+
text = struct.text
|
34
|
+
delta = struct.delta
|
35
|
+
new(output_id: output_id, text: text, delta: delta, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of PromptNodeResultData to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "output_id": @output_id, "text": @text, "delta": @delta }.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.output_id.is_a?(String) != false || raise("Passed value for field obj.output_id is not the expected type, validation failed.")
|
51
|
+
obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
52
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "string_variable_value"
|
5
|
+
require_relative "json_variable_value"
|
6
|
+
require_relative "error_variable_value"
|
7
|
+
require_relative "function_call_variable_value"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class PromptOutput
|
11
|
+
attr_reader :member, :discriminant
|
12
|
+
|
13
|
+
private_class_method :new
|
14
|
+
alias kind_of? is_a?
|
15
|
+
# @param member [Object]
|
16
|
+
# @param discriminant [String]
|
17
|
+
# @return [PromptOutput]
|
18
|
+
def initialize(member:, discriminant:)
|
19
|
+
# @type [Object]
|
20
|
+
@member = member
|
21
|
+
# @type [String]
|
22
|
+
@discriminant = discriminant
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of PromptOutput
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [PromptOutput]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
member = case struct.type
|
32
|
+
when "STRING"
|
33
|
+
StringVariableValue.from_json(json_object: json_object)
|
34
|
+
when "JSON"
|
35
|
+
JsonVariableValue.from_json(json_object: json_object)
|
36
|
+
when "ERROR"
|
37
|
+
ErrorVariableValue.from_json(json_object: json_object)
|
38
|
+
when "FUNCTION_CALL"
|
39
|
+
FunctionCallVariableValue.from_json(json_object: json_object)
|
40
|
+
else
|
41
|
+
StringVariableValue.from_json(json_object: json_object)
|
42
|
+
end
|
43
|
+
new(member: member, discriminant: struct.type)
|
44
|
+
end
|
45
|
+
|
46
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
47
|
+
#
|
48
|
+
# @return [JSON]
|
49
|
+
def to_json(*_args)
|
50
|
+
case @discriminant
|
51
|
+
when "STRING"
|
52
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
53
|
+
when "JSON"
|
54
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
55
|
+
when "ERROR"
|
56
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
57
|
+
when "FUNCTION_CALL"
|
58
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
59
|
+
else
|
60
|
+
{ "type": @discriminant, value: @member }.to_json
|
61
|
+
end
|
62
|
+
@member.to_json
|
63
|
+
end
|
64
|
+
|
65
|
+
# 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.
|
66
|
+
#
|
67
|
+
# @param obj [Object]
|
68
|
+
# @return [Void]
|
69
|
+
def self.validate_raw(obj:)
|
70
|
+
case obj.type
|
71
|
+
when "STRING"
|
72
|
+
StringVariableValue.validate_raw(obj: obj)
|
73
|
+
when "JSON"
|
74
|
+
JsonVariableValue.validate_raw(obj: obj)
|
75
|
+
when "ERROR"
|
76
|
+
ErrorVariableValue.validate_raw(obj: obj)
|
77
|
+
when "FUNCTION_CALL"
|
78
|
+
FunctionCallVariableValue.validate_raw(obj: obj)
|
79
|
+
else
|
80
|
+
raise("Passed value matched no type within the union, validation failed.")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
85
|
+
#
|
86
|
+
# @param obj [Object]
|
87
|
+
# @return [Boolean]
|
88
|
+
def is_a?(obj)
|
89
|
+
@member.is_a?(obj)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @param member [StringVariableValue]
|
93
|
+
# @return [PromptOutput]
|
94
|
+
def self.string(member:)
|
95
|
+
new(member: member, discriminant: "STRING")
|
96
|
+
end
|
97
|
+
|
98
|
+
# @param member [JsonVariableValue]
|
99
|
+
# @return [PromptOutput]
|
100
|
+
def self.json(member:)
|
101
|
+
new(member: member, discriminant: "JSON")
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param member [ErrorVariableValue]
|
105
|
+
# @return [PromptOutput]
|
106
|
+
def self.error(member:)
|
107
|
+
new(member: member, discriminant: "ERROR")
|
108
|
+
end
|
109
|
+
|
110
|
+
# @param member [FunctionCallVariableValue]
|
111
|
+
# @return [PromptOutput]
|
112
|
+
def self.function_call(member:)
|
113
|
+
new(member: member, discriminant: "FUNCTION_CALL")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "block_type_enum"
|
4
|
+
require_relative "prompt_template_block_properties"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class PromptTemplateBlock
|
9
|
+
attr_reader :id, :block_type, :properties, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String]
|
12
|
+
# @param block_type [BLOCK_TYPE_ENUM]
|
13
|
+
# @param properties [PromptTemplateBlockProperties]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [PromptTemplateBlock]
|
16
|
+
def initialize(id:, block_type:, properties:, additional_properties: nil)
|
17
|
+
# @type [String]
|
18
|
+
@id = id
|
19
|
+
# @type [BLOCK_TYPE_ENUM]
|
20
|
+
@block_type = block_type
|
21
|
+
# @type [PromptTemplateBlockProperties]
|
22
|
+
@properties = properties
|
23
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
@additional_properties = additional_properties
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of PromptTemplateBlock
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [PromptTemplateBlock]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
id = struct.id
|
35
|
+
block_type = BLOCK_TYPE_ENUM.key(parsed_json["block_type"]) || parsed_json["block_type"]
|
36
|
+
if parsed_json["properties"].nil?
|
37
|
+
properties = nil
|
38
|
+
else
|
39
|
+
properties = parsed_json["properties"].to_json
|
40
|
+
properties = PromptTemplateBlockProperties.from_json(json_object: properties)
|
41
|
+
end
|
42
|
+
new(id: id, block_type: block_type, properties: properties, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of PromptTemplateBlock to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{ "id": @id, "block_type": BLOCK_TYPE_ENUM[@block_type] || @block_type, "properties": @properties }.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# 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.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
58
|
+
obj.block_type.is_a?(BLOCK_TYPE_ENUM) != false || raise("Passed value for field obj.block_type is not the expected type, validation failed.")
|
59
|
+
PromptTemplateBlockProperties.validate_raw(obj: obj.properties)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_template_block"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class PromptTemplateBlockData
|
8
|
+
attr_reader :version, :blocks, :additional_properties
|
9
|
+
|
10
|
+
# @param version [Integer]
|
11
|
+
# @param blocks [Array<PromptTemplateBlock>]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [PromptTemplateBlockData]
|
14
|
+
def initialize(version:, blocks:, additional_properties: nil)
|
15
|
+
# @type [Integer]
|
16
|
+
@version = version
|
17
|
+
# @type [Array<PromptTemplateBlock>]
|
18
|
+
@blocks = blocks
|
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 PromptTemplateBlockData
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [PromptTemplateBlockData]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
version = struct.version
|
31
|
+
blocks = parsed_json["blocks"].map do |v|
|
32
|
+
v = v.to_json
|
33
|
+
PromptTemplateBlock.from_json(json_object: v)
|
34
|
+
end
|
35
|
+
new(version: version, blocks: blocks, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of PromptTemplateBlockData to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "version": @version, "blocks": @blocks }.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.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
|
51
|
+
obj.blocks.is_a?(Array) != false || raise("Passed value for field obj.blocks is not the expected type, validation failed.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_template_block_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class PromptTemplateBlockDataRequest
|
8
|
+
attr_reader :version, :blocks, :additional_properties
|
9
|
+
|
10
|
+
# @param version [Integer]
|
11
|
+
# @param blocks [Array<PromptTemplateBlockRequest>]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [PromptTemplateBlockDataRequest]
|
14
|
+
def initialize(version:, blocks:, additional_properties: nil)
|
15
|
+
# @type [Integer]
|
16
|
+
@version = version
|
17
|
+
# @type [Array<PromptTemplateBlockRequest>]
|
18
|
+
@blocks = blocks
|
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 PromptTemplateBlockDataRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [PromptTemplateBlockDataRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
version = struct.version
|
31
|
+
blocks = parsed_json["blocks"].map do |v|
|
32
|
+
v = v.to_json
|
33
|
+
PromptTemplateBlockRequest.from_json(json_object: v)
|
34
|
+
end
|
35
|
+
new(version: version, blocks: blocks, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of PromptTemplateBlockDataRequest to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "version": @version, "blocks": @blocks }.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.version.is_a?(Integer) != false || raise("Passed value for field obj.version is not the expected type, validation failed.")
|
51
|
+
obj.blocks.is_a?(Array) != false || raise("Passed value for field obj.blocks is not the expected type, validation failed.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|