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,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "entity_status"
|
4
|
+
require_relative "environment_enum"
|
5
|
+
require "date"
|
6
|
+
require_relative "vellum_variable"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class SlimWorkflowDeployment
|
11
|
+
attr_reader :id, :name, :label, :status, :environment, :created, :last_deployed_on, :input_variables,
|
12
|
+
:output_variables, :additional_properties
|
13
|
+
|
14
|
+
# @param id [String]
|
15
|
+
# @param name [String] A name that uniquely identifies this workflow deployment within its workspace
|
16
|
+
# @param label [String] A human-readable label for the workflow deployment
|
17
|
+
# @param status [ENTITY_STATUS] The current status of the workflow deployment
|
18
|
+
# - `ACTIVE` - Active
|
19
|
+
# - `ARCHIVED` - Archived
|
20
|
+
# @param environment [ENVIRONMENT_ENUM] The environment this workflow deployment is used in
|
21
|
+
# - `DEVELOPMENT` - Development
|
22
|
+
# - `STAGING` - Staging
|
23
|
+
# - `PRODUCTION` - Production
|
24
|
+
# @param created [DateTime]
|
25
|
+
# @param last_deployed_on [DateTime]
|
26
|
+
# @param input_variables [Array<VellumVariable>] The input variables this Workflow Deployment expects to receive values for when it is executed.
|
27
|
+
# @param output_variables [Array<VellumVariable>] The output variables this Workflow Deployment will produce when it is executed.
|
28
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
# @return [SlimWorkflowDeployment]
|
30
|
+
def initialize(id:, name:, label:, created:, last_deployed_on:, input_variables:, output_variables:, status: nil,
|
31
|
+
environment: nil, additional_properties: nil)
|
32
|
+
# @type [String]
|
33
|
+
@id = id
|
34
|
+
# @type [String] A name that uniquely identifies this workflow deployment within its workspace
|
35
|
+
@name = name
|
36
|
+
# @type [String] A human-readable label for the workflow deployment
|
37
|
+
@label = label
|
38
|
+
# @type [ENTITY_STATUS] The current status of the workflow deployment
|
39
|
+
# - `ACTIVE` - Active
|
40
|
+
# - `ARCHIVED` - Archived
|
41
|
+
@status = status
|
42
|
+
# @type [ENVIRONMENT_ENUM] The environment this workflow deployment is used in
|
43
|
+
# - `DEVELOPMENT` - Development
|
44
|
+
# - `STAGING` - Staging
|
45
|
+
# - `PRODUCTION` - Production
|
46
|
+
@environment = environment
|
47
|
+
# @type [DateTime]
|
48
|
+
@created = created
|
49
|
+
# @type [DateTime]
|
50
|
+
@last_deployed_on = last_deployed_on
|
51
|
+
# @type [Array<VellumVariable>] The input variables this Workflow Deployment expects to receive values for when it is executed.
|
52
|
+
@input_variables = input_variables
|
53
|
+
# @type [Array<VellumVariable>] The output variables this Workflow Deployment will produce when it is executed.
|
54
|
+
@output_variables = output_variables
|
55
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
56
|
+
@additional_properties = additional_properties
|
57
|
+
end
|
58
|
+
|
59
|
+
# Deserialize a JSON object to an instance of SlimWorkflowDeployment
|
60
|
+
#
|
61
|
+
# @param json_object [JSON]
|
62
|
+
# @return [SlimWorkflowDeployment]
|
63
|
+
def self.from_json(json_object:)
|
64
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
65
|
+
parsed_json = JSON.parse(json_object)
|
66
|
+
id = struct.id
|
67
|
+
name = struct.name
|
68
|
+
label = struct.label
|
69
|
+
status = ENTITY_STATUS.key(parsed_json["status"]) || parsed_json["status"]
|
70
|
+
environment = ENVIRONMENT_ENUM.key(parsed_json["environment"]) || parsed_json["environment"]
|
71
|
+
created = DateTime.parse(parsed_json["created"])
|
72
|
+
last_deployed_on = DateTime.parse(parsed_json["last_deployed_on"])
|
73
|
+
input_variables = parsed_json["input_variables"].map do |v|
|
74
|
+
v = v.to_json
|
75
|
+
VellumVariable.from_json(json_object: v)
|
76
|
+
end
|
77
|
+
output_variables = parsed_json["output_variables"].map do |v|
|
78
|
+
v = v.to_json
|
79
|
+
VellumVariable.from_json(json_object: v)
|
80
|
+
end
|
81
|
+
new(id: id, name: name, label: label, status: status, environment: environment, created: created,
|
82
|
+
last_deployed_on: last_deployed_on, input_variables: input_variables, output_variables: output_variables, additional_properties: struct)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Serialize an instance of SlimWorkflowDeployment to a JSON object
|
86
|
+
#
|
87
|
+
# @return [JSON]
|
88
|
+
def to_json(*_args)
|
89
|
+
{
|
90
|
+
"id": @id,
|
91
|
+
"name": @name,
|
92
|
+
"label": @label,
|
93
|
+
"status": ENTITY_STATUS[@status] || @status,
|
94
|
+
"environment": ENVIRONMENT_ENUM[@environment] || @environment,
|
95
|
+
"created": @created,
|
96
|
+
"last_deployed_on": @last_deployed_on,
|
97
|
+
"input_variables": @input_variables,
|
98
|
+
"output_variables": @output_variables
|
99
|
+
}.to_json
|
100
|
+
end
|
101
|
+
|
102
|
+
# 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.
|
103
|
+
#
|
104
|
+
# @param obj [Object]
|
105
|
+
# @return [Void]
|
106
|
+
def self.validate_raw(obj:)
|
107
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
108
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
109
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
110
|
+
obj.status&.is_a?(ENTITY_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
111
|
+
obj.environment&.is_a?(ENVIRONMENT_ENUM) != false || raise("Passed value for field obj.environment is not the expected type, validation failed.")
|
112
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
113
|
+
obj.last_deployed_on.is_a?(DateTime) != false || raise("Passed value for field obj.last_deployed_on is not the expected type, validation failed.")
|
114
|
+
obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.")
|
115
|
+
obj.output_variables.is_a?(Array) != false || raise("Passed value for field obj.output_variables is not the expected type, validation failed.")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_output"
|
4
|
+
require_relative "streaming_prompt_execution_meta"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The data returned for each delta during the prompt execution stream.
|
9
|
+
class StreamingExecutePromptEvent
|
10
|
+
attr_reader :output, :output_index, :execution_id, :meta, :raw, :additional_properties
|
11
|
+
|
12
|
+
# @param output [PromptOutput]
|
13
|
+
# @param output_index [Integer]
|
14
|
+
# @param execution_id [String]
|
15
|
+
# @param meta [StreamingPromptExecutionMeta]
|
16
|
+
# @param raw [Hash{String => String}] The subset of the raw response from the model that the request opted into with `expand_raw`.
|
17
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
# @return [StreamingExecutePromptEvent]
|
19
|
+
def initialize(output:, output_index:, execution_id:, meta: nil, raw: nil, additional_properties: nil)
|
20
|
+
# @type [PromptOutput]
|
21
|
+
@output = output
|
22
|
+
# @type [Integer]
|
23
|
+
@output_index = output_index
|
24
|
+
# @type [String]
|
25
|
+
@execution_id = execution_id
|
26
|
+
# @type [StreamingPromptExecutionMeta]
|
27
|
+
@meta = meta
|
28
|
+
# @type [Hash{String => String}] The subset of the raw response from the model that the request opted into with `expand_raw`.
|
29
|
+
@raw = raw
|
30
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
31
|
+
@additional_properties = additional_properties
|
32
|
+
end
|
33
|
+
|
34
|
+
# Deserialize a JSON object to an instance of StreamingExecutePromptEvent
|
35
|
+
#
|
36
|
+
# @param json_object [JSON]
|
37
|
+
# @return [StreamingExecutePromptEvent]
|
38
|
+
def self.from_json(json_object:)
|
39
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
40
|
+
parsed_json = JSON.parse(json_object)
|
41
|
+
if parsed_json["output"].nil?
|
42
|
+
output = nil
|
43
|
+
else
|
44
|
+
output = parsed_json["output"].to_json
|
45
|
+
output = PromptOutput.from_json(json_object: output)
|
46
|
+
end
|
47
|
+
output_index = struct.output_index
|
48
|
+
execution_id = struct.execution_id
|
49
|
+
if parsed_json["meta"].nil?
|
50
|
+
meta = nil
|
51
|
+
else
|
52
|
+
meta = parsed_json["meta"].to_json
|
53
|
+
meta = StreamingPromptExecutionMeta.from_json(json_object: meta)
|
54
|
+
end
|
55
|
+
raw = struct.raw
|
56
|
+
new(output: output, output_index: output_index, execution_id: execution_id, meta: meta, raw: raw,
|
57
|
+
additional_properties: struct)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Serialize an instance of StreamingExecutePromptEvent to a JSON object
|
61
|
+
#
|
62
|
+
# @return [JSON]
|
63
|
+
def to_json(*_args)
|
64
|
+
{
|
65
|
+
"output": @output,
|
66
|
+
"output_index": @output_index,
|
67
|
+
"execution_id": @execution_id,
|
68
|
+
"meta": @meta,
|
69
|
+
"raw": @raw
|
70
|
+
}.to_json
|
71
|
+
end
|
72
|
+
|
73
|
+
# 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.
|
74
|
+
#
|
75
|
+
# @param obj [Object]
|
76
|
+
# @return [Void]
|
77
|
+
def self.validate_raw(obj:)
|
78
|
+
PromptOutput.validate_raw(obj: obj.output)
|
79
|
+
obj.output_index.is_a?(Integer) != false || raise("Passed value for field obj.output_index is not the expected type, validation failed.")
|
80
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
81
|
+
obj.meta.nil? || StreamingPromptExecutionMeta.validate_raw(obj: obj.meta)
|
82
|
+
obj.raw&.is_a?(Hash) != false || raise("Passed value for field obj.raw is not the expected type, validation failed.")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`.
|
7
|
+
class StreamingPromptExecutionMeta
|
8
|
+
attr_reader :latency, :additional_properties
|
9
|
+
|
10
|
+
# @param latency [Integer]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [StreamingPromptExecutionMeta]
|
13
|
+
def initialize(latency: nil, additional_properties: nil)
|
14
|
+
# @type [Integer]
|
15
|
+
@latency = latency
|
16
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
@additional_properties = additional_properties
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialize a JSON object to an instance of StreamingPromptExecutionMeta
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [StreamingPromptExecutionMeta]
|
24
|
+
def self.from_json(json_object:)
|
25
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
+
JSON.parse(json_object)
|
27
|
+
latency = struct.latency
|
28
|
+
new(latency: latency, additional_properties: struct)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Serialize an instance of StreamingPromptExecutionMeta to a JSON object
|
32
|
+
#
|
33
|
+
# @return [JSON]
|
34
|
+
def to_json(*_args)
|
35
|
+
{ "latency": @latency }.to_json
|
36
|
+
end
|
37
|
+
|
38
|
+
# 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.
|
39
|
+
#
|
40
|
+
# @param obj [Object]
|
41
|
+
# @return [Void]
|
42
|
+
def self.validate_raw(obj:)
|
43
|
+
obj.latency&.is_a?(Integer) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "workflow_node_result_data"
|
5
|
+
require_relative "node_output_compiled_value"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
# An event that indicates that the node has execution is in progress.
|
10
|
+
class StreamingWorkflowNodeResultEvent
|
11
|
+
attr_reader :id, :node_id, :node_result_id, :ts, :data, :output, :output_index, :additional_properties
|
12
|
+
|
13
|
+
# @param id [String]
|
14
|
+
# @param node_id [String]
|
15
|
+
# @param node_result_id [String]
|
16
|
+
# @param ts [DateTime]
|
17
|
+
# @param data [WorkflowNodeResultData]
|
18
|
+
# @param output [NodeOutputCompiledValue]
|
19
|
+
# @param output_index [Integer]
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
# @return [StreamingWorkflowNodeResultEvent]
|
22
|
+
def initialize(id:, node_id:, node_result_id:, ts: nil, data: nil, output: nil, output_index: nil,
|
23
|
+
additional_properties: nil)
|
24
|
+
# @type [String]
|
25
|
+
@id = id
|
26
|
+
# @type [String]
|
27
|
+
@node_id = node_id
|
28
|
+
# @type [String]
|
29
|
+
@node_result_id = node_result_id
|
30
|
+
# @type [DateTime]
|
31
|
+
@ts = ts
|
32
|
+
# @type [WorkflowNodeResultData]
|
33
|
+
@data = data
|
34
|
+
# @type [NodeOutputCompiledValue]
|
35
|
+
@output = output
|
36
|
+
# @type [Integer]
|
37
|
+
@output_index = output_index
|
38
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
39
|
+
@additional_properties = additional_properties
|
40
|
+
end
|
41
|
+
|
42
|
+
# Deserialize a JSON object to an instance of StreamingWorkflowNodeResultEvent
|
43
|
+
#
|
44
|
+
# @param json_object [JSON]
|
45
|
+
# @return [StreamingWorkflowNodeResultEvent]
|
46
|
+
def self.from_json(json_object:)
|
47
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
48
|
+
parsed_json = JSON.parse(json_object)
|
49
|
+
id = struct.id
|
50
|
+
node_id = struct.node_id
|
51
|
+
node_result_id = struct.node_result_id
|
52
|
+
ts = DateTime.parse(parsed_json["ts"])
|
53
|
+
if parsed_json["data"].nil?
|
54
|
+
data = nil
|
55
|
+
else
|
56
|
+
data = parsed_json["data"].to_json
|
57
|
+
data = WorkflowNodeResultData.from_json(json_object: data)
|
58
|
+
end
|
59
|
+
if parsed_json["output"].nil?
|
60
|
+
output = nil
|
61
|
+
else
|
62
|
+
output = parsed_json["output"].to_json
|
63
|
+
output = NodeOutputCompiledValue.from_json(json_object: output)
|
64
|
+
end
|
65
|
+
output_index = struct.output_index
|
66
|
+
new(id: id, node_id: node_id, node_result_id: node_result_id, ts: ts, data: data, output: output,
|
67
|
+
output_index: output_index, additional_properties: struct)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Serialize an instance of StreamingWorkflowNodeResultEvent to a JSON object
|
71
|
+
#
|
72
|
+
# @return [JSON]
|
73
|
+
def to_json(*_args)
|
74
|
+
{
|
75
|
+
"id": @id,
|
76
|
+
"node_id": @node_id,
|
77
|
+
"node_result_id": @node_result_id,
|
78
|
+
"ts": @ts,
|
79
|
+
"data": @data,
|
80
|
+
"output": @output,
|
81
|
+
"output_index": @output_index
|
82
|
+
}.to_json
|
83
|
+
end
|
84
|
+
|
85
|
+
# 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.
|
86
|
+
#
|
87
|
+
# @param obj [Object]
|
88
|
+
# @return [Void]
|
89
|
+
def self.validate_raw(obj:)
|
90
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
91
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
92
|
+
obj.node_result_id.is_a?(String) != false || raise("Passed value for field obj.node_result_id is not the expected type, validation failed.")
|
93
|
+
obj.ts&.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
|
94
|
+
obj.data.nil? || WorkflowNodeResultData.validate_raw(obj: obj.data)
|
95
|
+
obj.output.nil? || NodeOutputCompiledValue.validate_raw(obj: obj.output)
|
96
|
+
obj.output_index&.is_a?(Integer) != false || raise("Passed value for field obj.output_index is not the expected type, validation failed.")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A string value that is used in a chat message.
|
7
|
+
class StringChatMessageContent
|
8
|
+
attr_reader :value, :additional_properties
|
9
|
+
|
10
|
+
# @param value [String]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [StringChatMessageContent]
|
13
|
+
def initialize(value:, additional_properties: nil)
|
14
|
+
# @type [String]
|
15
|
+
@value = value
|
16
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
@additional_properties = additional_properties
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialize a JSON object to an instance of StringChatMessageContent
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [StringChatMessageContent]
|
24
|
+
def self.from_json(json_object:)
|
25
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
+
JSON.parse(json_object)
|
27
|
+
value = struct.value
|
28
|
+
new(value: value, additional_properties: struct)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Serialize an instance of StringChatMessageContent to a JSON object
|
32
|
+
#
|
33
|
+
# @return [JSON]
|
34
|
+
def to_json(*_args)
|
35
|
+
{ "value": @value }.to_json
|
36
|
+
end
|
37
|
+
|
38
|
+
# 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.
|
39
|
+
#
|
40
|
+
# @param obj [Object]
|
41
|
+
# @return [Void]
|
42
|
+
def self.validate_raw(obj:)
|
43
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A string value that is used in a chat message.
|
7
|
+
class StringChatMessageContentRequest
|
8
|
+
attr_reader :value, :additional_properties
|
9
|
+
|
10
|
+
# @param value [String]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [StringChatMessageContentRequest]
|
13
|
+
def initialize(value:, additional_properties: nil)
|
14
|
+
# @type [String]
|
15
|
+
@value = value
|
16
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
@additional_properties = additional_properties
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialize a JSON object to an instance of StringChatMessageContentRequest
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [StringChatMessageContentRequest]
|
24
|
+
def self.from_json(json_object:)
|
25
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
+
JSON.parse(json_object)
|
27
|
+
value = struct.value
|
28
|
+
new(value: value, additional_properties: struct)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Serialize an instance of StringChatMessageContentRequest to a JSON object
|
32
|
+
#
|
33
|
+
# @return [JSON]
|
34
|
+
def to_json(*_args)
|
35
|
+
{ "value": @value }.to_json
|
36
|
+
end
|
37
|
+
|
38
|
+
# 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.
|
39
|
+
#
|
40
|
+
# @param obj [Object]
|
41
|
+
# @return [Void]
|
42
|
+
def self.validate_raw(obj:)
|
43
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A user input representing a string value
|
7
|
+
class StringInputRequest
|
8
|
+
attr_reader :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param name [String] The variable's name, as defined in the deployment.
|
11
|
+
# @param value [String]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [StringInputRequest]
|
14
|
+
def initialize(name:, value:, additional_properties: nil)
|
15
|
+
# @type [String] The variable's name, as defined in the deployment.
|
16
|
+
@name = name
|
17
|
+
# @type [String]
|
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 StringInputRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [StringInputRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
JSON.parse(json_object)
|
30
|
+
name = struct.name
|
31
|
+
value = struct.value
|
32
|
+
new(name: name, value: value, additional_properties: struct)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Serialize an instance of StringInputRequest to a JSON object
|
36
|
+
#
|
37
|
+
# @return [JSON]
|
38
|
+
def to_json(*_args)
|
39
|
+
{ "name": @name, "value": @value }.to_json
|
40
|
+
end
|
41
|
+
|
42
|
+
# 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.
|
43
|
+
#
|
44
|
+
# @param obj [Object]
|
45
|
+
# @return [Void]
|
46
|
+
def self.validate_raw(obj:)
|
47
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
48
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class StringVariableValue
|
7
|
+
attr_reader :value, :additional_properties
|
8
|
+
|
9
|
+
# @param value [String]
|
10
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
# @return [StringVariableValue]
|
12
|
+
def initialize(value: nil, additional_properties: nil)
|
13
|
+
# @type [String]
|
14
|
+
@value = value
|
15
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
@additional_properties = additional_properties
|
17
|
+
end
|
18
|
+
|
19
|
+
# Deserialize a JSON object to an instance of StringVariableValue
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [StringVariableValue]
|
23
|
+
def self.from_json(json_object:)
|
24
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
25
|
+
JSON.parse(json_object)
|
26
|
+
value = struct.value
|
27
|
+
new(value: value, additional_properties: struct)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Serialize an instance of StringVariableValue to a JSON object
|
31
|
+
#
|
32
|
+
# @return [JSON]
|
33
|
+
def to_json(*_args)
|
34
|
+
{ "value": @value }.to_json
|
35
|
+
end
|
36
|
+
|
37
|
+
# 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.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class SubmitCompletionActualRequest
|
8
|
+
attr_reader :id, :external_id, :text, :quality, :timestamp, :additional_properties
|
9
|
+
|
10
|
+
# @param id [String] The Vellum-generated ID of a previously generated completion. Must provide either this or external_id.
|
11
|
+
# @param external_id [String] The external ID that was originally provided when generating the completion that you'd now like to submit actuals for. Must provide either this or id.
|
12
|
+
# @param text [String] Text representing what the completion _should_ have been.
|
13
|
+
# @param quality [Float] A number between 0 and 1 representing the quality of the completion. 0 is the worst, 1 is the best.
|
14
|
+
# @param timestamp [DateTime] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [SubmitCompletionActualRequest]
|
17
|
+
def initialize(id: nil, external_id: nil, text: nil, quality: nil, timestamp: nil, additional_properties: nil)
|
18
|
+
# @type [String] The Vellum-generated ID of a previously generated completion. Must provide either this or external_id.
|
19
|
+
@id = id
|
20
|
+
# @type [String] The external ID that was originally provided when generating the completion that you'd now like to submit actuals for. Must provide either this or id.
|
21
|
+
@external_id = external_id
|
22
|
+
# @type [String] Text representing what the completion _should_ have been.
|
23
|
+
@text = text
|
24
|
+
# @type [Float] A number between 0 and 1 representing the quality of the completion. 0 is the worst, 1 is the best.
|
25
|
+
@quality = quality
|
26
|
+
# @type [DateTime] Optionally provide the timestamp representing when this feedback was collected. Used for reporting purposes.
|
27
|
+
@timestamp = timestamp
|
28
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
+
@additional_properties = additional_properties
|
30
|
+
end
|
31
|
+
|
32
|
+
# Deserialize a JSON object to an instance of SubmitCompletionActualRequest
|
33
|
+
#
|
34
|
+
# @param json_object [JSON]
|
35
|
+
# @return [SubmitCompletionActualRequest]
|
36
|
+
def self.from_json(json_object:)
|
37
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
38
|
+
parsed_json = JSON.parse(json_object)
|
39
|
+
id = struct.id
|
40
|
+
external_id = struct.external_id
|
41
|
+
text = struct.text
|
42
|
+
quality = struct.quality
|
43
|
+
timestamp = DateTime.parse(parsed_json["timestamp"])
|
44
|
+
new(id: id, external_id: external_id, text: text, quality: quality, timestamp: timestamp,
|
45
|
+
additional_properties: struct)
|
46
|
+
end
|
47
|
+
|
48
|
+
# Serialize an instance of SubmitCompletionActualRequest to a JSON object
|
49
|
+
#
|
50
|
+
# @return [JSON]
|
51
|
+
def to_json(*_args)
|
52
|
+
{ "id": @id, "external_id": @external_id, "text": @text, "quality": @quality, "timestamp": @timestamp }.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# 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.
|
56
|
+
#
|
57
|
+
# @param obj [Object]
|
58
|
+
# @return [Void]
|
59
|
+
def self.validate_raw(obj:)
|
60
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
61
|
+
obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
|
62
|
+
obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
63
|
+
obj.quality&.is_a?(Float) != false || raise("Passed value for field obj.quality is not the expected type, validation failed.")
|
64
|
+
obj.timestamp&.is_a?(DateTime) != false || raise("Passed value for field obj.timestamp is not the expected type, validation failed.")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class SubmitCompletionActualsErrorResponse
|
7
|
+
attr_reader :detail, :additional_properties
|
8
|
+
|
9
|
+
# @param detail [String]
|
10
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
# @return [SubmitCompletionActualsErrorResponse]
|
12
|
+
def initialize(detail:, additional_properties: nil)
|
13
|
+
# @type [String]
|
14
|
+
@detail = detail
|
15
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
@additional_properties = additional_properties
|
17
|
+
end
|
18
|
+
|
19
|
+
# Deserialize a JSON object to an instance of SubmitCompletionActualsErrorResponse
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [SubmitCompletionActualsErrorResponse]
|
23
|
+
def self.from_json(json_object:)
|
24
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
25
|
+
JSON.parse(json_object)
|
26
|
+
detail = struct.detail
|
27
|
+
new(detail: detail, additional_properties: struct)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Serialize an instance of SubmitCompletionActualsErrorResponse to a JSON object
|
31
|
+
#
|
32
|
+
# @return [JSON]
|
33
|
+
def to_json(*_args)
|
34
|
+
{ "detail": @detail }.to_json
|
35
|
+
end
|
36
|
+
|
37
|
+
# 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.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
obj.detail.is_a?(String) != false || raise("Passed value for field obj.detail is not the expected type, validation failed.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|