vellum_ai 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- 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,155 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "prompt_node_result"
|
5
|
+
require_relative "search_node_result"
|
6
|
+
require_relative "templating_node_result"
|
7
|
+
require_relative "code_execution_node_result"
|
8
|
+
require_relative "conditional_node_result"
|
9
|
+
require_relative "api_node_result"
|
10
|
+
require_relative "terminal_node_result"
|
11
|
+
|
12
|
+
module Vellum
|
13
|
+
class WorkflowNodeResultData
|
14
|
+
attr_reader :member, :discriminant
|
15
|
+
|
16
|
+
private_class_method :new
|
17
|
+
alias kind_of? is_a?
|
18
|
+
# @param member [Object]
|
19
|
+
# @param discriminant [String]
|
20
|
+
# @return [WorkflowNodeResultData]
|
21
|
+
def initialize(member:, discriminant:)
|
22
|
+
# @type [Object]
|
23
|
+
@member = member
|
24
|
+
# @type [String]
|
25
|
+
@discriminant = discriminant
|
26
|
+
end
|
27
|
+
|
28
|
+
# Deserialize a JSON object to an instance of WorkflowNodeResultData
|
29
|
+
#
|
30
|
+
# @param json_object [JSON]
|
31
|
+
# @return [WorkflowNodeResultData]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
member = case struct.type
|
35
|
+
when "PROMPT"
|
36
|
+
PromptNodeResult.from_json(json_object: json_object)
|
37
|
+
when "SEARCH"
|
38
|
+
SearchNodeResult.from_json(json_object: json_object)
|
39
|
+
when "TEMPLATING"
|
40
|
+
TemplatingNodeResult.from_json(json_object: json_object)
|
41
|
+
when "CODE_EXECUTION"
|
42
|
+
CodeExecutionNodeResult.from_json(json_object: json_object)
|
43
|
+
when "CONDITIONAL"
|
44
|
+
ConditionalNodeResult.from_json(json_object: json_object)
|
45
|
+
when "API"
|
46
|
+
ApiNodeResult.from_json(json_object: json_object)
|
47
|
+
when "TERMINAL"
|
48
|
+
TerminalNodeResult.from_json(json_object: json_object)
|
49
|
+
else
|
50
|
+
PromptNodeResult.from_json(json_object: json_object)
|
51
|
+
end
|
52
|
+
new(member: member, discriminant: struct.type)
|
53
|
+
end
|
54
|
+
|
55
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
56
|
+
#
|
57
|
+
# @return [JSON]
|
58
|
+
def to_json(*_args)
|
59
|
+
case @discriminant
|
60
|
+
when "PROMPT"
|
61
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
62
|
+
when "SEARCH"
|
63
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
64
|
+
when "TEMPLATING"
|
65
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
66
|
+
when "CODE_EXECUTION"
|
67
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
68
|
+
when "CONDITIONAL"
|
69
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
70
|
+
when "API"
|
71
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
72
|
+
when "TERMINAL"
|
73
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
74
|
+
else
|
75
|
+
{ "type": @discriminant, value: @member }.to_json
|
76
|
+
end
|
77
|
+
@member.to_json
|
78
|
+
end
|
79
|
+
|
80
|
+
# 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.
|
81
|
+
#
|
82
|
+
# @param obj [Object]
|
83
|
+
# @return [Void]
|
84
|
+
def self.validate_raw(obj:)
|
85
|
+
case obj.type
|
86
|
+
when "PROMPT"
|
87
|
+
PromptNodeResult.validate_raw(obj: obj)
|
88
|
+
when "SEARCH"
|
89
|
+
SearchNodeResult.validate_raw(obj: obj)
|
90
|
+
when "TEMPLATING"
|
91
|
+
TemplatingNodeResult.validate_raw(obj: obj)
|
92
|
+
when "CODE_EXECUTION"
|
93
|
+
CodeExecutionNodeResult.validate_raw(obj: obj)
|
94
|
+
when "CONDITIONAL"
|
95
|
+
ConditionalNodeResult.validate_raw(obj: obj)
|
96
|
+
when "API"
|
97
|
+
ApiNodeResult.validate_raw(obj: obj)
|
98
|
+
when "TERMINAL"
|
99
|
+
TerminalNodeResult.validate_raw(obj: obj)
|
100
|
+
else
|
101
|
+
raise("Passed value matched no type within the union, validation failed.")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
106
|
+
#
|
107
|
+
# @param obj [Object]
|
108
|
+
# @return [Boolean]
|
109
|
+
def is_a?(obj)
|
110
|
+
@member.is_a?(obj)
|
111
|
+
end
|
112
|
+
|
113
|
+
# @param member [PromptNodeResult]
|
114
|
+
# @return [WorkflowNodeResultData]
|
115
|
+
def self.prompt(member:)
|
116
|
+
new(member: member, discriminant: "PROMPT")
|
117
|
+
end
|
118
|
+
|
119
|
+
# @param member [SearchNodeResult]
|
120
|
+
# @return [WorkflowNodeResultData]
|
121
|
+
def self.search(member:)
|
122
|
+
new(member: member, discriminant: "SEARCH")
|
123
|
+
end
|
124
|
+
|
125
|
+
# @param member [TemplatingNodeResult]
|
126
|
+
# @return [WorkflowNodeResultData]
|
127
|
+
def self.templating(member:)
|
128
|
+
new(member: member, discriminant: "TEMPLATING")
|
129
|
+
end
|
130
|
+
|
131
|
+
# @param member [CodeExecutionNodeResult]
|
132
|
+
# @return [WorkflowNodeResultData]
|
133
|
+
def self.code_execution(member:)
|
134
|
+
new(member: member, discriminant: "CODE_EXECUTION")
|
135
|
+
end
|
136
|
+
|
137
|
+
# @param member [ConditionalNodeResult]
|
138
|
+
# @return [WorkflowNodeResultData]
|
139
|
+
def self.conditional(member:)
|
140
|
+
new(member: member, discriminant: "CONDITIONAL")
|
141
|
+
end
|
142
|
+
|
143
|
+
# @param member [ApiNodeResult]
|
144
|
+
# @return [WorkflowNodeResultData]
|
145
|
+
def self.api(member:)
|
146
|
+
new(member: member, discriminant: "API")
|
147
|
+
end
|
148
|
+
|
149
|
+
# @param member [TerminalNodeResult]
|
150
|
+
# @return [WorkflowNodeResultData]
|
151
|
+
def self.terminal(member:)
|
152
|
+
new(member: member, discriminant: "TERMINAL")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "initiated_workflow_node_result_event"
|
5
|
+
require_relative "streaming_workflow_node_result_event"
|
6
|
+
require_relative "fulfilled_workflow_node_result_event"
|
7
|
+
require_relative "rejected_workflow_node_result_event"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class WorkflowNodeResultEvent
|
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 [WorkflowNodeResultEvent]
|
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 WorkflowNodeResultEvent
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [WorkflowNodeResultEvent]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
member = case struct.state
|
32
|
+
when "INITIATED"
|
33
|
+
InitiatedWorkflowNodeResultEvent.from_json(json_object: json_object)
|
34
|
+
when "STREAMING"
|
35
|
+
StreamingWorkflowNodeResultEvent.from_json(json_object: json_object)
|
36
|
+
when "FULFILLED"
|
37
|
+
FulfilledWorkflowNodeResultEvent.from_json(json_object: json_object)
|
38
|
+
when "REJECTED"
|
39
|
+
RejectedWorkflowNodeResultEvent.from_json(json_object: json_object)
|
40
|
+
else
|
41
|
+
InitiatedWorkflowNodeResultEvent.from_json(json_object: json_object)
|
42
|
+
end
|
43
|
+
new(member: member, discriminant: struct.state)
|
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 "INITIATED"
|
52
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
53
|
+
when "STREAMING"
|
54
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
55
|
+
when "FULFILLED"
|
56
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
57
|
+
when "REJECTED"
|
58
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
59
|
+
else
|
60
|
+
{ "state": @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.state
|
71
|
+
when "INITIATED"
|
72
|
+
InitiatedWorkflowNodeResultEvent.validate_raw(obj: obj)
|
73
|
+
when "STREAMING"
|
74
|
+
StreamingWorkflowNodeResultEvent.validate_raw(obj: obj)
|
75
|
+
when "FULFILLED"
|
76
|
+
FulfilledWorkflowNodeResultEvent.validate_raw(obj: obj)
|
77
|
+
when "REJECTED"
|
78
|
+
RejectedWorkflowNodeResultEvent.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 [InitiatedWorkflowNodeResultEvent]
|
93
|
+
# @return [WorkflowNodeResultEvent]
|
94
|
+
def self.initiated(member:)
|
95
|
+
new(member: member, discriminant: "INITIATED")
|
96
|
+
end
|
97
|
+
|
98
|
+
# @param member [StreamingWorkflowNodeResultEvent]
|
99
|
+
# @return [WorkflowNodeResultEvent]
|
100
|
+
def self.streaming(member:)
|
101
|
+
new(member: member, discriminant: "STREAMING")
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param member [FulfilledWorkflowNodeResultEvent]
|
105
|
+
# @return [WorkflowNodeResultEvent]
|
106
|
+
def self.fulfilled(member:)
|
107
|
+
new(member: member, discriminant: "FULFILLED")
|
108
|
+
end
|
109
|
+
|
110
|
+
# @param member [RejectedWorkflowNodeResultEvent]
|
111
|
+
# @return [WorkflowNodeResultEvent]
|
112
|
+
def self.rejected(member:)
|
113
|
+
new(member: member, discriminant: "REJECTED")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "workflow_output_string"
|
5
|
+
require_relative "workflow_output_number"
|
6
|
+
require_relative "workflow_output_json"
|
7
|
+
require_relative "workflow_output_chat_history"
|
8
|
+
require_relative "workflow_output_search_results"
|
9
|
+
require_relative "workflow_output_error"
|
10
|
+
require_relative "workflow_output_function_call"
|
11
|
+
require_relative "workflow_output_image"
|
12
|
+
|
13
|
+
module Vellum
|
14
|
+
class WorkflowOutput
|
15
|
+
attr_reader :member, :discriminant
|
16
|
+
|
17
|
+
private_class_method :new
|
18
|
+
alias kind_of? is_a?
|
19
|
+
# @param member [Object]
|
20
|
+
# @param discriminant [String]
|
21
|
+
# @return [WorkflowOutput]
|
22
|
+
def initialize(member:, discriminant:)
|
23
|
+
# @type [Object]
|
24
|
+
@member = member
|
25
|
+
# @type [String]
|
26
|
+
@discriminant = discriminant
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of WorkflowOutput
|
30
|
+
#
|
31
|
+
# @param json_object [JSON]
|
32
|
+
# @return [WorkflowOutput]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
member = case struct.type
|
36
|
+
when "STRING"
|
37
|
+
WorkflowOutputString.from_json(json_object: json_object)
|
38
|
+
when "NUMBER"
|
39
|
+
WorkflowOutputNumber.from_json(json_object: json_object)
|
40
|
+
when "JSON"
|
41
|
+
WorkflowOutputJson.from_json(json_object: json_object)
|
42
|
+
when "CHAT_HISTORY"
|
43
|
+
WorkflowOutputChatHistory.from_json(json_object: json_object)
|
44
|
+
when "SEARCH_RESULTS"
|
45
|
+
WorkflowOutputSearchResults.from_json(json_object: json_object)
|
46
|
+
when "ERROR"
|
47
|
+
WorkflowOutputError.from_json(json_object: json_object)
|
48
|
+
when "FUNCTION_CALL"
|
49
|
+
WorkflowOutputFunctionCall.from_json(json_object: json_object)
|
50
|
+
when "IMAGE"
|
51
|
+
WorkflowOutputImage.from_json(json_object: json_object)
|
52
|
+
else
|
53
|
+
WorkflowOutputString.from_json(json_object: json_object)
|
54
|
+
end
|
55
|
+
new(member: member, discriminant: struct.type)
|
56
|
+
end
|
57
|
+
|
58
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
59
|
+
#
|
60
|
+
# @return [JSON]
|
61
|
+
def to_json(*_args)
|
62
|
+
case @discriminant
|
63
|
+
when "STRING"
|
64
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
65
|
+
when "NUMBER"
|
66
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
67
|
+
when "JSON"
|
68
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
69
|
+
when "CHAT_HISTORY"
|
70
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
71
|
+
when "SEARCH_RESULTS"
|
72
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
73
|
+
when "ERROR"
|
74
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
75
|
+
when "FUNCTION_CALL"
|
76
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
77
|
+
when "IMAGE"
|
78
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
79
|
+
else
|
80
|
+
{ "type": @discriminant, value: @member }.to_json
|
81
|
+
end
|
82
|
+
@member.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
|
+
case obj.type
|
91
|
+
when "STRING"
|
92
|
+
WorkflowOutputString.validate_raw(obj: obj)
|
93
|
+
when "NUMBER"
|
94
|
+
WorkflowOutputNumber.validate_raw(obj: obj)
|
95
|
+
when "JSON"
|
96
|
+
WorkflowOutputJson.validate_raw(obj: obj)
|
97
|
+
when "CHAT_HISTORY"
|
98
|
+
WorkflowOutputChatHistory.validate_raw(obj: obj)
|
99
|
+
when "SEARCH_RESULTS"
|
100
|
+
WorkflowOutputSearchResults.validate_raw(obj: obj)
|
101
|
+
when "ERROR"
|
102
|
+
WorkflowOutputError.validate_raw(obj: obj)
|
103
|
+
when "FUNCTION_CALL"
|
104
|
+
WorkflowOutputFunctionCall.validate_raw(obj: obj)
|
105
|
+
when "IMAGE"
|
106
|
+
WorkflowOutputImage.validate_raw(obj: obj)
|
107
|
+
else
|
108
|
+
raise("Passed value matched no type within the union, validation failed.")
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
113
|
+
#
|
114
|
+
# @param obj [Object]
|
115
|
+
# @return [Boolean]
|
116
|
+
def is_a?(obj)
|
117
|
+
@member.is_a?(obj)
|
118
|
+
end
|
119
|
+
|
120
|
+
# @param member [WorkflowOutputString]
|
121
|
+
# @return [WorkflowOutput]
|
122
|
+
def self.string(member:)
|
123
|
+
new(member: member, discriminant: "STRING")
|
124
|
+
end
|
125
|
+
|
126
|
+
# @param member [WorkflowOutputNumber]
|
127
|
+
# @return [WorkflowOutput]
|
128
|
+
def self.number(member:)
|
129
|
+
new(member: member, discriminant: "NUMBER")
|
130
|
+
end
|
131
|
+
|
132
|
+
# @param member [WorkflowOutputJson]
|
133
|
+
# @return [WorkflowOutput]
|
134
|
+
def self.json(member:)
|
135
|
+
new(member: member, discriminant: "JSON")
|
136
|
+
end
|
137
|
+
|
138
|
+
# @param member [WorkflowOutputChatHistory]
|
139
|
+
# @return [WorkflowOutput]
|
140
|
+
def self.chat_history(member:)
|
141
|
+
new(member: member, discriminant: "CHAT_HISTORY")
|
142
|
+
end
|
143
|
+
|
144
|
+
# @param member [WorkflowOutputSearchResults]
|
145
|
+
# @return [WorkflowOutput]
|
146
|
+
def self.search_results(member:)
|
147
|
+
new(member: member, discriminant: "SEARCH_RESULTS")
|
148
|
+
end
|
149
|
+
|
150
|
+
# @param member [WorkflowOutputError]
|
151
|
+
# @return [WorkflowOutput]
|
152
|
+
def self.error(member:)
|
153
|
+
new(member: member, discriminant: "ERROR")
|
154
|
+
end
|
155
|
+
|
156
|
+
# @param member [WorkflowOutputFunctionCall]
|
157
|
+
# @return [WorkflowOutput]
|
158
|
+
def self.function_call(member:)
|
159
|
+
new(member: member, discriminant: "FUNCTION_CALL")
|
160
|
+
end
|
161
|
+
|
162
|
+
# @param member [WorkflowOutputImage]
|
163
|
+
# @return [WorkflowOutput]
|
164
|
+
def self.image(member:)
|
165
|
+
new(member: member, discriminant: "IMAGE")
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_message"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A chat history output from a Workflow execution.
|
8
|
+
class WorkflowOutputChatHistory
|
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<ChatMessage>]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [WorkflowOutputChatHistory]
|
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<ChatMessage>]
|
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 WorkflowOutputChatHistory
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [WorkflowOutputChatHistory]
|
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
|
+
ChatMessage.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 WorkflowOutputChatHistory 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,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_error"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# An error output from a Workflow execution.
|
8
|
+
class WorkflowOutputError
|
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 [VellumError]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [WorkflowOutputError]
|
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 [VellumError]
|
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 WorkflowOutputError
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [WorkflowOutputError]
|
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
|
+
if parsed_json["value"].nil?
|
37
|
+
value = nil
|
38
|
+
else
|
39
|
+
value = parsed_json["value"].to_json
|
40
|
+
value = VellumError.from_json(json_object: value)
|
41
|
+
end
|
42
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of WorkflowOutputError to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
58
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
59
|
+
VellumError.validate_raw(obj: obj.value)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "function_call"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A function call output from a Workflow execution.
|
8
|
+
class WorkflowOutputFunctionCall
|
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 [FunctionCall]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [WorkflowOutputFunctionCall]
|
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 [FunctionCall]
|
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 WorkflowOutputFunctionCall
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [WorkflowOutputFunctionCall]
|
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
|
+
if parsed_json["value"].nil?
|
37
|
+
value = nil
|
38
|
+
else
|
39
|
+
value = parsed_json["value"].to_json
|
40
|
+
value = FunctionCall.from_json(json_object: value)
|
41
|
+
end
|
42
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of WorkflowOutputFunctionCall to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
58
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
59
|
+
FunctionCall.validate_raw(obj: obj.value)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_image"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# An image output from a Workflow execution.
|
8
|
+
class WorkflowOutputImage
|
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 [VellumImage]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [WorkflowOutputImage]
|
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 [VellumImage]
|
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 WorkflowOutputImage
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [WorkflowOutputImage]
|
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
|
+
if parsed_json["value"].nil?
|
37
|
+
value = nil
|
38
|
+
else
|
39
|
+
value = parsed_json["value"].to_json
|
40
|
+
value = VellumImage.from_json(json_object: value)
|
41
|
+
end
|
42
|
+
new(id: id, name: name, value: value, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of WorkflowOutputImage to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{ "id": @id, "name": @name, "value": @value }.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
58
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
59
|
+
VellumImage.validate_raw(obj: obj.value)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|