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,142 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "workflow_result_event_output_data_string"
|
5
|
+
require_relative "workflow_result_event_output_data_number"
|
6
|
+
require_relative "workflow_result_event_output_data_json"
|
7
|
+
require_relative "workflow_result_event_output_data_chat_history"
|
8
|
+
require_relative "workflow_result_event_output_data_search_results"
|
9
|
+
require_relative "workflow_result_event_output_data_error"
|
10
|
+
|
11
|
+
module Vellum
|
12
|
+
class WorkflowResultEventOutputData
|
13
|
+
attr_reader :member, :discriminant
|
14
|
+
|
15
|
+
private_class_method :new
|
16
|
+
alias kind_of? is_a?
|
17
|
+
# @param member [Object]
|
18
|
+
# @param discriminant [String]
|
19
|
+
# @return [WorkflowResultEventOutputData]
|
20
|
+
def initialize(member:, discriminant:)
|
21
|
+
# @type [Object]
|
22
|
+
@member = member
|
23
|
+
# @type [String]
|
24
|
+
@discriminant = discriminant
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputData
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [WorkflowResultEventOutputData]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
member = case struct.type
|
34
|
+
when "STRING"
|
35
|
+
WorkflowResultEventOutputDataString.from_json(json_object: json_object)
|
36
|
+
when "NUMBER"
|
37
|
+
WorkflowResultEventOutputDataNumber.from_json(json_object: json_object)
|
38
|
+
when "JSON"
|
39
|
+
WorkflowResultEventOutputDataJson.from_json(json_object: json_object)
|
40
|
+
when "CHAT_HISTORY"
|
41
|
+
WorkflowResultEventOutputDataChatHistory.from_json(json_object: json_object)
|
42
|
+
when "SEARCH_RESULTS"
|
43
|
+
WorkflowResultEventOutputDataSearchResults.from_json(json_object: json_object)
|
44
|
+
when "ERROR"
|
45
|
+
WorkflowResultEventOutputDataError.from_json(json_object: json_object)
|
46
|
+
else
|
47
|
+
WorkflowResultEventOutputDataString.from_json(json_object: json_object)
|
48
|
+
end
|
49
|
+
new(member: member, discriminant: struct.type)
|
50
|
+
end
|
51
|
+
|
52
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
53
|
+
#
|
54
|
+
# @return [JSON]
|
55
|
+
def to_json(*_args)
|
56
|
+
case @discriminant
|
57
|
+
when "STRING"
|
58
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
59
|
+
when "NUMBER"
|
60
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
61
|
+
when "JSON"
|
62
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
63
|
+
when "CHAT_HISTORY"
|
64
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
65
|
+
when "SEARCH_RESULTS"
|
66
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
67
|
+
when "ERROR"
|
68
|
+
{ **@member.to_json, type: @discriminant }.to_json
|
69
|
+
else
|
70
|
+
{ "type": @discriminant, value: @member }.to_json
|
71
|
+
end
|
72
|
+
@member.to_json
|
73
|
+
end
|
74
|
+
|
75
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
76
|
+
#
|
77
|
+
# @param obj [Object]
|
78
|
+
# @return [Void]
|
79
|
+
def self.validate_raw(obj:)
|
80
|
+
case obj.type
|
81
|
+
when "STRING"
|
82
|
+
WorkflowResultEventOutputDataString.validate_raw(obj: obj)
|
83
|
+
when "NUMBER"
|
84
|
+
WorkflowResultEventOutputDataNumber.validate_raw(obj: obj)
|
85
|
+
when "JSON"
|
86
|
+
WorkflowResultEventOutputDataJson.validate_raw(obj: obj)
|
87
|
+
when "CHAT_HISTORY"
|
88
|
+
WorkflowResultEventOutputDataChatHistory.validate_raw(obj: obj)
|
89
|
+
when "SEARCH_RESULTS"
|
90
|
+
WorkflowResultEventOutputDataSearchResults.validate_raw(obj: obj)
|
91
|
+
when "ERROR"
|
92
|
+
WorkflowResultEventOutputDataError.validate_raw(obj: obj)
|
93
|
+
else
|
94
|
+
raise("Passed value matched no type within the union, validation failed.")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
99
|
+
#
|
100
|
+
# @param obj [Object]
|
101
|
+
# @return [Boolean]
|
102
|
+
def is_a?(obj)
|
103
|
+
@member.is_a?(obj)
|
104
|
+
end
|
105
|
+
|
106
|
+
# @param member [WorkflowResultEventOutputDataString]
|
107
|
+
# @return [WorkflowResultEventOutputData]
|
108
|
+
def self.string(member:)
|
109
|
+
new(member: member, discriminant: "STRING")
|
110
|
+
end
|
111
|
+
|
112
|
+
# @param member [WorkflowResultEventOutputDataNumber]
|
113
|
+
# @return [WorkflowResultEventOutputData]
|
114
|
+
def self.number(member:)
|
115
|
+
new(member: member, discriminant: "NUMBER")
|
116
|
+
end
|
117
|
+
|
118
|
+
# @param member [WorkflowResultEventOutputDataJson]
|
119
|
+
# @return [WorkflowResultEventOutputData]
|
120
|
+
def self.json(member:)
|
121
|
+
new(member: member, discriminant: "JSON")
|
122
|
+
end
|
123
|
+
|
124
|
+
# @param member [WorkflowResultEventOutputDataChatHistory]
|
125
|
+
# @return [WorkflowResultEventOutputData]
|
126
|
+
def self.chat_history(member:)
|
127
|
+
new(member: member, discriminant: "CHAT_HISTORY")
|
128
|
+
end
|
129
|
+
|
130
|
+
# @param member [WorkflowResultEventOutputDataSearchResults]
|
131
|
+
# @return [WorkflowResultEventOutputData]
|
132
|
+
def self.search_results(member:)
|
133
|
+
new(member: member, discriminant: "SEARCH_RESULTS")
|
134
|
+
end
|
135
|
+
|
136
|
+
# @param member [WorkflowResultEventOutputDataError]
|
137
|
+
# @return [WorkflowResultEventOutputData]
|
138
|
+
def self.error(member:)
|
139
|
+
new(member: member, discriminant: "ERROR")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require_relative "chat_message"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# A Chat History output streamed from a Workflow execution.
|
9
|
+
class WorkflowResultEventOutputDataChatHistory
|
10
|
+
attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
|
11
|
+
|
12
|
+
# @param id [String]
|
13
|
+
# @param name [String]
|
14
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
15
|
+
# @param node_id [String]
|
16
|
+
# @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
17
|
+
# @param value [Array<ChatMessage>]
|
18
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
# @return [WorkflowResultEventOutputDataChatHistory]
|
20
|
+
def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
|
21
|
+
# @type [String]
|
22
|
+
@id = id
|
23
|
+
# @type [String]
|
24
|
+
@name = name
|
25
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
26
|
+
@state = state
|
27
|
+
# @type [String]
|
28
|
+
@node_id = node_id
|
29
|
+
# @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
30
|
+
@delta = delta
|
31
|
+
# @type [Array<ChatMessage>]
|
32
|
+
@value = value
|
33
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputDataChatHistory
|
38
|
+
#
|
39
|
+
# @param json_object [JSON]
|
40
|
+
# @return [WorkflowResultEventOutputDataChatHistory]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
id = struct.id
|
45
|
+
name = struct.name
|
46
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
47
|
+
node_id = struct.node_id
|
48
|
+
delta = struct.delta
|
49
|
+
value = parsed_json["value"].map do |v|
|
50
|
+
v = v.to_json
|
51
|
+
ChatMessage.from_json(json_object: v)
|
52
|
+
end
|
53
|
+
new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Serialize an instance of WorkflowResultEventOutputDataChatHistory to a JSON object
|
57
|
+
#
|
58
|
+
# @return [JSON]
|
59
|
+
def to_json(*_args)
|
60
|
+
{
|
61
|
+
"id": @id,
|
62
|
+
"name": @name,
|
63
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
64
|
+
"node_id": @node_id,
|
65
|
+
"delta": @delta,
|
66
|
+
"value": @value
|
67
|
+
}.to_json
|
68
|
+
end
|
69
|
+
|
70
|
+
# 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.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Void]
|
74
|
+
def self.validate_raw(obj:)
|
75
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
76
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
77
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
78
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
79
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
80
|
+
obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require_relative "vellum_error"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# An Error output streamed from a Workflow execution.
|
9
|
+
class WorkflowResultEventOutputDataError
|
10
|
+
attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
|
11
|
+
|
12
|
+
# @param id [String]
|
13
|
+
# @param name [String]
|
14
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
15
|
+
# @param node_id [String]
|
16
|
+
# @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
17
|
+
# @param value [VellumError]
|
18
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
# @return [WorkflowResultEventOutputDataError]
|
20
|
+
def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
|
21
|
+
# @type [String]
|
22
|
+
@id = id
|
23
|
+
# @type [String]
|
24
|
+
@name = name
|
25
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
26
|
+
@state = state
|
27
|
+
# @type [String]
|
28
|
+
@node_id = node_id
|
29
|
+
# @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
30
|
+
@delta = delta
|
31
|
+
# @type [VellumError]
|
32
|
+
@value = value
|
33
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputDataError
|
38
|
+
#
|
39
|
+
# @param json_object [JSON]
|
40
|
+
# @return [WorkflowResultEventOutputDataError]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
id = struct.id
|
45
|
+
name = struct.name
|
46
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
47
|
+
node_id = struct.node_id
|
48
|
+
delta = struct.delta
|
49
|
+
if parsed_json["value"].nil?
|
50
|
+
value = nil
|
51
|
+
else
|
52
|
+
value = parsed_json["value"].to_json
|
53
|
+
value = VellumError.from_json(json_object: value)
|
54
|
+
end
|
55
|
+
new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Serialize an instance of WorkflowResultEventOutputDataError to a JSON object
|
59
|
+
#
|
60
|
+
# @return [JSON]
|
61
|
+
def to_json(*_args)
|
62
|
+
{
|
63
|
+
"id": @id,
|
64
|
+
"name": @name,
|
65
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
66
|
+
"node_id": @node_id,
|
67
|
+
"delta": @delta,
|
68
|
+
"value": @value
|
69
|
+
}.to_json
|
70
|
+
end
|
71
|
+
|
72
|
+
# 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.
|
73
|
+
#
|
74
|
+
# @param obj [Object]
|
75
|
+
# @return [Void]
|
76
|
+
def self.validate_raw(obj:)
|
77
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
78
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
79
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
80
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
81
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
82
|
+
obj.value.nil? || VellumError.validate_raw(obj: obj.value)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A JSON output streamed from a Workflow execution.
|
8
|
+
class WorkflowResultEventOutputDataJson
|
9
|
+
attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String]
|
12
|
+
# @param name [String]
|
13
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
14
|
+
# @param node_id [String]
|
15
|
+
# @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
16
|
+
# @param value [Hash{String => String}]
|
17
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
# @return [WorkflowResultEventOutputDataJson]
|
19
|
+
def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
|
20
|
+
# @type [String]
|
21
|
+
@id = id
|
22
|
+
# @type [String]
|
23
|
+
@name = name
|
24
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
25
|
+
@state = state
|
26
|
+
# @type [String]
|
27
|
+
@node_id = node_id
|
28
|
+
# @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
29
|
+
@delta = delta
|
30
|
+
# @type [Hash{String => String}]
|
31
|
+
@value = value
|
32
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputDataJson
|
37
|
+
#
|
38
|
+
# @param json_object [JSON]
|
39
|
+
# @return [WorkflowResultEventOutputDataJson]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
id = struct.id
|
44
|
+
name = struct.name
|
45
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
46
|
+
node_id = struct.node_id
|
47
|
+
delta = struct.delta
|
48
|
+
value = struct.value
|
49
|
+
new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Serialize an instance of WorkflowResultEventOutputDataJson to a JSON object
|
53
|
+
#
|
54
|
+
# @return [JSON]
|
55
|
+
def to_json(*_args)
|
56
|
+
{
|
57
|
+
"id": @id,
|
58
|
+
"name": @name,
|
59
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
60
|
+
"node_id": @node_id,
|
61
|
+
"delta": @delta,
|
62
|
+
"value": @value
|
63
|
+
}.to_json
|
64
|
+
end
|
65
|
+
|
66
|
+
# 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.
|
67
|
+
#
|
68
|
+
# @param obj [Object]
|
69
|
+
# @return [Void]
|
70
|
+
def self.validate_raw(obj:)
|
71
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
72
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
73
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
74
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
75
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
76
|
+
obj.value&.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A number output streamed from a Workflow execution.
|
8
|
+
class WorkflowResultEventOutputDataNumber
|
9
|
+
attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String]
|
12
|
+
# @param name [String]
|
13
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
14
|
+
# @param node_id [String]
|
15
|
+
# @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
16
|
+
# @param value [Float]
|
17
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
# @return [WorkflowResultEventOutputDataNumber]
|
19
|
+
def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
|
20
|
+
# @type [String]
|
21
|
+
@id = id
|
22
|
+
# @type [String]
|
23
|
+
@name = name
|
24
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
25
|
+
@state = state
|
26
|
+
# @type [String]
|
27
|
+
@node_id = node_id
|
28
|
+
# @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
29
|
+
@delta = delta
|
30
|
+
# @type [Float]
|
31
|
+
@value = value
|
32
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputDataNumber
|
37
|
+
#
|
38
|
+
# @param json_object [JSON]
|
39
|
+
# @return [WorkflowResultEventOutputDataNumber]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
id = struct.id
|
44
|
+
name = struct.name
|
45
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
46
|
+
node_id = struct.node_id
|
47
|
+
delta = struct.delta
|
48
|
+
value = struct.value
|
49
|
+
new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Serialize an instance of WorkflowResultEventOutputDataNumber to a JSON object
|
53
|
+
#
|
54
|
+
# @return [JSON]
|
55
|
+
def to_json(*_args)
|
56
|
+
{
|
57
|
+
"id": @id,
|
58
|
+
"name": @name,
|
59
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
60
|
+
"node_id": @node_id,
|
61
|
+
"delta": @delta,
|
62
|
+
"value": @value
|
63
|
+
}.to_json
|
64
|
+
end
|
65
|
+
|
66
|
+
# 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.
|
67
|
+
#
|
68
|
+
# @param obj [Object]
|
69
|
+
# @return [Void]
|
70
|
+
def self.validate_raw(obj:)
|
71
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
72
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
73
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
74
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
75
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
76
|
+
obj.value&.is_a?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require_relative "search_result"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# A Search Results output streamed from a Workflow execution.
|
9
|
+
class WorkflowResultEventOutputDataSearchResults
|
10
|
+
attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
|
11
|
+
|
12
|
+
# @param id [String]
|
13
|
+
# @param name [String]
|
14
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
15
|
+
# @param node_id [String]
|
16
|
+
# @param delta [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
17
|
+
# @param value [Array<SearchResult>]
|
18
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
# @return [WorkflowResultEventOutputDataSearchResults]
|
20
|
+
def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
|
21
|
+
# @type [String]
|
22
|
+
@id = id
|
23
|
+
# @type [String]
|
24
|
+
@name = name
|
25
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
26
|
+
@state = state
|
27
|
+
# @type [String]
|
28
|
+
@node_id = node_id
|
29
|
+
# @type [String] The newly output string value. Only relevant for string outputs with a state of STREAMING.
|
30
|
+
@delta = delta
|
31
|
+
# @type [Array<SearchResult>]
|
32
|
+
@value = value
|
33
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputDataSearchResults
|
38
|
+
#
|
39
|
+
# @param json_object [JSON]
|
40
|
+
# @return [WorkflowResultEventOutputDataSearchResults]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
id = struct.id
|
45
|
+
name = struct.name
|
46
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
47
|
+
node_id = struct.node_id
|
48
|
+
delta = struct.delta
|
49
|
+
value = parsed_json["value"].map do |v|
|
50
|
+
v = v.to_json
|
51
|
+
SearchResult.from_json(json_object: v)
|
52
|
+
end
|
53
|
+
new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Serialize an instance of WorkflowResultEventOutputDataSearchResults to a JSON object
|
57
|
+
#
|
58
|
+
# @return [JSON]
|
59
|
+
def to_json(*_args)
|
60
|
+
{
|
61
|
+
"id": @id,
|
62
|
+
"name": @name,
|
63
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
64
|
+
"node_id": @node_id,
|
65
|
+
"delta": @delta,
|
66
|
+
"value": @value
|
67
|
+
}.to_json
|
68
|
+
end
|
69
|
+
|
70
|
+
# 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.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Void]
|
74
|
+
def self.validate_raw(obj:)
|
75
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
76
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
77
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
78
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
79
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
80
|
+
obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "workflow_node_result_event_state"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A string output streamed from a Workflow execution.
|
8
|
+
class WorkflowResultEventOutputDataString
|
9
|
+
attr_reader :id, :name, :state, :node_id, :delta, :value, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String]
|
12
|
+
# @param name [String]
|
13
|
+
# @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
14
|
+
# @param node_id [String]
|
15
|
+
# @param delta [String] The newly output string value, meant to be concatenated with all previous. Will be non-null for events of state STREAMING.
|
16
|
+
# @param value [String] The entire string value. Will be non-null for events of state FULFILLED.
|
17
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
# @return [WorkflowResultEventOutputDataString]
|
19
|
+
def initialize(name:, state:, node_id:, id: nil, delta: nil, value: nil, additional_properties: nil)
|
20
|
+
# @type [String]
|
21
|
+
@id = id
|
22
|
+
# @type [String]
|
23
|
+
@name = name
|
24
|
+
# @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
|
25
|
+
@state = state
|
26
|
+
# @type [String]
|
27
|
+
@node_id = node_id
|
28
|
+
# @type [String] The newly output string value, meant to be concatenated with all previous. Will be non-null for events of state STREAMING.
|
29
|
+
@delta = delta
|
30
|
+
# @type [String] The entire string value. Will be non-null for events of state FULFILLED.
|
31
|
+
@value = value
|
32
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of WorkflowResultEventOutputDataString
|
37
|
+
#
|
38
|
+
# @param json_object [JSON]
|
39
|
+
# @return [WorkflowResultEventOutputDataString]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
id = struct.id
|
44
|
+
name = struct.name
|
45
|
+
state = WORKFLOW_NODE_RESULT_EVENT_STATE.key(parsed_json["state"]) || parsed_json["state"]
|
46
|
+
node_id = struct.node_id
|
47
|
+
delta = struct.delta
|
48
|
+
value = struct.value
|
49
|
+
new(id: id, name: name, state: state, node_id: node_id, delta: delta, value: value, additional_properties: struct)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Serialize an instance of WorkflowResultEventOutputDataString to a JSON object
|
53
|
+
#
|
54
|
+
# @return [JSON]
|
55
|
+
def to_json(*_args)
|
56
|
+
{
|
57
|
+
"id": @id,
|
58
|
+
"name": @name,
|
59
|
+
"state": WORKFLOW_NODE_RESULT_EVENT_STATE[@state] || @state,
|
60
|
+
"node_id": @node_id,
|
61
|
+
"delta": @delta,
|
62
|
+
"value": @value
|
63
|
+
}.to_json
|
64
|
+
end
|
65
|
+
|
66
|
+
# 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.
|
67
|
+
#
|
68
|
+
# @param obj [Object]
|
69
|
+
# @return [Void]
|
70
|
+
def self.validate_raw(obj:)
|
71
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
72
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
73
|
+
obj.state.is_a?(WORKFLOW_NODE_RESULT_EVENT_STATE) != false || raise("Passed value for field obj.state is not the expected type, validation failed.")
|
74
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
75
|
+
obj.delta&.is_a?(String) != false || raise("Passed value for field obj.delta is not the expected type, validation failed.")
|
76
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|