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,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "generate_result_data"
|
4
|
+
require_relative "generate_result_error"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class GenerateResult
|
9
|
+
attr_reader :data, :error, :additional_properties
|
10
|
+
|
11
|
+
# @param data [GenerateResultData] An object containing the resulting generation. This key will be absent if the LLM provider experienced an error.
|
12
|
+
# @param error [GenerateResultError] An object containing details about the error that occurred. This key will be absent if the LLM provider did not experience an error.
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [GenerateResult]
|
15
|
+
def initialize(data: nil, error: nil, additional_properties: nil)
|
16
|
+
# @type [GenerateResultData] An object containing the resulting generation. This key will be absent if the LLM provider experienced an error.
|
17
|
+
@data = data
|
18
|
+
# @type [GenerateResultError] An object containing details about the error that occurred. This key will be absent if the LLM provider did not experience an error.
|
19
|
+
@error = error
|
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 GenerateResult
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [GenerateResult]
|
28
|
+
def self.from_json(json_object:)
|
29
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
+
parsed_json = JSON.parse(json_object)
|
31
|
+
if parsed_json["data"].nil?
|
32
|
+
data = nil
|
33
|
+
else
|
34
|
+
data = parsed_json["data"].to_json
|
35
|
+
data = GenerateResultData.from_json(json_object: data)
|
36
|
+
end
|
37
|
+
if parsed_json["error"].nil?
|
38
|
+
error = nil
|
39
|
+
else
|
40
|
+
error = parsed_json["error"].to_json
|
41
|
+
error = GenerateResultError.from_json(json_object: error)
|
42
|
+
end
|
43
|
+
new(data: data, error: error, additional_properties: struct)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Serialize an instance of GenerateResult to a JSON object
|
47
|
+
#
|
48
|
+
# @return [JSON]
|
49
|
+
def to_json(*_args)
|
50
|
+
{ "data": @data, "error": @error }.to_json
|
51
|
+
end
|
52
|
+
|
53
|
+
# 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.
|
54
|
+
#
|
55
|
+
# @param obj [Object]
|
56
|
+
# @return [Void]
|
57
|
+
def self.validate_raw(obj:)
|
58
|
+
obj.data.nil? || GenerateResultData.validate_raw(obj: obj.data)
|
59
|
+
obj.error.nil? || GenerateResultError.validate_raw(obj: obj.error)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "enriched_normalized_completion"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class GenerateResultData
|
8
|
+
attr_reader :completions, :additional_properties
|
9
|
+
|
10
|
+
# @param completions [Array<EnrichedNormalizedCompletion>] The generated completions. This will generally be a list of length one.
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [GenerateResultData]
|
13
|
+
def initialize(completions:, additional_properties: nil)
|
14
|
+
# @type [Array<EnrichedNormalizedCompletion>] The generated completions. This will generally be a list of length one.
|
15
|
+
@completions = completions
|
16
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
@additional_properties = additional_properties
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialize a JSON object to an instance of GenerateResultData
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [GenerateResultData]
|
24
|
+
def self.from_json(json_object:)
|
25
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
+
parsed_json = JSON.parse(json_object)
|
27
|
+
completions = parsed_json["completions"].map do |v|
|
28
|
+
v = v.to_json
|
29
|
+
EnrichedNormalizedCompletion.from_json(json_object: v)
|
30
|
+
end
|
31
|
+
new(completions: completions, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of GenerateResultData to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "completions": @completions }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.completions.is_a?(Array) != false || raise("Passed value for field obj.completions is not the expected type, validation failed.")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class GenerateResultError
|
7
|
+
attr_reader :message, :additional_properties
|
8
|
+
|
9
|
+
# @param message [String] The error message returned by the LLM provider.
|
10
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
# @return [GenerateResultError]
|
12
|
+
def initialize(message:, additional_properties: nil)
|
13
|
+
# @type [String] The error message returned by the LLM provider.
|
14
|
+
@message = message
|
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 GenerateResultError
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [GenerateResultError]
|
23
|
+
def self.from_json(json_object:)
|
24
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
25
|
+
JSON.parse(json_object)
|
26
|
+
message = struct.message
|
27
|
+
new(message: message, additional_properties: struct)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Serialize an instance of GenerateResultError to a JSON object
|
31
|
+
#
|
32
|
+
# @return [JSON]
|
33
|
+
def to_json(*_args)
|
34
|
+
{ "message": @message }.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.message.is_a?(String) != false || raise("Passed value for field obj.message is not the expected type, validation failed.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "generate_stream_result"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class GenerateStreamResponse
|
8
|
+
attr_reader :delta, :additional_properties
|
9
|
+
|
10
|
+
# @param delta [GenerateStreamResult]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [GenerateStreamResponse]
|
13
|
+
def initialize(delta:, additional_properties: nil)
|
14
|
+
# @type [GenerateStreamResult]
|
15
|
+
@delta = delta
|
16
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
@additional_properties = additional_properties
|
18
|
+
end
|
19
|
+
|
20
|
+
# Deserialize a JSON object to an instance of GenerateStreamResponse
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [GenerateStreamResponse]
|
24
|
+
def self.from_json(json_object:)
|
25
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
26
|
+
parsed_json = JSON.parse(json_object)
|
27
|
+
if parsed_json["delta"].nil?
|
28
|
+
delta = nil
|
29
|
+
else
|
30
|
+
delta = parsed_json["delta"].to_json
|
31
|
+
delta = GenerateStreamResult.from_json(json_object: delta)
|
32
|
+
end
|
33
|
+
new(delta: delta, additional_properties: struct)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Serialize an instance of GenerateStreamResponse to a JSON object
|
37
|
+
#
|
38
|
+
# @return [JSON]
|
39
|
+
def to_json(*_args)
|
40
|
+
{ "delta": @delta }.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
|
+
GenerateStreamResult.validate_raw(obj: obj.delta)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "generate_stream_result_data"
|
4
|
+
require_relative "generate_result_error"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class GenerateStreamResult
|
9
|
+
attr_reader :request_index, :data, :error, :additional_properties
|
10
|
+
|
11
|
+
# @param request_index [Integer]
|
12
|
+
# @param data [GenerateStreamResultData]
|
13
|
+
# @param error [GenerateResultError]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [GenerateStreamResult]
|
16
|
+
def initialize(request_index:, data: nil, error: nil, additional_properties: nil)
|
17
|
+
# @type [Integer]
|
18
|
+
@request_index = request_index
|
19
|
+
# @type [GenerateStreamResultData]
|
20
|
+
@data = data
|
21
|
+
# @type [GenerateResultError]
|
22
|
+
@error = error
|
23
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
@additional_properties = additional_properties
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of GenerateStreamResult
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [GenerateStreamResult]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
request_index = struct.request_index
|
35
|
+
if parsed_json["data"].nil?
|
36
|
+
data = nil
|
37
|
+
else
|
38
|
+
data = parsed_json["data"].to_json
|
39
|
+
data = GenerateStreamResultData.from_json(json_object: data)
|
40
|
+
end
|
41
|
+
if parsed_json["error"].nil?
|
42
|
+
error = nil
|
43
|
+
else
|
44
|
+
error = parsed_json["error"].to_json
|
45
|
+
error = GenerateResultError.from_json(json_object: error)
|
46
|
+
end
|
47
|
+
new(request_index: request_index, data: data, error: error, additional_properties: struct)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Serialize an instance of GenerateStreamResult to a JSON object
|
51
|
+
#
|
52
|
+
# @return [JSON]
|
53
|
+
def to_json(*_args)
|
54
|
+
{ "request_index": @request_index, "data": @data, "error": @error }.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
# 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.
|
58
|
+
#
|
59
|
+
# @param obj [Object]
|
60
|
+
# @return [Void]
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.request_index.is_a?(Integer) != false || raise("Passed value for field obj.request_index is not the expected type, validation failed.")
|
63
|
+
obj.data.nil? || GenerateStreamResultData.validate_raw(obj: obj.data)
|
64
|
+
obj.error.nil? || GenerateResultError.validate_raw(obj: obj.error)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "enriched_normalized_completion"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class GenerateStreamResultData
|
8
|
+
attr_reader :completion_index, :completion, :additional_properties
|
9
|
+
|
10
|
+
# @param completion_index [Integer]
|
11
|
+
# @param completion [EnrichedNormalizedCompletion]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [GenerateStreamResultData]
|
14
|
+
def initialize(completion_index:, completion:, additional_properties: nil)
|
15
|
+
# @type [Integer]
|
16
|
+
@completion_index = completion_index
|
17
|
+
# @type [EnrichedNormalizedCompletion]
|
18
|
+
@completion = completion
|
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 GenerateStreamResultData
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [GenerateStreamResultData]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
parsed_json = JSON.parse(json_object)
|
30
|
+
completion_index = struct.completion_index
|
31
|
+
if parsed_json["completion"].nil?
|
32
|
+
completion = nil
|
33
|
+
else
|
34
|
+
completion = parsed_json["completion"].to_json
|
35
|
+
completion = EnrichedNormalizedCompletion.from_json(json_object: completion)
|
36
|
+
end
|
37
|
+
new(completion_index: completion_index, completion: completion, additional_properties: struct)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Serialize an instance of GenerateStreamResultData to a JSON object
|
41
|
+
#
|
42
|
+
# @return [JSON]
|
43
|
+
def to_json(*_args)
|
44
|
+
{ "completion_index": @completion_index, "completion": @completion }.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.completion_index.is_a?(Integer) != false || raise("Passed value for field obj.completion_index is not the expected type, validation failed.")
|
53
|
+
EnrichedNormalizedCompletion.validate_raw(obj: obj.completion)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_image"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# An image value that is used in a chat message.
|
8
|
+
class ImageChatMessageContent
|
9
|
+
attr_reader :value, :additional_properties
|
10
|
+
|
11
|
+
# @param value [VellumImage]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [ImageChatMessageContent]
|
14
|
+
def initialize(value:, additional_properties: nil)
|
15
|
+
# @type [VellumImage]
|
16
|
+
@value = value
|
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 ImageChatMessageContent
|
22
|
+
#
|
23
|
+
# @param json_object [JSON]
|
24
|
+
# @return [ImageChatMessageContent]
|
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["value"].nil?
|
29
|
+
value = nil
|
30
|
+
else
|
31
|
+
value = parsed_json["value"].to_json
|
32
|
+
value = VellumImage.from_json(json_object: value)
|
33
|
+
end
|
34
|
+
new(value: value, additional_properties: struct)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Serialize an instance of ImageChatMessageContent to a JSON object
|
38
|
+
#
|
39
|
+
# @return [JSON]
|
40
|
+
def to_json(*_args)
|
41
|
+
{ "value": @value }.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
|
+
VellumImage.validate_raw(obj: obj.value)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_image_request"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# An image value that is used in a chat message.
|
8
|
+
class ImageChatMessageContentRequest
|
9
|
+
attr_reader :value, :additional_properties
|
10
|
+
|
11
|
+
# @param value [VellumImageRequest]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [ImageChatMessageContentRequest]
|
14
|
+
def initialize(value:, additional_properties: nil)
|
15
|
+
# @type [VellumImageRequest]
|
16
|
+
@value = value
|
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 ImageChatMessageContentRequest
|
22
|
+
#
|
23
|
+
# @param json_object [JSON]
|
24
|
+
# @return [ImageChatMessageContentRequest]
|
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["value"].nil?
|
29
|
+
value = nil
|
30
|
+
else
|
31
|
+
value = parsed_json["value"].to_json
|
32
|
+
value = VellumImageRequest.from_json(json_object: value)
|
33
|
+
end
|
34
|
+
new(value: value, additional_properties: struct)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Serialize an instance of ImageChatMessageContentRequest to a JSON object
|
38
|
+
#
|
39
|
+
# @return [JSON]
|
40
|
+
def to_json(*_args)
|
41
|
+
{ "value": @value }.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
|
+
VellumImageRequest.validate_raw(obj: obj.value)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "initiated_prompt_execution_meta"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# The initial data returned indicating that the response from the model has returned and begun streaming.
|
8
|
+
class InitiatedExecutePromptEvent
|
9
|
+
attr_reader :meta, :execution_id, :additional_properties
|
10
|
+
|
11
|
+
# @param meta [InitiatedPromptExecutionMeta]
|
12
|
+
# @param execution_id [String]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [InitiatedExecutePromptEvent]
|
15
|
+
def initialize(execution_id:, meta: nil, additional_properties: nil)
|
16
|
+
# @type [InitiatedPromptExecutionMeta]
|
17
|
+
@meta = meta
|
18
|
+
# @type [String]
|
19
|
+
@execution_id = execution_id
|
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 InitiatedExecutePromptEvent
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [InitiatedExecutePromptEvent]
|
28
|
+
def self.from_json(json_object:)
|
29
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
+
parsed_json = JSON.parse(json_object)
|
31
|
+
if parsed_json["meta"].nil?
|
32
|
+
meta = nil
|
33
|
+
else
|
34
|
+
meta = parsed_json["meta"].to_json
|
35
|
+
meta = InitiatedPromptExecutionMeta.from_json(json_object: meta)
|
36
|
+
end
|
37
|
+
execution_id = struct.execution_id
|
38
|
+
new(meta: meta, execution_id: execution_id, additional_properties: struct)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Serialize an instance of InitiatedExecutePromptEvent to a JSON object
|
42
|
+
#
|
43
|
+
# @return [JSON]
|
44
|
+
def to_json(*_args)
|
45
|
+
{ "meta": @meta, "execution_id": @execution_id }.to_json
|
46
|
+
end
|
47
|
+
|
48
|
+
# 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.
|
49
|
+
#
|
50
|
+
# @param obj [Object]
|
51
|
+
# @return [Void]
|
52
|
+
def self.validate_raw(obj:)
|
53
|
+
obj.meta.nil? || InitiatedPromptExecutionMeta.validate_raw(obj: obj.meta)
|
54
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# The subset of the metadata tracked by Vellum during prompt execution that the request opted into with `expand_meta`.
|
7
|
+
class InitiatedPromptExecutionMeta
|
8
|
+
attr_reader :model_name, :latency, :deployment_release_tag, :prompt_version_id, :additional_properties
|
9
|
+
|
10
|
+
# @param model_name [String]
|
11
|
+
# @param latency [Integer]
|
12
|
+
# @param deployment_release_tag [String]
|
13
|
+
# @param prompt_version_id [String]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [InitiatedPromptExecutionMeta]
|
16
|
+
def initialize(model_name: nil, latency: nil, deployment_release_tag: nil, prompt_version_id: nil,
|
17
|
+
additional_properties: nil)
|
18
|
+
# @type [String]
|
19
|
+
@model_name = model_name
|
20
|
+
# @type [Integer]
|
21
|
+
@latency = latency
|
22
|
+
# @type [String]
|
23
|
+
@deployment_release_tag = deployment_release_tag
|
24
|
+
# @type [String]
|
25
|
+
@prompt_version_id = prompt_version_id
|
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 InitiatedPromptExecutionMeta
|
31
|
+
#
|
32
|
+
# @param json_object [JSON]
|
33
|
+
# @return [InitiatedPromptExecutionMeta]
|
34
|
+
def self.from_json(json_object:)
|
35
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
36
|
+
JSON.parse(json_object)
|
37
|
+
model_name = struct.model_name
|
38
|
+
latency = struct.latency
|
39
|
+
deployment_release_tag = struct.deployment_release_tag
|
40
|
+
prompt_version_id = struct.prompt_version_id
|
41
|
+
new(model_name: model_name, latency: latency, deployment_release_tag: deployment_release_tag,
|
42
|
+
prompt_version_id: prompt_version_id, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of InitiatedPromptExecutionMeta to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{
|
50
|
+
"model_name": @model_name,
|
51
|
+
"latency": @latency,
|
52
|
+
"deployment_release_tag": @deployment_release_tag,
|
53
|
+
"prompt_version_id": @prompt_version_id
|
54
|
+
}.to_json
|
55
|
+
end
|
56
|
+
|
57
|
+
# 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.
|
58
|
+
#
|
59
|
+
# @param obj [Object]
|
60
|
+
# @return [Void]
|
61
|
+
def self.validate_raw(obj:)
|
62
|
+
obj.model_name&.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.")
|
63
|
+
obj.latency&.is_a?(Integer) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.")
|
64
|
+
obj.deployment_release_tag&.is_a?(String) != false || raise("Passed value for field obj.deployment_release_tag is not the expected type, validation failed.")
|
65
|
+
obj.prompt_version_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "workflow_node_result_data"
|
5
|
+
require_relative "node_input_variable_compiled_value"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
# An event that indicates that the node has initiated its execution.
|
10
|
+
class InitiatedWorkflowNodeResultEvent
|
11
|
+
attr_reader :id, :node_id, :node_result_id, :ts, :data, :input_values, :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 input_values [Array<NodeInputVariableCompiledValue>]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [InitiatedWorkflowNodeResultEvent]
|
21
|
+
def initialize(id:, node_id:, node_result_id:, ts: nil, data: nil, input_values: 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 [Array<NodeInputVariableCompiledValue>]
|
33
|
+
@input_values = input_values
|
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 InitiatedWorkflowNodeResultEvent
|
39
|
+
#
|
40
|
+
# @param json_object [JSON]
|
41
|
+
# @return [InitiatedWorkflowNodeResultEvent]
|
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
|
+
input_values = parsed_json["input_values"].map do |v|
|
56
|
+
v = v.to_json
|
57
|
+
NodeInputVariableCompiledValue.from_json(json_object: v)
|
58
|
+
end
|
59
|
+
new(id: id, node_id: node_id, node_result_id: node_result_id, ts: ts, data: data, input_values: input_values,
|
60
|
+
additional_properties: struct)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Serialize an instance of InitiatedWorkflowNodeResultEvent to a JSON object
|
64
|
+
#
|
65
|
+
# @return [JSON]
|
66
|
+
def to_json(*_args)
|
67
|
+
{
|
68
|
+
"id": @id,
|
69
|
+
"node_id": @node_id,
|
70
|
+
"node_result_id": @node_result_id,
|
71
|
+
"ts": @ts,
|
72
|
+
"data": @data,
|
73
|
+
"input_values": @input_values
|
74
|
+
}.to_json
|
75
|
+
end
|
76
|
+
|
77
|
+
# 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.
|
78
|
+
#
|
79
|
+
# @param obj [Object]
|
80
|
+
# @return [Void]
|
81
|
+
def self.validate_raw(obj:)
|
82
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
83
|
+
obj.node_id.is_a?(String) != false || raise("Passed value for field obj.node_id is not the expected type, validation failed.")
|
84
|
+
obj.node_result_id.is_a?(String) != false || raise("Passed value for field obj.node_result_id is not the expected type, validation failed.")
|
85
|
+
obj.ts&.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
|
86
|
+
obj.data.nil? || WorkflowNodeResultData.validate_raw(obj: obj.data)
|
87
|
+
obj.input_values&.is_a?(Array) != false || raise("Passed value for field obj.input_values is not the expected type, validation failed.")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|