vellum_ai 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/core/file_utilities.rb +26 -0
- data/lib/environment.rb +11 -0
- data/lib/gemconfig.rb +14 -0
- data/lib/requests.rb +88 -0
- data/lib/types_export.rb +255 -0
- data/lib/vellum_ai/deployments/client.rb +157 -0
- data/lib/vellum_ai/deployments/types/deployments_list_request_status.rb +8 -0
- data/lib/vellum_ai/document_indexes/client.rb +135 -0
- data/lib/vellum_ai/documents/client.rb +245 -0
- data/lib/vellum_ai/model_versions/client.rb +61 -0
- data/lib/vellum_ai/registered_prompts/client.rb +154 -0
- data/lib/vellum_ai/sandboxes/client.rb +132 -0
- data/lib/vellum_ai/test_suites/client.rb +130 -0
- data/lib/vellum_ai/types/api_node_result.rb +52 -0
- data/lib/vellum_ai/types/api_node_result_data.rb +80 -0
- data/lib/vellum_ai/types/array_chat_message_content.rb +50 -0
- data/lib/vellum_ai/types/array_chat_message_content_item.rb +103 -0
- data/lib/vellum_ai/types/array_chat_message_content_item_request.rb +103 -0
- data/lib/vellum_ai/types/array_chat_message_content_request.rb +50 -0
- data/lib/vellum_ai/types/block_type_enum.rb +11 -0
- data/lib/vellum_ai/types/chat_history_enum.rb +5 -0
- data/lib/vellum_ai/types/chat_history_input_request.rb +55 -0
- data/lib/vellum_ai/types/chat_message.rb +62 -0
- data/lib/vellum_ai/types/chat_message_content.rb +116 -0
- data/lib/vellum_ai/types/chat_message_content_request.rb +116 -0
- data/lib/vellum_ai/types/chat_message_request.rb +62 -0
- data/lib/vellum_ai/types/chat_message_role.rb +6 -0
- data/lib/vellum_ai/types/code_execution_node_chat_history_result.rb +54 -0
- data/lib/vellum_ai/types/code_execution_node_error_result.rb +56 -0
- data/lib/vellum_ai/types/code_execution_node_json_result.rb +50 -0
- data/lib/vellum_ai/types/code_execution_node_number_result.rb +50 -0
- data/lib/vellum_ai/types/code_execution_node_result.rb +52 -0
- data/lib/vellum_ai/types/code_execution_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/code_execution_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/code_execution_node_search_results_result.rb +54 -0
- data/lib/vellum_ai/types/code_execution_node_string_result.rb +50 -0
- data/lib/vellum_ai/types/conditional_node_result.rb +52 -0
- data/lib/vellum_ai/types/conditional_node_result_data.rb +45 -0
- data/lib/vellum_ai/types/deployment_provider_payload_response.rb +45 -0
- data/lib/vellum_ai/types/deployment_read.rb +115 -0
- data/lib/vellum_ai/types/document_document_to_document_index.rb +70 -0
- data/lib/vellum_ai/types/document_index_read.rb +98 -0
- data/lib/vellum_ai/types/document_read.rb +121 -0
- data/lib/vellum_ai/types/document_status.rb +5 -0
- data/lib/vellum_ai/types/enriched_normalized_completion.rb +118 -0
- data/lib/vellum_ai/types/entity_status.rb +6 -0
- data/lib/vellum_ai/types/environment_enum.rb +6 -0
- data/lib/vellum_ai/types/error_enum.rb +5 -0
- data/lib/vellum_ai/types/error_variable_value.rb +51 -0
- data/lib/vellum_ai/types/execute_prompt_api_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_prompt_event.rb +116 -0
- data/lib/vellum_ai/types/execute_prompt_response.rb +90 -0
- data/lib/vellum_ai/types/execute_workflow_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_workflow_response.rb +67 -0
- data/lib/vellum_ai/types/execute_workflow_stream_error_response.rb +45 -0
- data/lib/vellum_ai/types/execute_workflow_workflow_result_event.rb +90 -0
- data/lib/vellum_ai/types/finish_reason_enum.rb +6 -0
- data/lib/vellum_ai/types/fulfilled_enum.rb +5 -0
- data/lib/vellum_ai/types/fulfilled_execute_prompt_event.rb +66 -0
- data/lib/vellum_ai/types/fulfilled_execute_prompt_response.rb +71 -0
- data/lib/vellum_ai/types/fulfilled_execute_workflow_workflow_result_event.rb +61 -0
- data/lib/vellum_ai/types/fulfilled_function_call.rb +56 -0
- data/lib/vellum_ai/types/fulfilled_prompt_execution_meta.rb +52 -0
- data/lib/vellum_ai/types/fulfilled_workflow_node_result_event.rb +90 -0
- data/lib/vellum_ai/types/function_call.rb +90 -0
- data/lib/vellum_ai/types/function_call_chat_message_content.rb +52 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_request.rb +52 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_value.rb +56 -0
- data/lib/vellum_ai/types/function_call_chat_message_content_value_request.rb +56 -0
- data/lib/vellum_ai/types/function_call_enum.rb +5 -0
- data/lib/vellum_ai/types/function_call_variable_value.rb +51 -0
- data/lib/vellum_ai/types/generate_error_response.rb +45 -0
- data/lib/vellum_ai/types/generate_options_request.rb +50 -0
- data/lib/vellum_ai/types/generate_request.rb +60 -0
- data/lib/vellum_ai/types/generate_response.rb +49 -0
- data/lib/vellum_ai/types/generate_result.rb +62 -0
- data/lib/vellum_ai/types/generate_result_data.rb +49 -0
- data/lib/vellum_ai/types/generate_result_error.rb +45 -0
- data/lib/vellum_ai/types/generate_stream_response.rb +51 -0
- data/lib/vellum_ai/types/generate_stream_result.rb +67 -0
- data/lib/vellum_ai/types/generate_stream_result_data.rb +56 -0
- data/lib/vellum_ai/types/image_chat_message_content.rb +52 -0
- data/lib/vellum_ai/types/image_chat_message_content_request.rb +52 -0
- data/lib/vellum_ai/types/image_enum.rb +5 -0
- data/lib/vellum_ai/types/indexing_state_enum.rb +12 -0
- data/lib/vellum_ai/types/initiated_enum.rb +5 -0
- data/lib/vellum_ai/types/initiated_execute_prompt_event.rb +57 -0
- data/lib/vellum_ai/types/initiated_prompt_execution_meta.rb +68 -0
- data/lib/vellum_ai/types/initiated_workflow_node_result_event.rb +90 -0
- data/lib/vellum_ai/types/json_enum.rb +5 -0
- data/lib/vellum_ai/types/json_input_request.rb +51 -0
- data/lib/vellum_ai/types/json_variable_value.rb +45 -0
- data/lib/vellum_ai/types/logical_operator.rb +25 -0
- data/lib/vellum_ai/types/logprobs_enum.rb +6 -0
- data/lib/vellum_ai/types/metadata_filter_config_request.rb +85 -0
- data/lib/vellum_ai/types/metadata_filter_rule_combinator.rb +6 -0
- data/lib/vellum_ai/types/metadata_filter_rule_request.rb +84 -0
- data/lib/vellum_ai/types/model_version_build_config.rb +66 -0
- data/lib/vellum_ai/types/model_version_exec_config.rb +90 -0
- data/lib/vellum_ai/types/model_version_exec_config_parameters.rb +98 -0
- data/lib/vellum_ai/types/model_version_read.rb +133 -0
- data/lib/vellum_ai/types/model_version_read_status_enum.rb +11 -0
- data/lib/vellum_ai/types/model_version_sandbox_snapshot.rb +61 -0
- data/lib/vellum_ai/types/named_test_case_chat_history_variable_value_request.rb +54 -0
- data/lib/vellum_ai/types/named_test_case_error_variable_value_request.rb +56 -0
- data/lib/vellum_ai/types/named_test_case_json_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_number_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_search_results_variable_value_request.rb +54 -0
- data/lib/vellum_ai/types/named_test_case_string_variable_value_request.rb +50 -0
- data/lib/vellum_ai/types/named_test_case_variable_value_request.rb +142 -0
- data/lib/vellum_ai/types/node_input_compiled_chat_history_value.rb +59 -0
- data/lib/vellum_ai/types/node_input_compiled_error_value.rb +61 -0
- data/lib/vellum_ai/types/node_input_compiled_json_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_compiled_number_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_compiled_search_results_value.rb +59 -0
- data/lib/vellum_ai/types/node_input_compiled_string_value.rb +55 -0
- data/lib/vellum_ai/types/node_input_variable_compiled_value.rb +142 -0
- data/lib/vellum_ai/types/node_output_compiled_chat_history_value.rb +54 -0
- data/lib/vellum_ai/types/node_output_compiled_error_value.rb +56 -0
- data/lib/vellum_ai/types/node_output_compiled_json_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_number_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_search_results_value.rb +54 -0
- data/lib/vellum_ai/types/node_output_compiled_string_value.rb +50 -0
- data/lib/vellum_ai/types/node_output_compiled_value.rb +142 -0
- data/lib/vellum_ai/types/normalized_log_probs.rb +54 -0
- data/lib/vellum_ai/types/normalized_token_log_probs.rb +61 -0
- data/lib/vellum_ai/types/number_enum.rb +5 -0
- data/lib/vellum_ai/types/paginated_slim_deployment_read_list.rb +64 -0
- data/lib/vellum_ai/types/paginated_slim_document_list.rb +64 -0
- data/lib/vellum_ai/types/paginated_slim_workflow_deployment_list.rb +64 -0
- data/lib/vellum_ai/types/processing_failure_reason_enum.rb +9 -0
- data/lib/vellum_ai/types/processing_state_enum.rb +11 -0
- data/lib/vellum_ai/types/prompt_deployment_expand_meta_request_request.rb +74 -0
- data/lib/vellum_ai/types/prompt_deployment_input_request.rb +103 -0
- data/lib/vellum_ai/types/prompt_execution_meta.rb +76 -0
- data/lib/vellum_ai/types/prompt_node_result.rb +52 -0
- data/lib/vellum_ai/types/prompt_node_result_data.rb +55 -0
- data/lib/vellum_ai/types/prompt_output.rb +116 -0
- data/lib/vellum_ai/types/prompt_template_block.rb +62 -0
- data/lib/vellum_ai/types/prompt_template_block_data.rb +54 -0
- data/lib/vellum_ai/types/prompt_template_block_data_request.rb +54 -0
- data/lib/vellum_ai/types/prompt_template_block_properties.rb +104 -0
- data/lib/vellum_ai/types/prompt_template_block_properties_request.rb +104 -0
- data/lib/vellum_ai/types/prompt_template_block_request.rb +62 -0
- data/lib/vellum_ai/types/provider_enum.rb +20 -0
- data/lib/vellum_ai/types/raw_prompt_execution_overrides_request.rb +55 -0
- data/lib/vellum_ai/types/register_prompt_error_response.rb +45 -0
- data/lib/vellum_ai/types/register_prompt_model_parameters_request.rb +98 -0
- data/lib/vellum_ai/types/register_prompt_prompt.rb +50 -0
- data/lib/vellum_ai/types/register_prompt_prompt_info_request.rb +60 -0
- data/lib/vellum_ai/types/register_prompt_response.rb +110 -0
- data/lib/vellum_ai/types/registered_prompt_deployment.rb +55 -0
- data/lib/vellum_ai/types/registered_prompt_input_variable_request.rb +56 -0
- data/lib/vellum_ai/types/registered_prompt_model_version.rb +50 -0
- data/lib/vellum_ai/types/registered_prompt_sandbox.rb +50 -0
- data/lib/vellum_ai/types/registered_prompt_sandbox_snapshot.rb +45 -0
- data/lib/vellum_ai/types/rejected_enum.rb +5 -0
- data/lib/vellum_ai/types/rejected_execute_prompt_event.rb +68 -0
- data/lib/vellum_ai/types/rejected_execute_prompt_response.rb +73 -0
- data/lib/vellum_ai/types/rejected_execute_workflow_workflow_result_event.rb +63 -0
- data/lib/vellum_ai/types/rejected_function_call.rb +62 -0
- data/lib/vellum_ai/types/rejected_prompt_execution_meta.rb +52 -0
- data/lib/vellum_ai/types/rejected_workflow_node_result_event.rb +92 -0
- data/lib/vellum_ai/types/sandbox_scenario.rb +59 -0
- data/lib/vellum_ai/types/scenario_input.rb +70 -0
- data/lib/vellum_ai/types/scenario_input_request.rb +70 -0
- data/lib/vellum_ai/types/scenario_input_type_enum.rb +6 -0
- data/lib/vellum_ai/types/search_error_response.rb +45 -0
- data/lib/vellum_ai/types/search_filters_request.rb +56 -0
- data/lib/vellum_ai/types/search_node_result.rb +52 -0
- data/lib/vellum_ai/types/search_node_result_data.rb +70 -0
- data/lib/vellum_ai/types/search_request_options_request.rb +79 -0
- data/lib/vellum_ai/types/search_response.rb +49 -0
- data/lib/vellum_ai/types/search_result.rb +66 -0
- data/lib/vellum_ai/types/search_result_document.rb +60 -0
- data/lib/vellum_ai/types/search_result_document_request.rb +55 -0
- data/lib/vellum_ai/types/search_result_merging_request.rb +45 -0
- data/lib/vellum_ai/types/search_result_request.rb +66 -0
- data/lib/vellum_ai/types/search_results_enum.rb +5 -0
- data/lib/vellum_ai/types/search_weights_request.rb +50 -0
- data/lib/vellum_ai/types/slim_deployment_read.rb +109 -0
- data/lib/vellum_ai/types/slim_document.rb +126 -0
- data/lib/vellum_ai/types/slim_workflow_deployment.rb +118 -0
- data/lib/vellum_ai/types/streaming_enum.rb +5 -0
- data/lib/vellum_ai/types/streaming_execute_prompt_event.rb +85 -0
- data/lib/vellum_ai/types/streaming_prompt_execution_meta.rb +46 -0
- data/lib/vellum_ai/types/streaming_workflow_node_result_event.rb +99 -0
- data/lib/vellum_ai/types/string_chat_message_content.rb +46 -0
- data/lib/vellum_ai/types/string_chat_message_content_request.rb +46 -0
- data/lib/vellum_ai/types/string_enum.rb +5 -0
- data/lib/vellum_ai/types/string_input_request.rb +51 -0
- data/lib/vellum_ai/types/string_variable_value.rb +45 -0
- data/lib/vellum_ai/types/submit_completion_actual_request.rb +67 -0
- data/lib/vellum_ai/types/submit_completion_actuals_error_response.rb +45 -0
- data/lib/vellum_ai/types/submit_workflow_execution_actual_request.rb +103 -0
- data/lib/vellum_ai/types/templating_node_chat_history_result.rb +54 -0
- data/lib/vellum_ai/types/templating_node_error_result.rb +56 -0
- data/lib/vellum_ai/types/templating_node_json_result.rb +50 -0
- data/lib/vellum_ai/types/templating_node_number_result.rb +50 -0
- data/lib/vellum_ai/types/templating_node_result.rb +52 -0
- data/lib/vellum_ai/types/templating_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/templating_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/templating_node_search_results_result.rb +54 -0
- data/lib/vellum_ai/types/templating_node_string_result.rb +50 -0
- data/lib/vellum_ai/types/terminal_node_chat_history_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_error_result.rb +61 -0
- data/lib/vellum_ai/types/terminal_node_json_result.rb +55 -0
- data/lib/vellum_ai/types/terminal_node_number_result.rb +55 -0
- data/lib/vellum_ai/types/terminal_node_result.rb +52 -0
- data/lib/vellum_ai/types/terminal_node_result_data.rb +51 -0
- data/lib/vellum_ai/types/terminal_node_result_output.rb +142 -0
- data/lib/vellum_ai/types/terminal_node_search_results_result.rb +59 -0
- data/lib/vellum_ai/types/terminal_node_string_result.rb +55 -0
- data/lib/vellum_ai/types/test_case_chat_history_variable_value.rb +54 -0
- data/lib/vellum_ai/types/test_case_error_variable_value.rb +56 -0
- data/lib/vellum_ai/types/test_case_json_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_number_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_search_results_variable_value.rb +54 -0
- data/lib/vellum_ai/types/test_case_string_variable_value.rb +50 -0
- data/lib/vellum_ai/types/test_case_variable_value.rb +142 -0
- data/lib/vellum_ai/types/test_suite_test_case.rb +68 -0
- data/lib/vellum_ai/types/upload_document_error_response.rb +45 -0
- data/lib/vellum_ai/types/upload_document_response.rb +45 -0
- data/lib/vellum_ai/types/vellum_error.rb +51 -0
- data/lib/vellum_ai/types/vellum_error_code_enum.rb +10 -0
- data/lib/vellum_ai/types/vellum_error_request.rb +51 -0
- data/lib/vellum_ai/types/vellum_image.rb +50 -0
- data/lib/vellum_ai/types/vellum_image_request.rb +50 -0
- data/lib/vellum_ai/types/vellum_variable.rb +56 -0
- data/lib/vellum_ai/types/vellum_variable_type.rb +16 -0
- data/lib/vellum_ai/types/workflow_event_error.rb +51 -0
- data/lib/vellum_ai/types/workflow_execution_actual_chat_history_request.rb +77 -0
- data/lib/vellum_ai/types/workflow_execution_actual_json_request.rb +73 -0
- data/lib/vellum_ai/types/workflow_execution_actual_string_request.rb +73 -0
- data/lib/vellum_ai/types/workflow_execution_event_error_code.rb +13 -0
- data/lib/vellum_ai/types/workflow_execution_event_type.rb +6 -0
- data/lib/vellum_ai/types/workflow_execution_node_result_event.rb +68 -0
- data/lib/vellum_ai/types/workflow_execution_workflow_result_event.rb +68 -0
- data/lib/vellum_ai/types/workflow_node_result_data.rb +155 -0
- data/lib/vellum_ai/types/workflow_node_result_event.rb +116 -0
- data/lib/vellum_ai/types/workflow_node_result_event_state.rb +11 -0
- data/lib/vellum_ai/types/workflow_output.rb +168 -0
- data/lib/vellum_ai/types/workflow_output_chat_history.rb +60 -0
- data/lib/vellum_ai/types/workflow_output_error.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_function_call.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_image.rb +62 -0
- data/lib/vellum_ai/types/workflow_output_json.rb +56 -0
- data/lib/vellum_ai/types/workflow_output_number.rb +56 -0
- data/lib/vellum_ai/types/workflow_output_search_results.rb +60 -0
- data/lib/vellum_ai/types/workflow_output_string.rb +56 -0
- data/lib/vellum_ai/types/workflow_request_chat_history_input_request.rb +54 -0
- data/lib/vellum_ai/types/workflow_request_input_request.rb +116 -0
- data/lib/vellum_ai/types/workflow_request_json_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_request_number_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_request_string_input_request.rb +50 -0
- data/lib/vellum_ai/types/workflow_result_event.rb +95 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data.rb +142 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_chat_history.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_error.rb +85 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_json.rb +79 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_number.rb +79 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_search_results.rb +83 -0
- data/lib/vellum_ai/types/workflow_result_event_output_data_string.rb +79 -0
- data/lib/vellum_ai/types/workflow_stream_event.rb +90 -0
- data/lib/vellum_ai/workflow_deployments/client.rb +82 -0
- data/lib/vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status.rb +8 -0
- data/lib/vellum_ai.rb +476 -0
- metadata +381 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "register_prompt_prompt"
|
4
|
+
require_relative "registered_prompt_sandbox_snapshot"
|
5
|
+
require_relative "registered_prompt_sandbox"
|
6
|
+
require_relative "registered_prompt_model_version"
|
7
|
+
require_relative "registered_prompt_deployment"
|
8
|
+
require "json"
|
9
|
+
|
10
|
+
module Vellum
|
11
|
+
class RegisterPromptResponse
|
12
|
+
attr_reader :prompt, :sandbox_snapshot, :sandbox, :model_version, :prompt_version_id, :deployment,
|
13
|
+
:additional_properties
|
14
|
+
|
15
|
+
# @param prompt [RegisterPromptPrompt] Information about the generated prompt
|
16
|
+
# @param sandbox_snapshot [RegisteredPromptSandboxSnapshot] Information about the generated sandbox snapshot
|
17
|
+
# @param sandbox [RegisteredPromptSandbox] Information about the generated sandbox
|
18
|
+
# @param model_version [RegisteredPromptModelVersion] Information about the generated model version
|
19
|
+
# @param prompt_version_id [String] The ID of the generated prompt version
|
20
|
+
# @param deployment [RegisteredPromptDeployment] Information about the generated deployment
|
21
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
# @return [RegisterPromptResponse]
|
23
|
+
def initialize(prompt:, sandbox_snapshot:, sandbox:, model_version:, prompt_version_id:, deployment:,
|
24
|
+
additional_properties: nil)
|
25
|
+
# @type [RegisterPromptPrompt] Information about the generated prompt
|
26
|
+
@prompt = prompt
|
27
|
+
# @type [RegisteredPromptSandboxSnapshot] Information about the generated sandbox snapshot
|
28
|
+
@sandbox_snapshot = sandbox_snapshot
|
29
|
+
# @type [RegisteredPromptSandbox] Information about the generated sandbox
|
30
|
+
@sandbox = sandbox
|
31
|
+
# @type [RegisteredPromptModelVersion] Information about the generated model version
|
32
|
+
@model_version = model_version
|
33
|
+
# @type [String] The ID of the generated prompt version
|
34
|
+
@prompt_version_id = prompt_version_id
|
35
|
+
# @type [RegisteredPromptDeployment] Information about the generated deployment
|
36
|
+
@deployment = deployment
|
37
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
38
|
+
@additional_properties = additional_properties
|
39
|
+
end
|
40
|
+
|
41
|
+
# Deserialize a JSON object to an instance of RegisterPromptResponse
|
42
|
+
#
|
43
|
+
# @param json_object [JSON]
|
44
|
+
# @return [RegisterPromptResponse]
|
45
|
+
def self.from_json(json_object:)
|
46
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
47
|
+
parsed_json = JSON.parse(json_object)
|
48
|
+
if parsed_json["prompt"].nil?
|
49
|
+
prompt = nil
|
50
|
+
else
|
51
|
+
prompt = parsed_json["prompt"].to_json
|
52
|
+
prompt = RegisterPromptPrompt.from_json(json_object: prompt)
|
53
|
+
end
|
54
|
+
if parsed_json["sandbox_snapshot"].nil?
|
55
|
+
sandbox_snapshot = nil
|
56
|
+
else
|
57
|
+
sandbox_snapshot = parsed_json["sandbox_snapshot"].to_json
|
58
|
+
sandbox_snapshot = RegisteredPromptSandboxSnapshot.from_json(json_object: sandbox_snapshot)
|
59
|
+
end
|
60
|
+
if parsed_json["sandbox"].nil?
|
61
|
+
sandbox = nil
|
62
|
+
else
|
63
|
+
sandbox = parsed_json["sandbox"].to_json
|
64
|
+
sandbox = RegisteredPromptSandbox.from_json(json_object: sandbox)
|
65
|
+
end
|
66
|
+
if parsed_json["model_version"].nil?
|
67
|
+
model_version = nil
|
68
|
+
else
|
69
|
+
model_version = parsed_json["model_version"].to_json
|
70
|
+
model_version = RegisteredPromptModelVersion.from_json(json_object: model_version)
|
71
|
+
end
|
72
|
+
prompt_version_id = struct.prompt_version_id
|
73
|
+
if parsed_json["deployment"].nil?
|
74
|
+
deployment = nil
|
75
|
+
else
|
76
|
+
deployment = parsed_json["deployment"].to_json
|
77
|
+
deployment = RegisteredPromptDeployment.from_json(json_object: deployment)
|
78
|
+
end
|
79
|
+
new(prompt: prompt, sandbox_snapshot: sandbox_snapshot, sandbox: sandbox, model_version: model_version,
|
80
|
+
prompt_version_id: prompt_version_id, deployment: deployment, additional_properties: struct)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Serialize an instance of RegisterPromptResponse to a JSON object
|
84
|
+
#
|
85
|
+
# @return [JSON]
|
86
|
+
def to_json(*_args)
|
87
|
+
{
|
88
|
+
"prompt": @prompt,
|
89
|
+
"sandbox_snapshot": @sandbox_snapshot,
|
90
|
+
"sandbox": @sandbox,
|
91
|
+
"model_version": @model_version,
|
92
|
+
"prompt_version_id": @prompt_version_id,
|
93
|
+
"deployment": @deployment
|
94
|
+
}.to_json
|
95
|
+
end
|
96
|
+
|
97
|
+
# 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.
|
98
|
+
#
|
99
|
+
# @param obj [Object]
|
100
|
+
# @return [Void]
|
101
|
+
def self.validate_raw(obj:)
|
102
|
+
RegisterPromptPrompt.validate_raw(obj: obj.prompt)
|
103
|
+
RegisteredPromptSandboxSnapshot.validate_raw(obj: obj.sandbox_snapshot)
|
104
|
+
RegisteredPromptSandbox.validate_raw(obj: obj.sandbox)
|
105
|
+
RegisteredPromptModelVersion.validate_raw(obj: obj.model_version)
|
106
|
+
obj.prompt_version_id.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
|
107
|
+
RegisteredPromptDeployment.validate_raw(obj: obj.deployment)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisteredPromptDeployment
|
7
|
+
attr_reader :id, :name, :label, :additional_properties
|
8
|
+
|
9
|
+
# @param id [String] The ID of the generated deployment.
|
10
|
+
# @param name [String] A uniquely-identifying name for generated deployment.
|
11
|
+
# @param label [String] A human-friendly label for the generated deployment.
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [RegisteredPromptDeployment]
|
14
|
+
def initialize(id:, name:, label:, additional_properties: nil)
|
15
|
+
# @type [String] The ID of the generated deployment.
|
16
|
+
@id = id
|
17
|
+
# @type [String] A uniquely-identifying name for generated deployment.
|
18
|
+
@name = name
|
19
|
+
# @type [String] A human-friendly label for the generated deployment.
|
20
|
+
@label = label
|
21
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
@additional_properties = additional_properties
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of RegisteredPromptDeployment
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [RegisteredPromptDeployment]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
JSON.parse(json_object)
|
32
|
+
id = struct.id
|
33
|
+
name = struct.name
|
34
|
+
label = struct.label
|
35
|
+
new(id: id, name: name, label: label, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of RegisteredPromptDeployment to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "id": @id, "name": @name, "label": @label }.to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
# 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.
|
46
|
+
#
|
47
|
+
# @param obj [Object]
|
48
|
+
# @return [Void]
|
49
|
+
def self.validate_raw(obj:)
|
50
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
51
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
52
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_variable_type"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class RegisteredPromptInputVariableRequest
|
8
|
+
attr_reader :key, :id, :type, :additional_properties
|
9
|
+
|
10
|
+
# @param key [String]
|
11
|
+
# @param id [String]
|
12
|
+
# @param type [VELLUM_VARIABLE_TYPE]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [RegisteredPromptInputVariableRequest]
|
15
|
+
def initialize(key:, id: nil, type: nil, additional_properties: nil)
|
16
|
+
# @type [String]
|
17
|
+
@key = key
|
18
|
+
# @type [String]
|
19
|
+
@id = id
|
20
|
+
# @type [VELLUM_VARIABLE_TYPE]
|
21
|
+
@type = type
|
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 RegisteredPromptInputVariableRequest
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [RegisteredPromptInputVariableRequest]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
parsed_json = JSON.parse(json_object)
|
33
|
+
key = struct.key
|
34
|
+
id = struct.id
|
35
|
+
type = VELLUM_VARIABLE_TYPE.key(parsed_json["type"]) || parsed_json["type"]
|
36
|
+
new(key: key, id: id, type: type, additional_properties: struct)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Serialize an instance of RegisteredPromptInputVariableRequest to a JSON object
|
40
|
+
#
|
41
|
+
# @return [JSON]
|
42
|
+
def to_json(*_args)
|
43
|
+
{ "key": @key, "id": @id, "type": VELLUM_VARIABLE_TYPE[@type] || @type }.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.key.is_a?(String) != false || raise("Passed value for field obj.key 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.type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisteredPromptModelVersion
|
7
|
+
attr_reader :id, :label, :additional_properties
|
8
|
+
|
9
|
+
# @param id [String] The ID of the generated model version.
|
10
|
+
# @param label [String] A human-friendly label for the generated model version.
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [RegisteredPromptModelVersion]
|
13
|
+
def initialize(id:, label:, additional_properties: nil)
|
14
|
+
# @type [String] The ID of the generated model version.
|
15
|
+
@id = id
|
16
|
+
# @type [String] A human-friendly label for the generated model version.
|
17
|
+
@label = label
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of RegisteredPromptModelVersion
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [RegisteredPromptModelVersion]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
id = struct.id
|
30
|
+
label = struct.label
|
31
|
+
new(id: id, label: label, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of RegisteredPromptModelVersion to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "id": @id, "label": @label }.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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
47
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisteredPromptSandbox
|
7
|
+
attr_reader :id, :label, :additional_properties
|
8
|
+
|
9
|
+
# @param id [String] The ID of the generated sandbox.
|
10
|
+
# @param label [String] A human-friendly label for the generated sandbox.
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [RegisteredPromptSandbox]
|
13
|
+
def initialize(id:, label:, additional_properties: nil)
|
14
|
+
# @type [String] The ID of the generated sandbox.
|
15
|
+
@id = id
|
16
|
+
# @type [String] A human-friendly label for the generated sandbox.
|
17
|
+
@label = label
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of RegisteredPromptSandbox
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [RegisteredPromptSandbox]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
id = struct.id
|
30
|
+
label = struct.label
|
31
|
+
new(id: id, label: label, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of RegisteredPromptSandbox to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "id": @id, "label": @label }.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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
47
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisteredPromptSandboxSnapshot
|
7
|
+
attr_reader :id, :additional_properties
|
8
|
+
|
9
|
+
# @param id [String] The ID of the generated sandbox snapshot.
|
10
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
# @return [RegisteredPromptSandboxSnapshot]
|
12
|
+
def initialize(id:, additional_properties: nil)
|
13
|
+
# @type [String] The ID of the generated sandbox snapshot.
|
14
|
+
@id = id
|
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 RegisteredPromptSandboxSnapshot
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [RegisteredPromptSandboxSnapshot]
|
23
|
+
def self.from_json(json_object:)
|
24
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
25
|
+
JSON.parse(json_object)
|
26
|
+
id = struct.id
|
27
|
+
new(id: id, additional_properties: struct)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Serialize an instance of RegisteredPromptSandboxSnapshot to a JSON object
|
31
|
+
#
|
32
|
+
# @return [JSON]
|
33
|
+
def to_json(*_args)
|
34
|
+
{ "id": @id }.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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_error"
|
4
|
+
require_relative "rejected_prompt_execution_meta"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The final data returned indicating an error occurred during the stream.
|
9
|
+
class RejectedExecutePromptEvent
|
10
|
+
attr_reader :error, :execution_id, :meta, :additional_properties
|
11
|
+
|
12
|
+
# @param error [VellumError]
|
13
|
+
# @param execution_id [String]
|
14
|
+
# @param meta [RejectedPromptExecutionMeta]
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [RejectedExecutePromptEvent]
|
17
|
+
def initialize(error:, execution_id:, meta: nil, additional_properties: nil)
|
18
|
+
# @type [VellumError]
|
19
|
+
@error = error
|
20
|
+
# @type [String]
|
21
|
+
@execution_id = execution_id
|
22
|
+
# @type [RejectedPromptExecutionMeta]
|
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 RejectedExecutePromptEvent
|
29
|
+
#
|
30
|
+
# @param json_object [JSON]
|
31
|
+
# @return [RejectedExecutePromptEvent]
|
32
|
+
def self.from_json(json_object:)
|
33
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
34
|
+
parsed_json = JSON.parse(json_object)
|
35
|
+
if parsed_json["error"].nil?
|
36
|
+
error = nil
|
37
|
+
else
|
38
|
+
error = parsed_json["error"].to_json
|
39
|
+
error = VellumError.from_json(json_object: error)
|
40
|
+
end
|
41
|
+
execution_id = struct.execution_id
|
42
|
+
if parsed_json["meta"].nil?
|
43
|
+
meta = nil
|
44
|
+
else
|
45
|
+
meta = parsed_json["meta"].to_json
|
46
|
+
meta = RejectedPromptExecutionMeta.from_json(json_object: meta)
|
47
|
+
end
|
48
|
+
new(error: error, execution_id: execution_id, meta: meta, additional_properties: struct)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Serialize an instance of RejectedExecutePromptEvent to a JSON object
|
52
|
+
#
|
53
|
+
# @return [JSON]
|
54
|
+
def to_json(*_args)
|
55
|
+
{ "error": @error, "execution_id": @execution_id, "meta": @meta }.to_json
|
56
|
+
end
|
57
|
+
|
58
|
+
# 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.
|
59
|
+
#
|
60
|
+
# @param obj [Object]
|
61
|
+
# @return [Void]
|
62
|
+
def self.validate_raw(obj:)
|
63
|
+
VellumError.validate_raw(obj: obj.error)
|
64
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
65
|
+
obj.meta.nil? || RejectedPromptExecutionMeta.validate_raw(obj: obj.meta)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_execution_meta"
|
4
|
+
require_relative "vellum_error"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The unsuccessful response from the model containing an error of what went wrong.
|
9
|
+
class RejectedExecutePromptResponse
|
10
|
+
attr_reader :meta, :raw, :execution_id, :error, :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 error [VellumError]
|
16
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
17
|
+
# @return [RejectedExecutePromptResponse]
|
18
|
+
def initialize(execution_id:, error:, 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 [VellumError]
|
26
|
+
@error = error
|
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 RejectedExecutePromptResponse
|
32
|
+
#
|
33
|
+
# @param json_object [JSON]
|
34
|
+
# @return [RejectedExecutePromptResponse]
|
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
|
+
if parsed_json["error"].nil?
|
47
|
+
error = nil
|
48
|
+
else
|
49
|
+
error = parsed_json["error"].to_json
|
50
|
+
error = VellumError.from_json(json_object: error)
|
51
|
+
end
|
52
|
+
new(meta: meta, raw: raw, execution_id: execution_id, error: error, additional_properties: struct)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Serialize an instance of RejectedExecutePromptResponse to a JSON object
|
56
|
+
#
|
57
|
+
# @return [JSON]
|
58
|
+
def to_json(*_args)
|
59
|
+
{ "meta": @meta, "raw": @raw, "execution_id": @execution_id, "error": @error }.to_json
|
60
|
+
end
|
61
|
+
|
62
|
+
# 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.
|
63
|
+
#
|
64
|
+
# @param obj [Object]
|
65
|
+
# @return [Void]
|
66
|
+
def self.validate_raw(obj:)
|
67
|
+
obj.meta.nil? || PromptExecutionMeta.validate_raw(obj: obj.meta)
|
68
|
+
obj.raw&.is_a?(Hash) != false || raise("Passed value for field obj.raw is not the expected type, validation failed.")
|
69
|
+
obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.")
|
70
|
+
VellumError.validate_raw(obj: obj.error)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "workflow_event_error"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
# The unsuccessful response from the Workflow execution containing an error specifying what went wrong.
|
9
|
+
class RejectedExecuteWorkflowWorkflowResultEvent
|
10
|
+
attr_reader :id, :ts, :error, :additional_properties
|
11
|
+
|
12
|
+
# @param id [String]
|
13
|
+
# @param ts [DateTime]
|
14
|
+
# @param error [WorkflowEventError]
|
15
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
16
|
+
# @return [RejectedExecuteWorkflowWorkflowResultEvent]
|
17
|
+
def initialize(id:, ts:, error:, additional_properties: nil)
|
18
|
+
# @type [String]
|
19
|
+
@id = id
|
20
|
+
# @type [DateTime]
|
21
|
+
@ts = ts
|
22
|
+
# @type [WorkflowEventError]
|
23
|
+
@error = error
|
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 RejectedExecuteWorkflowWorkflowResultEvent
|
29
|
+
#
|
30
|
+
# @param json_object [JSON]
|
31
|
+
# @return [RejectedExecuteWorkflowWorkflowResultEvent]
|
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
|
+
if parsed_json["error"].nil?
|
38
|
+
error = nil
|
39
|
+
else
|
40
|
+
error = parsed_json["error"].to_json
|
41
|
+
error = WorkflowEventError.from_json(json_object: error)
|
42
|
+
end
|
43
|
+
new(id: id, ts: ts, error: error, additional_properties: struct)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Serialize an instance of RejectedExecuteWorkflowWorkflowResultEvent to a JSON object
|
47
|
+
#
|
48
|
+
# @return [JSON]
|
49
|
+
def to_json(*_args)
|
50
|
+
{ "id": @id, "ts": @ts, "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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
59
|
+
obj.ts.is_a?(DateTime) != false || raise("Passed value for field obj.ts is not the expected type, validation failed.")
|
60
|
+
WorkflowEventError.validate_raw(obj: obj.error)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_error"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
# Returned if the function call failed to parse for some reason.
|
8
|
+
class RejectedFunctionCall
|
9
|
+
attr_reader :error, :id, :name, :additional_properties
|
10
|
+
|
11
|
+
# @param error [VellumError]
|
12
|
+
# @param id [String]
|
13
|
+
# @param name [String]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [RejectedFunctionCall]
|
16
|
+
def initialize(error:, name:, id: nil, additional_properties: nil)
|
17
|
+
# @type [VellumError]
|
18
|
+
@error = error
|
19
|
+
# @type [String]
|
20
|
+
@id = id
|
21
|
+
# @type [String]
|
22
|
+
@name = name
|
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 RejectedFunctionCall
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [RejectedFunctionCall]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
if parsed_json["error"].nil?
|
35
|
+
error = nil
|
36
|
+
else
|
37
|
+
error = parsed_json["error"].to_json
|
38
|
+
error = VellumError.from_json(json_object: error)
|
39
|
+
end
|
40
|
+
id = struct.id
|
41
|
+
name = struct.name
|
42
|
+
new(error: error, id: id, name: name, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of RejectedFunctionCall to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{ "error": @error, "id": @id, "name": @name }.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
VellumError.validate_raw(obj: obj.error)
|
58
|
+
obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
59
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|