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,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "fulfilled_execute_prompt_response"
|
5
|
+
require_relative "rejected_execute_prompt_response"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class ExecutePromptResponse
|
9
|
+
attr_reader :member, :discriminant
|
10
|
+
|
11
|
+
private_class_method :new
|
12
|
+
alias kind_of? is_a?
|
13
|
+
# @param member [Object]
|
14
|
+
# @param discriminant [String]
|
15
|
+
# @return [ExecutePromptResponse]
|
16
|
+
def initialize(member:, discriminant:)
|
17
|
+
# @type [Object]
|
18
|
+
@member = member
|
19
|
+
# @type [String]
|
20
|
+
@discriminant = discriminant
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of ExecutePromptResponse
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [ExecutePromptResponse]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
member = case struct.state
|
30
|
+
when "FULFILLED"
|
31
|
+
FulfilledExecutePromptResponse.from_json(json_object: json_object)
|
32
|
+
when "REJECTED"
|
33
|
+
RejectedExecutePromptResponse.from_json(json_object: json_object)
|
34
|
+
else
|
35
|
+
FulfilledExecutePromptResponse.from_json(json_object: json_object)
|
36
|
+
end
|
37
|
+
new(member: member, discriminant: struct.state)
|
38
|
+
end
|
39
|
+
|
40
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
41
|
+
#
|
42
|
+
# @return [JSON]
|
43
|
+
def to_json(*_args)
|
44
|
+
case @discriminant
|
45
|
+
when "FULFILLED"
|
46
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
47
|
+
when "REJECTED"
|
48
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
49
|
+
else
|
50
|
+
{ "state": @discriminant, value: @member }.to_json
|
51
|
+
end
|
52
|
+
@member.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# 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.
|
56
|
+
#
|
57
|
+
# @param obj [Object]
|
58
|
+
# @return [Void]
|
59
|
+
def self.validate_raw(obj:)
|
60
|
+
case obj.state
|
61
|
+
when "FULFILLED"
|
62
|
+
FulfilledExecutePromptResponse.validate_raw(obj: obj)
|
63
|
+
when "REJECTED"
|
64
|
+
RejectedExecutePromptResponse.validate_raw(obj: obj)
|
65
|
+
else
|
66
|
+
raise("Passed value matched no type within the union, validation failed.")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Boolean]
|
74
|
+
def is_a?(obj)
|
75
|
+
@member.is_a?(obj)
|
76
|
+
end
|
77
|
+
|
78
|
+
# @param member [FulfilledExecutePromptResponse]
|
79
|
+
# @return [ExecutePromptResponse]
|
80
|
+
def self.fulfilled(member:)
|
81
|
+
new(member: member, discriminant: "FULFILLED")
|
82
|
+
end
|
83
|
+
|
84
|
+
# @param member [RejectedExecutePromptResponse]
|
85
|
+
# @return [ExecutePromptResponse]
|
86
|
+
def self.rejected(member:)
|
87
|
+
new(member: member, discriminant: "REJECTED")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class ExecuteWorkflowErrorResponse
|
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 [ExecuteWorkflowErrorResponse]
|
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 ExecuteWorkflowErrorResponse
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [ExecuteWorkflowErrorResponse]
|
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 ExecuteWorkflowErrorResponse 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,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "execute_workflow_workflow_result_event"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class ExecuteWorkflowResponse
|
8
|
+
attr_reader :execution_id, :run_id, :external_id, :data, :additional_properties
|
9
|
+
|
10
|
+
# @param execution_id [String]
|
11
|
+
# @param run_id [String]
|
12
|
+
# @param external_id [String]
|
13
|
+
# @param data [ExecuteWorkflowWorkflowResultEvent]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [ExecuteWorkflowResponse]
|
16
|
+
def initialize(execution_id:, data:, run_id: nil, external_id: nil, additional_properties: nil)
|
17
|
+
# @type [String]
|
18
|
+
@execution_id = execution_id
|
19
|
+
# @type [String]
|
20
|
+
@run_id = run_id
|
21
|
+
# @type [String]
|
22
|
+
@external_id = external_id
|
23
|
+
# @type [ExecuteWorkflowWorkflowResultEvent]
|
24
|
+
@data = data
|
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 ExecuteWorkflowResponse
|
30
|
+
#
|
31
|
+
# @param json_object [JSON]
|
32
|
+
# @return [ExecuteWorkflowResponse]
|
33
|
+
def self.from_json(json_object:)
|
34
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
35
|
+
parsed_json = JSON.parse(json_object)
|
36
|
+
execution_id = struct.execution_id
|
37
|
+
run_id = struct.run_id
|
38
|
+
external_id = struct.external_id
|
39
|
+
if parsed_json["data"].nil?
|
40
|
+
data = nil
|
41
|
+
else
|
42
|
+
data = parsed_json["data"].to_json
|
43
|
+
data = ExecuteWorkflowWorkflowResultEvent.from_json(json_object: data)
|
44
|
+
end
|
45
|
+
new(execution_id: execution_id, run_id: run_id, external_id: external_id, data: data,
|
46
|
+
additional_properties: struct)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serialize an instance of ExecuteWorkflowResponse to a JSON object
|
50
|
+
#
|
51
|
+
# @return [JSON]
|
52
|
+
def to_json(*_args)
|
53
|
+
{ "execution_id": @execution_id, "run_id": @run_id, "external_id": @external_id, "data": @data }.to_json
|
54
|
+
end
|
55
|
+
|
56
|
+
# 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.
|
57
|
+
#
|
58
|
+
# @param obj [Object]
|
59
|
+
# @return [Void]
|
60
|
+
def self.validate_raw(obj:)
|
61
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
62
|
+
obj.run_id&.is_a?(String) != false || raise("Passed value for field obj.run_id is not the expected type, validation failed.")
|
63
|
+
obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
|
64
|
+
ExecuteWorkflowWorkflowResultEvent.validate_raw(obj: obj.data)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class ExecuteWorkflowStreamErrorResponse
|
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 [ExecuteWorkflowStreamErrorResponse]
|
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 ExecuteWorkflowStreamErrorResponse
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [ExecuteWorkflowStreamErrorResponse]
|
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 ExecuteWorkflowStreamErrorResponse 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,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "fulfilled_execute_workflow_workflow_result_event"
|
5
|
+
require_relative "rejected_execute_workflow_workflow_result_event"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class ExecuteWorkflowWorkflowResultEvent
|
9
|
+
attr_reader :member, :discriminant
|
10
|
+
|
11
|
+
private_class_method :new
|
12
|
+
alias kind_of? is_a?
|
13
|
+
# @param member [Object]
|
14
|
+
# @param discriminant [String]
|
15
|
+
# @return [ExecuteWorkflowWorkflowResultEvent]
|
16
|
+
def initialize(member:, discriminant:)
|
17
|
+
# @type [Object]
|
18
|
+
@member = member
|
19
|
+
# @type [String]
|
20
|
+
@discriminant = discriminant
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of ExecuteWorkflowWorkflowResultEvent
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [ExecuteWorkflowWorkflowResultEvent]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
member = case struct.state
|
30
|
+
when "FULFILLED"
|
31
|
+
FulfilledExecuteWorkflowWorkflowResultEvent.from_json(json_object: json_object)
|
32
|
+
when "REJECTED"
|
33
|
+
RejectedExecuteWorkflowWorkflowResultEvent.from_json(json_object: json_object)
|
34
|
+
else
|
35
|
+
FulfilledExecuteWorkflowWorkflowResultEvent.from_json(json_object: json_object)
|
36
|
+
end
|
37
|
+
new(member: member, discriminant: struct.state)
|
38
|
+
end
|
39
|
+
|
40
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
41
|
+
#
|
42
|
+
# @return [JSON]
|
43
|
+
def to_json(*_args)
|
44
|
+
case @discriminant
|
45
|
+
when "FULFILLED"
|
46
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
47
|
+
when "REJECTED"
|
48
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
49
|
+
else
|
50
|
+
{ "state": @discriminant, value: @member }.to_json
|
51
|
+
end
|
52
|
+
@member.to_json
|
53
|
+
end
|
54
|
+
|
55
|
+
# 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.
|
56
|
+
#
|
57
|
+
# @param obj [Object]
|
58
|
+
# @return [Void]
|
59
|
+
def self.validate_raw(obj:)
|
60
|
+
case obj.state
|
61
|
+
when "FULFILLED"
|
62
|
+
FulfilledExecuteWorkflowWorkflowResultEvent.validate_raw(obj: obj)
|
63
|
+
when "REJECTED"
|
64
|
+
RejectedExecuteWorkflowWorkflowResultEvent.validate_raw(obj: obj)
|
65
|
+
else
|
66
|
+
raise("Passed value matched no type within the union, validation failed.")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
71
|
+
#
|
72
|
+
# @param obj [Object]
|
73
|
+
# @return [Boolean]
|
74
|
+
def is_a?(obj)
|
75
|
+
@member.is_a?(obj)
|
76
|
+
end
|
77
|
+
|
78
|
+
# @param member [FulfilledExecuteWorkflowWorkflowResultEvent]
|
79
|
+
# @return [ExecuteWorkflowWorkflowResultEvent]
|
80
|
+
def self.fulfilled(member:)
|
81
|
+
new(member: member, discriminant: "FULFILLED")
|
82
|
+
end
|
83
|
+
|
84
|
+
# @param member [RejectedExecuteWorkflowWorkflowResultEvent]
|
85
|
+
# @return [ExecuteWorkflowWorkflowResultEvent]
|
86
|
+
def self.rejected(member:)
|
87
|
+
new(member: member, discriminant: "REJECTED")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_output"
|
4
|
+
require_relative "fulfilled_prompt_execution_meta"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The final data event returned indicating that the stream has ended and all final resolved values from the model can be found.
|
9
|
+
class FulfilledExecutePromptEvent
|
10
|
+
attr_reader :outputs, :execution_id, :meta, :additional_properties
|
11
|
+
|
12
|
+
# @param outputs [Array<PromptOutput>]
|
13
|
+
# @param execution_id [String]
|
14
|
+
# @param meta [FulfilledPromptExecutionMeta]
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [FulfilledExecutePromptEvent]
|
17
|
+
def initialize(outputs:, execution_id:, meta: nil, additional_properties: nil)
|
18
|
+
# @type [Array<PromptOutput>]
|
19
|
+
@outputs = outputs
|
20
|
+
# @type [String]
|
21
|
+
@execution_id = execution_id
|
22
|
+
# @type [FulfilledPromptExecutionMeta]
|
23
|
+
@meta = meta
|
24
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
@additional_properties = additional_properties
|
26
|
+
end
|
27
|
+
|
28
|
+
# Deserialize a JSON object to an instance of FulfilledExecutePromptEvent
|
29
|
+
#
|
30
|
+
# @param json_object [JSON]
|
31
|
+
# @return [FulfilledExecutePromptEvent]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
parsed_json = JSON.parse(json_object)
|
35
|
+
outputs = parsed_json["outputs"].map do |v|
|
36
|
+
v = v.to_json
|
37
|
+
PromptOutput.from_json(json_object: v)
|
38
|
+
end
|
39
|
+
execution_id = struct.execution_id
|
40
|
+
if parsed_json["meta"].nil?
|
41
|
+
meta = nil
|
42
|
+
else
|
43
|
+
meta = parsed_json["meta"].to_json
|
44
|
+
meta = FulfilledPromptExecutionMeta.from_json(json_object: meta)
|
45
|
+
end
|
46
|
+
new(outputs: outputs, execution_id: execution_id, meta: meta, additional_properties: struct)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serialize an instance of FulfilledExecutePromptEvent to a JSON object
|
50
|
+
#
|
51
|
+
# @return [JSON]
|
52
|
+
def to_json(*_args)
|
53
|
+
{ "outputs": @outputs, "execution_id": @execution_id, "meta": @meta }.to_json
|
54
|
+
end
|
55
|
+
|
56
|
+
# 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.
|
57
|
+
#
|
58
|
+
# @param obj [Object]
|
59
|
+
# @return [Void]
|
60
|
+
def self.validate_raw(obj:)
|
61
|
+
obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.")
|
62
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
63
|
+
obj.meta.nil? || FulfilledPromptExecutionMeta.validate_raw(obj: obj.meta)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_execution_meta"
|
4
|
+
require_relative "prompt_output"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The successful response from the model containing all of the resolved values generated by the prompt.
|
9
|
+
class FulfilledExecutePromptResponse
|
10
|
+
attr_reader :meta, :raw, :execution_id, :outputs, :additional_properties
|
11
|
+
|
12
|
+
# @param meta [PromptExecutionMeta]
|
13
|
+
# @param raw [Hash{String => String}] The subset of the raw response from the model that the request opted into with `expand_raw`.
|
14
|
+
# @param execution_id [String] The ID of the execution.
|
15
|
+
# @param outputs [Array<PromptOutput>]
|
16
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
# @return [FulfilledExecutePromptResponse]
|
18
|
+
def initialize(execution_id:, outputs:, meta: nil, raw: nil, additional_properties: nil)
|
19
|
+
# @type [PromptExecutionMeta]
|
20
|
+
@meta = meta
|
21
|
+
# @type [Hash{String => String}] The subset of the raw response from the model that the request opted into with `expand_raw`.
|
22
|
+
@raw = raw
|
23
|
+
# @type [String] The ID of the execution.
|
24
|
+
@execution_id = execution_id
|
25
|
+
# @type [Array<PromptOutput>]
|
26
|
+
@outputs = outputs
|
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 FulfilledExecutePromptResponse
|
32
|
+
#
|
33
|
+
# @param json_object [JSON]
|
34
|
+
# @return [FulfilledExecutePromptResponse]
|
35
|
+
def self.from_json(json_object:)
|
36
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
37
|
+
parsed_json = JSON.parse(json_object)
|
38
|
+
if parsed_json["meta"].nil?
|
39
|
+
meta = nil
|
40
|
+
else
|
41
|
+
meta = parsed_json["meta"].to_json
|
42
|
+
meta = PromptExecutionMeta.from_json(json_object: meta)
|
43
|
+
end
|
44
|
+
raw = struct.raw
|
45
|
+
execution_id = struct.execution_id
|
46
|
+
outputs = parsed_json["outputs"].map do |v|
|
47
|
+
v = v.to_json
|
48
|
+
PromptOutput.from_json(json_object: v)
|
49
|
+
end
|
50
|
+
new(meta: meta, raw: raw, execution_id: execution_id, outputs: outputs, additional_properties: struct)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Serialize an instance of FulfilledExecutePromptResponse to a JSON object
|
54
|
+
#
|
55
|
+
# @return [JSON]
|
56
|
+
def to_json(*_args)
|
57
|
+
{ "meta": @meta, "raw": @raw, "execution_id": @execution_id, "outputs": @outputs }.to_json
|
58
|
+
end
|
59
|
+
|
60
|
+
# 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.
|
61
|
+
#
|
62
|
+
# @param obj [Object]
|
63
|
+
# @return [Void]
|
64
|
+
def self.validate_raw(obj:)
|
65
|
+
obj.meta.nil? || PromptExecutionMeta.validate_raw(obj: obj.meta)
|
66
|
+
obj.raw&.is_a?(Hash) != false || raise("Passed value for field obj.raw is not the expected type, validation failed.")
|
67
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
68
|
+
obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "workflow_output"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The successful response from the Workflow execution containing the produced outputs.
|
9
|
+
class FulfilledExecuteWorkflowWorkflowResultEvent
|
10
|
+
attr_reader :id, :ts, :outputs, :additional_properties
|
11
|
+
|
12
|
+
# @param id [String]
|
13
|
+
# @param ts [DateTime]
|
14
|
+
# @param outputs [Array<WorkflowOutput>]
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [FulfilledExecuteWorkflowWorkflowResultEvent]
|
17
|
+
def initialize(id:, ts:, outputs:, additional_properties: nil)
|
18
|
+
# @type [String]
|
19
|
+
@id = id
|
20
|
+
# @type [DateTime]
|
21
|
+
@ts = ts
|
22
|
+
# @type [Array<WorkflowOutput>]
|
23
|
+
@outputs = outputs
|
24
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
@additional_properties = additional_properties
|
26
|
+
end
|
27
|
+
|
28
|
+
# Deserialize a JSON object to an instance of FulfilledExecuteWorkflowWorkflowResultEvent
|
29
|
+
#
|
30
|
+
# @param json_object [JSON]
|
31
|
+
# @return [FulfilledExecuteWorkflowWorkflowResultEvent]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
parsed_json = JSON.parse(json_object)
|
35
|
+
id = struct.id
|
36
|
+
ts = DateTime.parse(parsed_json["ts"])
|
37
|
+
outputs = parsed_json["outputs"].map do |v|
|
38
|
+
v = v.to_json
|
39
|
+
WorkflowOutput.from_json(json_object: v)
|
40
|
+
end
|
41
|
+
new(id: id, ts: ts, outputs: outputs, additional_properties: struct)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Serialize an instance of FulfilledExecuteWorkflowWorkflowResultEvent to a JSON object
|
45
|
+
#
|
46
|
+
# @return [JSON]
|
47
|
+
def to_json(*_args)
|
48
|
+
{ "id": @id, "ts": @ts, "outputs": @outputs }.to_json
|
49
|
+
end
|
50
|
+
|
51
|
+
# 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.
|
52
|
+
#
|
53
|
+
# @param obj [Object]
|
54
|
+
# @return [Void]
|
55
|
+
def self.validate_raw(obj:)
|
56
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
57
|
+
obj.ts.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
|
58
|
+
obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# The final resolved function call value.
|
7
|
+
class FulfilledFunctionCall
|
8
|
+
attr_reader :arguments, :id, :name, :additional_properties
|
9
|
+
|
10
|
+
# @param arguments [Hash{String => String}]
|
11
|
+
# @param id [String]
|
12
|
+
# @param name [String]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [FulfilledFunctionCall]
|
15
|
+
def initialize(arguments:, name:, id: nil, additional_properties: nil)
|
16
|
+
# @type [Hash{String => String}]
|
17
|
+
@arguments = arguments
|
18
|
+
# @type [String]
|
19
|
+
@id = id
|
20
|
+
# @type [String]
|
21
|
+
@name = name
|
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 FulfilledFunctionCall
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [FulfilledFunctionCall]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
JSON.parse(json_object)
|
33
|
+
arguments = struct.arguments
|
34
|
+
id = struct.id
|
35
|
+
name = struct.name
|
36
|
+
new(arguments: arguments, id: id, name: name, additional_properties: struct)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Serialize an instance of FulfilledFunctionCall to a JSON object
|
40
|
+
#
|
41
|
+
# @return [JSON]
|
42
|
+
def to_json(*_args)
|
43
|
+
{ "arguments": @arguments, "id": @id, "name": @name }.to_json
|
44
|
+
end
|
45
|
+
|
46
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
47
|
+
#
|
48
|
+
# @param obj [Object]
|
49
|
+
# @return [Void]
|
50
|
+
def self.validate_raw(obj:)
|
51
|
+
obj.arguments.is_a?(Hash) != false || raise("Passed value for field obj.arguments is not the expected type, validation failed.")
|
52
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
53
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -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 FulfilledPromptExecutionMeta
|
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 [FulfilledPromptExecutionMeta]
|
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 FulfilledPromptExecutionMeta
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [FulfilledPromptExecutionMeta]
|
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 FulfilledPromptExecutionMeta 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
|