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,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A JSON output from a Workflow execution.
|
7
|
+
class WorkflowOutputJson
|
8
|
+
attr_reader :id, :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param id [String]
|
11
|
+
# @param name [String] The output's name, as defined in the workflow
|
12
|
+
# @param value [Hash{String => String}]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [WorkflowOutputJson]
|
15
|
+
def initialize(id:, name:, value:, additional_properties: nil)
|
16
|
+
# @type [String]
|
17
|
+
@id = id
|
18
|
+
# @type [String] The output's name, as defined in the workflow
|
19
|
+
@name = name
|
20
|
+
# @type [Hash{String => String}]
|
21
|
+
@value = value
|
22
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
end
|
25
|
+
|
26
|
+
# Deserialize a JSON object to an instance of WorkflowOutputJson
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [WorkflowOutputJson]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
JSON.parse(json_object)
|
33
|
+
id = struct.id
|
34
|
+
name = struct.name
|
35
|
+
value = struct.value
|
36
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Serialize an instance of WorkflowOutputJson to a JSON object
|
40
|
+
#
|
41
|
+
# @return [JSON]
|
42
|
+
def to_json(*_args)
|
43
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
# 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.
|
47
|
+
#
|
48
|
+
# @param obj [Object]
|
49
|
+
# @return [Void]
|
50
|
+
def self.validate_raw(obj:)
|
51
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
52
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
53
|
+
obj.value.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A number output from a Workflow execution.
|
7
|
+
class WorkflowOutputNumber
|
8
|
+
attr_reader :id, :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param id [String]
|
11
|
+
# @param name [String] The output's name, as defined in the workflow
|
12
|
+
# @param value [Float]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [WorkflowOutputNumber]
|
15
|
+
def initialize(id:, name:, value:, additional_properties: nil)
|
16
|
+
# @type [String]
|
17
|
+
@id = id
|
18
|
+
# @type [String] The output's name, as defined in the workflow
|
19
|
+
@name = name
|
20
|
+
# @type [Float]
|
21
|
+
@value = value
|
22
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
end
|
25
|
+
|
26
|
+
# Deserialize a JSON object to an instance of WorkflowOutputNumber
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [WorkflowOutputNumber]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
JSON.parse(json_object)
|
33
|
+
id = struct.id
|
34
|
+
name = struct.name
|
35
|
+
value = struct.value
|
36
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Serialize an instance of WorkflowOutputNumber to a JSON object
|
40
|
+
#
|
41
|
+
# @return [JSON]
|
42
|
+
def to_json(*_args)
|
43
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
# 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.
|
47
|
+
#
|
48
|
+
# @param obj [Object]
|
49
|
+
# @return [Void]
|
50
|
+
def self.validate_raw(obj:)
|
51
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
52
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
53
|
+
obj.value.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "search_result"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A search results output from a Workflow execution.
|
8
|
+
class WorkflowOutputSearchResults
|
9
|
+
attr_reader :id, :name, :value, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String]
|
12
|
+
# @param name [String] The output's name, as defined in the workflow
|
13
|
+
# @param value [Array<SearchResult>]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [WorkflowOutputSearchResults]
|
16
|
+
def initialize(id:, name:, value:, additional_properties: nil)
|
17
|
+
# @type [String]
|
18
|
+
@id = id
|
19
|
+
# @type [String] The output's name, as defined in the workflow
|
20
|
+
@name = name
|
21
|
+
# @type [Array<SearchResult>]
|
22
|
+
@value = value
|
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 WorkflowOutputSearchResults
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [WorkflowOutputSearchResults]
|
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
|
+
name = struct.name
|
36
|
+
value = parsed_json["value"].map do |v|
|
37
|
+
v = v.to_json
|
38
|
+
SearchResult.from_json(json_object: v)
|
39
|
+
end
|
40
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Serialize an instance of WorkflowOutputSearchResults to a JSON object
|
44
|
+
#
|
45
|
+
# @return [JSON]
|
46
|
+
def to_json(*_args)
|
47
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
48
|
+
end
|
49
|
+
|
50
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
51
|
+
#
|
52
|
+
# @param obj [Object]
|
53
|
+
# @return [Void]
|
54
|
+
def self.validate_raw(obj:)
|
55
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
56
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
57
|
+
obj.value.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A string output from a Workflow execution.
|
7
|
+
class WorkflowOutputString
|
8
|
+
attr_reader :id, :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param id [String]
|
11
|
+
# @param name [String] The output's name, as defined in the workflow
|
12
|
+
# @param value [String]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [WorkflowOutputString]
|
15
|
+
def initialize(id:, name:, value:, additional_properties: nil)
|
16
|
+
# @type [String]
|
17
|
+
@id = id
|
18
|
+
# @type [String] The output's name, as defined in the workflow
|
19
|
+
@name = name
|
20
|
+
# @type [String]
|
21
|
+
@value = value
|
22
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
end
|
25
|
+
|
26
|
+
# Deserialize a JSON object to an instance of WorkflowOutputString
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [WorkflowOutputString]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
JSON.parse(json_object)
|
33
|
+
id = struct.id
|
34
|
+
name = struct.name
|
35
|
+
value = struct.value
|
36
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Serialize an instance of WorkflowOutputString to a JSON object
|
40
|
+
#
|
41
|
+
# @return [JSON]
|
42
|
+
def to_json(*_args)
|
43
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
# 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.
|
47
|
+
#
|
48
|
+
# @param obj [Object]
|
49
|
+
# @return [Void]
|
50
|
+
def self.validate_raw(obj:)
|
51
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
52
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
53
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_message_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class WorkflowRequestChatHistoryInputRequest
|
8
|
+
attr_reader :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param name [String] The variable's name, as defined in the Workflow.
|
11
|
+
# @param value [Array<ChatMessageRequest>]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [WorkflowRequestChatHistoryInputRequest]
|
14
|
+
def initialize(name:, value:, additional_properties: nil)
|
15
|
+
# @type [String] The variable's name, as defined in the Workflow.
|
16
|
+
@name = name
|
17
|
+
# @type [Array<ChatMessageRequest>]
|
18
|
+
@value = value
|
19
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
@additional_properties = additional_properties
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of WorkflowRequestChatHistoryInputRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [WorkflowRequestChatHistoryInputRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
name = struct.name
|
31
|
+
value = parsed_json["value"].map do |v|
|
32
|
+
v = v.to_json
|
33
|
+
ChatMessageRequest.from_json(json_object: v)
|
34
|
+
end
|
35
|
+
new(name: name, value: value, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of WorkflowRequestChatHistoryInputRequest to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "name": @name, "value": @value }.to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
46
|
+
#
|
47
|
+
# @param obj [Object]
|
48
|
+
# @return [Void]
|
49
|
+
def self.validate_raw(obj:)
|
50
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
51
|
+
obj.value.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "workflow_request_string_input_request"
|
5
|
+
require_relative "workflow_request_json_input_request"
|
6
|
+
require_relative "workflow_request_chat_history_input_request"
|
7
|
+
require_relative "workflow_request_number_input_request"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class WorkflowRequestInputRequest
|
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 [WorkflowRequestInputRequest]
|
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 WorkflowRequestInputRequest
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [WorkflowRequestInputRequest]
|
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
|
+
WorkflowRequestStringInputRequest.from_json(json_object: json_object)
|
34
|
+
when "JSON"
|
35
|
+
WorkflowRequestJsonInputRequest.from_json(json_object: json_object)
|
36
|
+
when "CHAT_HISTORY"
|
37
|
+
WorkflowRequestChatHistoryInputRequest.from_json(json_object: json_object)
|
38
|
+
when "NUMBER"
|
39
|
+
WorkflowRequestNumberInputRequest.from_json(json_object: json_object)
|
40
|
+
else
|
41
|
+
WorkflowRequestStringInputRequest.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 "CHAT_HISTORY"
|
56
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
57
|
+
when "NUMBER"
|
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
|
+
WorkflowRequestStringInputRequest.validate_raw(obj: obj)
|
73
|
+
when "JSON"
|
74
|
+
WorkflowRequestJsonInputRequest.validate_raw(obj: obj)
|
75
|
+
when "CHAT_HISTORY"
|
76
|
+
WorkflowRequestChatHistoryInputRequest.validate_raw(obj: obj)
|
77
|
+
when "NUMBER"
|
78
|
+
WorkflowRequestNumberInputRequest.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 [WorkflowRequestStringInputRequest]
|
93
|
+
# @return [WorkflowRequestInputRequest]
|
94
|
+
def self.string(member:)
|
95
|
+
new(member: member, discriminant: "STRING")
|
96
|
+
end
|
97
|
+
|
98
|
+
# @param member [WorkflowRequestJsonInputRequest]
|
99
|
+
# @return [WorkflowRequestInputRequest]
|
100
|
+
def self.json(member:)
|
101
|
+
new(member: member, discriminant: "JSON")
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param member [WorkflowRequestChatHistoryInputRequest]
|
105
|
+
# @return [WorkflowRequestInputRequest]
|
106
|
+
def self.chat_history(member:)
|
107
|
+
new(member: member, discriminant: "CHAT_HISTORY")
|
108
|
+
end
|
109
|
+
|
110
|
+
# @param member [WorkflowRequestNumberInputRequest]
|
111
|
+
# @return [WorkflowRequestInputRequest]
|
112
|
+
def self.number(member:)
|
113
|
+
new(member: member, discriminant: "NUMBER")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class WorkflowRequestJsonInputRequest
|
7
|
+
attr_reader :name, :value, :additional_properties
|
8
|
+
|
9
|
+
# @param name [String] The variable's name, as defined in the Workflow.
|
10
|
+
# @param value [Hash{String => String}]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [WorkflowRequestJsonInputRequest]
|
13
|
+
def initialize(name:, value:, additional_properties: nil)
|
14
|
+
# @type [String] The variable's name, as defined in the Workflow.
|
15
|
+
@name = name
|
16
|
+
# @type [Hash{String => String}]
|
17
|
+
@value = value
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of WorkflowRequestJsonInputRequest
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [WorkflowRequestJsonInputRequest]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
name = struct.name
|
30
|
+
value = struct.value
|
31
|
+
new(name: name, value: value, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of WorkflowRequestJsonInputRequest to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "name": @name, "value": @value }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
47
|
+
obj.value.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class WorkflowRequestNumberInputRequest
|
7
|
+
attr_reader :name, :value, :additional_properties
|
8
|
+
|
9
|
+
# @param name [String] The variable's name, as defined in the Workflow.
|
10
|
+
# @param value [Float]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [WorkflowRequestNumberInputRequest]
|
13
|
+
def initialize(name:, value:, additional_properties: nil)
|
14
|
+
# @type [String] The variable's name, as defined in the Workflow.
|
15
|
+
@name = name
|
16
|
+
# @type [Float]
|
17
|
+
@value = value
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of WorkflowRequestNumberInputRequest
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [WorkflowRequestNumberInputRequest]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
name = struct.name
|
30
|
+
value = struct.value
|
31
|
+
new(name: name, value: value, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of WorkflowRequestNumberInputRequest to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "name": @name, "value": @value }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
47
|
+
obj.value.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class WorkflowRequestStringInputRequest
|
7
|
+
attr_reader :name, :value, :additional_properties
|
8
|
+
|
9
|
+
# @param name [String] The variable's name, as defined in the Workflow.
|
10
|
+
# @param value [String]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [WorkflowRequestStringInputRequest]
|
13
|
+
def initialize(name:, value:, additional_properties: nil)
|
14
|
+
# @type [String] The variable's name, as defined in the Workflow.
|
15
|
+
@name = name
|
16
|
+
# @type [String]
|
17
|
+
@value = value
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of WorkflowRequestStringInputRequest
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [WorkflowRequestStringInputRequest]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
name = struct.name
|
30
|
+
value = struct.value
|
31
|
+
new(name: name, value: value, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of WorkflowRequestStringInputRequest to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "name": @name, "value": @value }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
47
|
+
obj.value.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require "date"
|
5
|
+
require_relative "workflow_result_event_output_data"
|
6
|
+
require_relative "workflow_event_error"
|
7
|
+
require_relative "workflow_output"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Vellum
|
11
|
+
class WorkflowResultEvent
|
12
|
+
attr_reader :id, :state, :ts, :output, :error, :outputs, :additional_properties
|
13
|
+
|
14
|
+
# @param id [String]
|
15
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
16
|
+
# @param ts [DateTime]
|
17
|
+
# @param output [WorkflowResultEventOutputData]
|
18
|
+
# @param error [WorkflowEventError]
|
19
|
+
# @param outputs [Array<WorkflowOutput>]
|
20
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
# @return [WorkflowResultEvent]
|
22
|
+
def initialize(id:, state:, ts:, output: nil, error: nil, outputs: nil, additional_properties: nil)
|
23
|
+
# @type [String]
|
24
|
+
@id = id
|
25
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
26
|
+
@state = state
|
27
|
+
# @type [DateTime]
|
28
|
+
@ts = ts
|
29
|
+
# @type [WorkflowResultEventOutputData]
|
30
|
+
@output = output
|
31
|
+
# @type [WorkflowEventError]
|
32
|
+
@error = error
|
33
|
+
# @type [Array<WorkflowOutput>]
|
34
|
+
@outputs = outputs
|
35
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
36
|
+
@additional_properties = additional_properties
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deserialize a JSON object to an instance of WorkflowResultEvent
|
40
|
+
#
|
41
|
+
# @param json_object [JSON]
|
42
|
+
# @return [WorkflowResultEvent]
|
43
|
+
def self.from_json(json_object:)
|
44
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
45
|
+
parsed_json = JSON.parse(json_object)
|
46
|
+
id = struct.id
|
47
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
48
|
+
ts = DateTime.parse(parsed_json["ts"])
|
49
|
+
if parsed_json["output"].nil?
|
50
|
+
output = nil
|
51
|
+
else
|
52
|
+
output = parsed_json["output"].to_json
|
53
|
+
output = WorkflowResultEventOutputData.from_json(json_object: output)
|
54
|
+
end
|
55
|
+
if parsed_json["error"].nil?
|
56
|
+
error = nil
|
57
|
+
else
|
58
|
+
error = parsed_json["error"].to_json
|
59
|
+
error = WorkflowEventError.from_json(json_object: error)
|
60
|
+
end
|
61
|
+
outputs = parsed_json["outputs"].map do |v|
|
62
|
+
v = v.to_json
|
63
|
+
WorkflowOutput.from_json(json_object: v)
|
64
|
+
end
|
65
|
+
new(id: id, state: state, ts: ts, output: output, error: error, outputs: outputs, additional_properties: struct)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Serialize an instance of WorkflowResultEvent to a JSON object
|
69
|
+
#
|
70
|
+
# @return [JSON]
|
71
|
+
def to_json(*_args)
|
72
|
+
{
|
73
|
+
"id": @id,
|
74
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
75
|
+
"ts": @ts,
|
76
|
+
"output": @output,
|
77
|
+
"error": @error,
|
78
|
+
"outputs": @outputs
|
79
|
+
}.to_json
|
80
|
+
end
|
81
|
+
|
82
|
+
# 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.
|
83
|
+
#
|
84
|
+
# @param obj [Object]
|
85
|
+
# @return [Void]
|
86
|
+
def self.validate_raw(obj:)
|
87
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
88
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
89
|
+
obj.ts.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
|
90
|
+
obj.output.nil? || WorkflowResultEventOutputData.validate_raw(obj: obj.output)
|
91
|
+
obj.error.nil? || WorkflowEventError.validate_raw(obj: obj.error)
|
92
|
+
obj.outputs&.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|