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,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "finish_reason_enum"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`.
|
8
|
+
class RejectedPromptExecutionMeta
|
9
|
+
attr_reader :latency, :finish_reason, :additional_properties
|
10
|
+
|
11
|
+
# @param latency [Integer]
|
12
|
+
# @param finish_reason [FINISH_REASON_ENUM]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [RejectedPromptExecutionMeta]
|
15
|
+
def initialize(latency: nil, finish_reason: nil, additional_properties: nil)
|
16
|
+
# @type [Integer]
|
17
|
+
@latency = latency
|
18
|
+
# @type [FINISH_REASON_ENUM]
|
19
|
+
@finish_reason = finish_reason
|
20
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
@additional_properties = additional_properties
|
22
|
+
end
|
23
|
+
|
24
|
+
# Deserialize a JSON object to an instance of RejectedPromptExecutionMeta
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [RejectedPromptExecutionMeta]
|
28
|
+
def self.from_json(json_object:)
|
29
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
+
parsed_json = JSON.parse(json_object)
|
31
|
+
latency = struct.latency
|
32
|
+
finish_reason = FINISH_REASON_ENUM.key(parsed_json["finish_reason"]) || parsed_json["finish_reason"]
|
33
|
+
new(latency: latency, finish_reason: finish_reason, additional_properties: struct)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Serialize an instance of RejectedPromptExecutionMeta to a JSON object
|
37
|
+
#
|
38
|
+
# @return [JSON]
|
39
|
+
def to_json(*_args)
|
40
|
+
{ "latency": @latency, "finish_reason": FINISH_REASON_ENUM[@finish_reason] || @finish_reason }.to_json
|
41
|
+
end
|
42
|
+
|
43
|
+
# 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.
|
44
|
+
#
|
45
|
+
# @param obj [Object]
|
46
|
+
# @return [Void]
|
47
|
+
def self.validate_raw(obj:)
|
48
|
+
obj.latency&.is_a?(Integer) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.")
|
49
|
+
obj.finish_reason&.is_a?(FINISH_REASON_ENUM) != false || raise("Passed value for field obj.finish_reason is not the expected type, validation failed.")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "workflow_node_result_data"
|
5
|
+
require_relative "workflow_event_error"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
# An event that indicates that the node has rejected its execution.
|
10
|
+
class RejectedWorkflowNodeResultEvent
|
11
|
+
attr_reader :id, :node_id, :node_result_id, :ts, :data, :error, :additional_properties
|
12
|
+
|
13
|
+
# @param id [String]
|
14
|
+
# @param node_id [String]
|
15
|
+
# @param node_result_id [String]
|
16
|
+
# @param ts [DateTime]
|
17
|
+
# @param data [WorkflowNodeResultData]
|
18
|
+
# @param error [WorkflowEventError]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [RejectedWorkflowNodeResultEvent]
|
21
|
+
def initialize(id:, node_id:, node_result_id:, error:, ts: nil, data: nil, additional_properties: nil)
|
22
|
+
# @type [String]
|
23
|
+
@id = id
|
24
|
+
# @type [String]
|
25
|
+
@node_id = node_id
|
26
|
+
# @type [String]
|
27
|
+
@node_result_id = node_result_id
|
28
|
+
# @type [DateTime]
|
29
|
+
@ts = ts
|
30
|
+
# @type [WorkflowNodeResultData]
|
31
|
+
@data = data
|
32
|
+
# @type [WorkflowEventError]
|
33
|
+
@error = error
|
34
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
35
|
+
@additional_properties = additional_properties
|
36
|
+
end
|
37
|
+
|
38
|
+
# Deserialize a JSON object to an instance of RejectedWorkflowNodeResultEvent
|
39
|
+
#
|
40
|
+
# @param json_object [JSON]
|
41
|
+
# @return [RejectedWorkflowNodeResultEvent]
|
42
|
+
def self.from_json(json_object:)
|
43
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
44
|
+
parsed_json = JSON.parse(json_object)
|
45
|
+
id = struct.id
|
46
|
+
node_id = struct.node_id
|
47
|
+
node_result_id = struct.node_result_id
|
48
|
+
ts = DateTime.parse(parsed_json["ts"])
|
49
|
+
if parsed_json["data"].nil?
|
50
|
+
data = nil
|
51
|
+
else
|
52
|
+
data = parsed_json["data"].to_json
|
53
|
+
data = WorkflowNodeResultData.from_json(json_object: data)
|
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
|
+
new(id: id, node_id: node_id, node_result_id: node_result_id, ts: ts, data: data, error: error,
|
62
|
+
additional_properties: struct)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Serialize an instance of RejectedWorkflowNodeResultEvent to a JSON object
|
66
|
+
#
|
67
|
+
# @return [JSON]
|
68
|
+
def to_json(*_args)
|
69
|
+
{
|
70
|
+
"id": @id,
|
71
|
+
"node_id": @node_id,
|
72
|
+
"node_result_id": @node_result_id,
|
73
|
+
"ts": @ts,
|
74
|
+
"data": @data,
|
75
|
+
"error": @error
|
76
|
+
}.to_json
|
77
|
+
end
|
78
|
+
|
79
|
+
# 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.
|
80
|
+
#
|
81
|
+
# @param obj [Object]
|
82
|
+
# @return [Void]
|
83
|
+
def self.validate_raw(obj:)
|
84
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
85
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
86
|
+
obj.node_result_id.is_a?(String) != false || raise("Passed value for field obj.node_result_id is not the expected type, validation failed.")
|
87
|
+
obj.ts&.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
|
88
|
+
obj.data.nil? || WorkflowNodeResultData.validate_raw(obj: obj.data)
|
89
|
+
WorkflowEventError.validate_raw(obj: obj.error)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "scenario_input"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class SandboxScenario
|
8
|
+
attr_reader :label, :inputs, :id, :additional_properties
|
9
|
+
|
10
|
+
# @param label [String]
|
11
|
+
# @param inputs [Array<ScenarioInput>] The inputs for the scenario
|
12
|
+
# @param id [String] The id of the scenario
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [SandboxScenario]
|
15
|
+
def initialize(inputs:, id:, label: nil, additional_properties: nil)
|
16
|
+
# @type [String]
|
17
|
+
@label = label
|
18
|
+
# @type [Array<ScenarioInput>] The inputs for the scenario
|
19
|
+
@inputs = inputs
|
20
|
+
# @type [String] The id of the scenario
|
21
|
+
@id = id
|
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 SandboxScenario
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [SandboxScenario]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
parsed_json = JSON.parse(json_object)
|
33
|
+
label = struct.label
|
34
|
+
inputs = parsed_json["inputs"].map do |v|
|
35
|
+
v = v.to_json
|
36
|
+
ScenarioInput.from_json(json_object: v)
|
37
|
+
end
|
38
|
+
id = struct.id
|
39
|
+
new(label: label, inputs: inputs, id: id, additional_properties: struct)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Serialize an instance of SandboxScenario to a JSON object
|
43
|
+
#
|
44
|
+
# @return [JSON]
|
45
|
+
def to_json(*_args)
|
46
|
+
{ "label": @label, "inputs": @inputs, "id": @id }.to_json
|
47
|
+
end
|
48
|
+
|
49
|
+
# 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.
|
50
|
+
#
|
51
|
+
# @param obj [Object]
|
52
|
+
# @return [Void]
|
53
|
+
def self.validate_raw(obj:)
|
54
|
+
obj.label&.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
55
|
+
obj.inputs.is_a?(Array) != false || raise("Passed value for field obj.inputs is not the expected type, validation failed.")
|
56
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "scenario_input_type_enum"
|
4
|
+
require_relative "chat_message"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class ScenarioInput
|
9
|
+
attr_reader :key, :type, :value, :chat_history, :additional_properties
|
10
|
+
|
11
|
+
# @param key [String]
|
12
|
+
# @param type [SCENARIO_INPUT_TYPE_ENUM]
|
13
|
+
# @param value [String]
|
14
|
+
# @param chat_history [Array<ChatMessage>]
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [ScenarioInput]
|
17
|
+
def initialize(key:, type: nil, value: nil, chat_history: nil, additional_properties: nil)
|
18
|
+
# @type [String]
|
19
|
+
@key = key
|
20
|
+
# @type [SCENARIO_INPUT_TYPE_ENUM]
|
21
|
+
@type = type
|
22
|
+
# @type [String]
|
23
|
+
@value = value
|
24
|
+
# @type [Array<ChatMessage>]
|
25
|
+
@chat_history = chat_history
|
26
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
end
|
29
|
+
|
30
|
+
# Deserialize a JSON object to an instance of ScenarioInput
|
31
|
+
#
|
32
|
+
# @param json_object [JSON]
|
33
|
+
# @return [ScenarioInput]
|
34
|
+
def self.from_json(json_object:)
|
35
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
|
+
parsed_json = JSON.parse(json_object)
|
37
|
+
key = struct.key
|
38
|
+
type = SCENARIO_INPUT_TYPE_ENUM.key(parsed_json["type"]) || parsed_json["type"]
|
39
|
+
value = struct.value
|
40
|
+
chat_history = parsed_json["chat_history"].map do |v|
|
41
|
+
v = v.to_json
|
42
|
+
ChatMessage.from_json(json_object: v)
|
43
|
+
end
|
44
|
+
new(key: key, type: type, value: value, chat_history: chat_history, additional_properties: struct)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Serialize an instance of ScenarioInput to a JSON object
|
48
|
+
#
|
49
|
+
# @return [JSON]
|
50
|
+
def to_json(*_args)
|
51
|
+
{
|
52
|
+
"key": @key,
|
53
|
+
"type": SCENARIO_INPUT_TYPE_ENUM[@type] || @type,
|
54
|
+
"value": @value,
|
55
|
+
"chat_history": @chat_history
|
56
|
+
}.to_json
|
57
|
+
end
|
58
|
+
|
59
|
+
# 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.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
65
|
+
obj.type&.is_a?(SCENARIO_INPUT_TYPE_ENUM) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
66
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
67
|
+
obj.chat_history&.is_a?(Array) != false || raise("Passed value for field obj.chat_history is not the expected type, validation failed.")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "scenario_input_type_enum"
|
4
|
+
require_relative "chat_message_request"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class ScenarioInputRequest
|
9
|
+
attr_reader :key, :type, :value, :chat_history, :additional_properties
|
10
|
+
|
11
|
+
# @param key [String]
|
12
|
+
# @param type [SCENARIO_INPUT_TYPE_ENUM]
|
13
|
+
# @param value [String]
|
14
|
+
# @param chat_history [Array<ChatMessageRequest>]
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [ScenarioInputRequest]
|
17
|
+
def initialize(key:, type: nil, value: nil, chat_history: nil, additional_properties: nil)
|
18
|
+
# @type [String]
|
19
|
+
@key = key
|
20
|
+
# @type [SCENARIO_INPUT_TYPE_ENUM]
|
21
|
+
@type = type
|
22
|
+
# @type [String]
|
23
|
+
@value = value
|
24
|
+
# @type [Array<ChatMessageRequest>]
|
25
|
+
@chat_history = chat_history
|
26
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
@additional_properties = additional_properties
|
28
|
+
end
|
29
|
+
|
30
|
+
# Deserialize a JSON object to an instance of ScenarioInputRequest
|
31
|
+
#
|
32
|
+
# @param json_object [JSON]
|
33
|
+
# @return [ScenarioInputRequest]
|
34
|
+
def self.from_json(json_object:)
|
35
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
|
+
parsed_json = JSON.parse(json_object)
|
37
|
+
key = struct.key
|
38
|
+
type = SCENARIO_INPUT_TYPE_ENUM.key(parsed_json["type"]) || parsed_json["type"]
|
39
|
+
value = struct.value
|
40
|
+
chat_history = parsed_json["chat_history"].map do |v|
|
41
|
+
v = v.to_json
|
42
|
+
ChatMessageRequest.from_json(json_object: v)
|
43
|
+
end
|
44
|
+
new(key: key, type: type, value: value, chat_history: chat_history, additional_properties: struct)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Serialize an instance of ScenarioInputRequest to a JSON object
|
48
|
+
#
|
49
|
+
# @return [JSON]
|
50
|
+
def to_json(*_args)
|
51
|
+
{
|
52
|
+
"key": @key,
|
53
|
+
"type": SCENARIO_INPUT_TYPE_ENUM[@type] || @type,
|
54
|
+
"value": @value,
|
55
|
+
"chat_history": @chat_history
|
56
|
+
}.to_json
|
57
|
+
end
|
58
|
+
|
59
|
+
# 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.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.")
|
65
|
+
obj.type&.is_a?(SCENARIO_INPUT_TYPE_ENUM) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
66
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
67
|
+
obj.chat_history&.is_a?(Array) != false || raise("Passed value for field obj.chat_history is not the expected type, validation failed.")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class SearchErrorResponse
|
7
|
+
attr_reader :detail, :additional_properties
|
8
|
+
|
9
|
+
# @param detail [String] Details about why the request failed.
|
10
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
# @return [SearchErrorResponse]
|
12
|
+
def initialize(detail:, additional_properties: nil)
|
13
|
+
# @type [String] Details about why the request failed.
|
14
|
+
@detail = detail
|
15
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
@additional_properties = additional_properties
|
17
|
+
end
|
18
|
+
|
19
|
+
# Deserialize a JSON object to an instance of SearchErrorResponse
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [SearchErrorResponse]
|
23
|
+
def self.from_json(json_object:)
|
24
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
25
|
+
JSON.parse(json_object)
|
26
|
+
detail = struct.detail
|
27
|
+
new(detail: detail, additional_properties: struct)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Serialize an instance of SearchErrorResponse to a JSON object
|
31
|
+
#
|
32
|
+
# @return [JSON]
|
33
|
+
def to_json(*_args)
|
34
|
+
{ "detail": @detail }.to_json
|
35
|
+
end
|
36
|
+
|
37
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
38
|
+
#
|
39
|
+
# @param obj [Object]
|
40
|
+
# @return [Void]
|
41
|
+
def self.validate_raw(obj:)
|
42
|
+
obj.detail.is_a?(String) != false || raise("Passed value for field obj.detail is not the expected type, validation failed.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "metadata_filter_config_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class SearchFiltersRequest
|
8
|
+
attr_reader :external_ids, :metadata, :additional_properties
|
9
|
+
|
10
|
+
# @param external_ids [Array<String>] The document external IDs to filter by
|
11
|
+
# @param metadata [MetadataFilterConfigRequest] The metadata filters to apply to the search
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [SearchFiltersRequest]
|
14
|
+
def initialize(external_ids: nil, metadata: nil, additional_properties: nil)
|
15
|
+
# @type [Array<String>] The document external IDs to filter by
|
16
|
+
@external_ids = external_ids
|
17
|
+
# @type [MetadataFilterConfigRequest] The metadata filters to apply to the search
|
18
|
+
@metadata = metadata
|
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 SearchFiltersRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [SearchFiltersRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
external_ids = struct.external_ids
|
31
|
+
if parsed_json["metadata"].nil?
|
32
|
+
metadata = nil
|
33
|
+
else
|
34
|
+
metadata = parsed_json["metadata"].to_json
|
35
|
+
metadata = MetadataFilterConfigRequest.from_json(json_object: metadata)
|
36
|
+
end
|
37
|
+
new(external_ids: external_ids, metadata: metadata, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of SearchFiltersRequest to a JSON object
|
41
|
+
#
|
42
|
+
# @return [JSON]
|
43
|
+
def to_json(*_args)
|
44
|
+
{ "external_ids": @external_ids, "metadata": @metadata }.to_json
|
45
|
+
end
|
46
|
+
|
47
|
+
# 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.
|
48
|
+
#
|
49
|
+
# @param obj [Object]
|
50
|
+
# @return [Void]
|
51
|
+
def self.validate_raw(obj:)
|
52
|
+
obj.external_ids&.is_a?(Array) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.")
|
53
|
+
obj.metadata.nil? || MetadataFilterConfigRequest.validate_raw(obj: obj.metadata)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "search_node_result_data"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# A Node Result Event emitted from a Search Node.
|
8
|
+
class SearchNodeResult
|
9
|
+
attr_reader :data, :additional_properties
|
10
|
+
|
11
|
+
# @param data [SearchNodeResultData]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [SearchNodeResult]
|
14
|
+
def initialize(data:, additional_properties: nil)
|
15
|
+
# @type [SearchNodeResultData]
|
16
|
+
@data = data
|
17
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
@additional_properties = additional_properties
|
19
|
+
end
|
20
|
+
|
21
|
+
# Deserialize a JSON object to an instance of SearchNodeResult
|
22
|
+
#
|
23
|
+
# @param json_object [JSON]
|
24
|
+
# @return [SearchNodeResult]
|
25
|
+
def self.from_json(json_object:)
|
26
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
27
|
+
parsed_json = JSON.parse(json_object)
|
28
|
+
if parsed_json["data"].nil?
|
29
|
+
data = nil
|
30
|
+
else
|
31
|
+
data = parsed_json["data"].to_json
|
32
|
+
data = SearchNodeResultData.from_json(json_object: data)
|
33
|
+
end
|
34
|
+
new(data: data, additional_properties: struct)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Serialize an instance of SearchNodeResult to a JSON object
|
38
|
+
#
|
39
|
+
# @return [JSON]
|
40
|
+
def to_json(*_args)
|
41
|
+
{ "data": @data }.to_json
|
42
|
+
end
|
43
|
+
|
44
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
45
|
+
#
|
46
|
+
# @param obj [Object]
|
47
|
+
# @return [Void]
|
48
|
+
def self.validate_raw(obj:)
|
49
|
+
SearchNodeResultData.validate_raw(obj: obj.data)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "search_result"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class SearchNodeResultData
|
8
|
+
attr_reader :results_output_id, :results, :text_output_id, :text, :additional_properties
|
9
|
+
|
10
|
+
# @param results_output_id [String]
|
11
|
+
# @param results [Array<SearchResult>] The results of the search. Each result represents a chunk that matches the search query.
|
12
|
+
# @param text_output_id [String]
|
13
|
+
# @param text [String]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [SearchNodeResultData]
|
16
|
+
def initialize(results_output_id:, results:, text_output_id:, text: nil, additional_properties: nil)
|
17
|
+
# @type [String]
|
18
|
+
@results_output_id = results_output_id
|
19
|
+
# @type [Array<SearchResult>] The results of the search. Each result represents a chunk that matches the search query.
|
20
|
+
@results = results
|
21
|
+
# @type [String]
|
22
|
+
@text_output_id = text_output_id
|
23
|
+
# @type [String]
|
24
|
+
@text = text
|
25
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
26
|
+
@additional_properties = additional_properties
|
27
|
+
end
|
28
|
+
|
29
|
+
# Deserialize a JSON object to an instance of SearchNodeResultData
|
30
|
+
#
|
31
|
+
# @param json_object [JSON]
|
32
|
+
# @return [SearchNodeResultData]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
results_output_id = struct.results_output_id
|
37
|
+
results = parsed_json["results"].map do |v|
|
38
|
+
v = v.to_json
|
39
|
+
SearchResult.from_json(json_object: v)
|
40
|
+
end
|
41
|
+
text_output_id = struct.text_output_id
|
42
|
+
text = struct.text
|
43
|
+
new(results_output_id: results_output_id, results: results, text_output_id: text_output_id, text: text,
|
44
|
+
additional_properties: struct)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Serialize an instance of SearchNodeResultData to a JSON object
|
48
|
+
#
|
49
|
+
# @return [JSON]
|
50
|
+
def to_json(*_args)
|
51
|
+
{
|
52
|
+
"results_output_id": @results_output_id,
|
53
|
+
"results": @results,
|
54
|
+
"text_output_id": @text_output_id,
|
55
|
+
"text": @text
|
56
|
+
}.to_json
|
57
|
+
end
|
58
|
+
|
59
|
+
# 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.
|
60
|
+
#
|
61
|
+
# @param obj [Object]
|
62
|
+
# @return [Void]
|
63
|
+
def self.validate_raw(obj:)
|
64
|
+
obj.results_output_id.is_a?(String) != false || raise("Passed value for field obj.results_output_id is not the expected type, validation failed.")
|
65
|
+
obj.results.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
|
66
|
+
obj.text_output_id.is_a?(String) != false || raise("Passed value for field obj.text_output_id is not the expected type, validation failed.")
|
67
|
+
obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "search_weights_request"
|
4
|
+
require_relative "search_result_merging_request"
|
5
|
+
require_relative "search_filters_request"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class SearchRequestOptionsRequest
|
10
|
+
attr_reader :limit, :weights, :result_merging, :filters, :additional_properties
|
11
|
+
|
12
|
+
# @param limit [Integer] The maximum number of results to return.
|
13
|
+
# @param weights [SearchWeightsRequest] The weights to use for the search. Must add up to 1.0.
|
14
|
+
# @param result_merging [SearchResultMergingRequest] The configuration for merging results.
|
15
|
+
# @param filters [SearchFiltersRequest] The filters to apply to the search.
|
16
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
# @return [SearchRequestOptionsRequest]
|
18
|
+
def initialize(limit: nil, weights: nil, result_merging: nil, filters: nil, additional_properties: nil)
|
19
|
+
# @type [Integer] The maximum number of results to return.
|
20
|
+
@limit = limit
|
21
|
+
# @type [SearchWeightsRequest] The weights to use for the search. Must add up to 1.0.
|
22
|
+
@weights = weights
|
23
|
+
# @type [SearchResultMergingRequest] The configuration for merging results.
|
24
|
+
@result_merging = result_merging
|
25
|
+
# @type [SearchFiltersRequest] The filters to apply to the search.
|
26
|
+
@filters = filters
|
27
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
28
|
+
@additional_properties = additional_properties
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deserialize a JSON object to an instance of SearchRequestOptionsRequest
|
32
|
+
#
|
33
|
+
# @param json_object [JSON]
|
34
|
+
# @return [SearchRequestOptionsRequest]
|
35
|
+
def self.from_json(json_object:)
|
36
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
|
+
parsed_json = JSON.parse(json_object)
|
38
|
+
limit = struct.limit
|
39
|
+
if parsed_json["weights"].nil?
|
40
|
+
weights = nil
|
41
|
+
else
|
42
|
+
weights = parsed_json["weights"].to_json
|
43
|
+
weights = SearchWeightsRequest.from_json(json_object: weights)
|
44
|
+
end
|
45
|
+
if parsed_json["result_merging"].nil?
|
46
|
+
result_merging = nil
|
47
|
+
else
|
48
|
+
result_merging = parsed_json["result_merging"].to_json
|
49
|
+
result_merging = SearchResultMergingRequest.from_json(json_object: result_merging)
|
50
|
+
end
|
51
|
+
if parsed_json["filters"].nil?
|
52
|
+
filters = nil
|
53
|
+
else
|
54
|
+
filters = parsed_json["filters"].to_json
|
55
|
+
filters = SearchFiltersRequest.from_json(json_object: filters)
|
56
|
+
end
|
57
|
+
new(limit: limit, weights: weights, result_merging: result_merging, filters: filters,
|
58
|
+
additional_properties: struct)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Serialize an instance of SearchRequestOptionsRequest to a JSON object
|
62
|
+
#
|
63
|
+
# @return [JSON]
|
64
|
+
def to_json(*_args)
|
65
|
+
{ "limit": @limit, "weights": @weights, "result_merging": @result_merging, "filters": @filters }.to_json
|
66
|
+
end
|
67
|
+
|
68
|
+
# 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.
|
69
|
+
#
|
70
|
+
# @param obj [Object]
|
71
|
+
# @return [Void]
|
72
|
+
def self.validate_raw(obj:)
|
73
|
+
obj.limit&.is_a?(Integer) != false || raise("Passed value for field obj.limit is not the expected type, validation failed.")
|
74
|
+
obj.weights.nil? || SearchWeightsRequest.validate_raw(obj: obj.weights)
|
75
|
+
obj.result_merging.nil? || SearchResultMergingRequest.validate_raw(obj: obj.result_merging)
|
76
|
+
obj.filters.nil? || SearchFiltersRequest.validate_raw(obj: obj.filters)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|