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,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "indexing_state_enum"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class DocumentDocumentToDocumentIndex
|
8
|
+
attr_reader :id, :document_index_id, :indexing_state, :additional_properties
|
9
|
+
|
10
|
+
# @param id [String] Vellum-generated ID that uniquely identifies this link.
|
11
|
+
# @param document_index_id [String] Vellum-generated ID that uniquely identifies the index this document is included in.
|
12
|
+
# @param indexing_state [INDEXING_STATE_ENUM] An enum value representing where this document is along its indexing lifecycle for this index.
|
13
|
+
# - `AWAITING_PROCESSING` - Awaiting Processing
|
14
|
+
# - `QUEUED` - Queued
|
15
|
+
# - `INDEXING` - Indexing
|
16
|
+
# - `INDEXED` - Indexed
|
17
|
+
# - `FAILED` - Failed
|
18
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
# @return [DocumentDocumentToDocumentIndex]
|
20
|
+
def initialize(id:, document_index_id:, indexing_state: nil, additional_properties: nil)
|
21
|
+
# @type [String] Vellum-generated ID that uniquely identifies this link.
|
22
|
+
@id = id
|
23
|
+
# @type [String] Vellum-generated ID that uniquely identifies the index this document is included in.
|
24
|
+
@document_index_id = document_index_id
|
25
|
+
# @type [INDEXING_STATE_ENUM] An enum value representing where this document is along its indexing lifecycle for this index.
|
26
|
+
# - `AWAITING_PROCESSING` - Awaiting Processing
|
27
|
+
# - `QUEUED` - Queued
|
28
|
+
# - `INDEXING` - Indexing
|
29
|
+
# - `INDEXED` - Indexed
|
30
|
+
# - `FAILED` - Failed
|
31
|
+
@indexing_state = indexing_state
|
32
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
33
|
+
@additional_properties = additional_properties
|
34
|
+
end
|
35
|
+
|
36
|
+
# Deserialize a JSON object to an instance of DocumentDocumentToDocumentIndex
|
37
|
+
#
|
38
|
+
# @param json_object [JSON]
|
39
|
+
# @return [DocumentDocumentToDocumentIndex]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
id = struct.id
|
44
|
+
document_index_id = struct.document_index_id
|
45
|
+
indexing_state = INDEXING_STATE_ENUM.key(parsed_json["indexing_state"]) || parsed_json["indexing_state"]
|
46
|
+
new(id: id, document_index_id: document_index_id, indexing_state: indexing_state, additional_properties: struct)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Serialize an instance of DocumentDocumentToDocumentIndex to a JSON object
|
50
|
+
#
|
51
|
+
# @return [JSON]
|
52
|
+
def to_json(*_args)
|
53
|
+
{
|
54
|
+
"id": @id,
|
55
|
+
"document_index_id": @document_index_id,
|
56
|
+
"indexing_state": INDEXING_STATE_ENUM[@indexing_state] || @indexing_state
|
57
|
+
}.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.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
66
|
+
obj.document_index_id.is_a?(String) != false || raise("Passed value for field obj.document_index_id is not the expected type, validation failed.")
|
67
|
+
obj.indexing_state&.is_a?(INDEXING_STATE_ENUM) != false || raise("Passed value for field obj.indexing_state is not the expected type, validation failed.")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "entity_status"
|
5
|
+
require_relative "environment_enum"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class DocumentIndexRead
|
10
|
+
attr_reader :id, :created, :label, :name, :status, :environment, :indexing_config, :additional_properties
|
11
|
+
|
12
|
+
# @param id [String]
|
13
|
+
# @param created [DateTime]
|
14
|
+
# @param label [String] A human-readable label for the document index
|
15
|
+
# @param name [String] A name that uniquely identifies this index within its workspace
|
16
|
+
# @param status [ENTITY_STATUS] The current status of the document index
|
17
|
+
# - `ACTIVE` - Active
|
18
|
+
# - `ARCHIVED` - Archived
|
19
|
+
# @param environment [ENVIRONMENT_ENUM] The environment this document index is used in
|
20
|
+
# - `DEVELOPMENT` - Development
|
21
|
+
# - `STAGING` - Staging
|
22
|
+
# - `PRODUCTION` - Production
|
23
|
+
# @param indexing_config [Hash{String => String}] Configuration representing how documents should be indexed
|
24
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
25
|
+
# @return [DocumentIndexRead]
|
26
|
+
def initialize(id:, created:, label:, name:, indexing_config:, status: nil, environment: nil,
|
27
|
+
additional_properties: nil)
|
28
|
+
# @type [String]
|
29
|
+
@id = id
|
30
|
+
# @type [DateTime]
|
31
|
+
@created = created
|
32
|
+
# @type [String] A human-readable label for the document index
|
33
|
+
@label = label
|
34
|
+
# @type [String] A name that uniquely identifies this index within its workspace
|
35
|
+
@name = name
|
36
|
+
# @type [ENTITY_STATUS] The current status of the document index
|
37
|
+
# - `ACTIVE` - Active
|
38
|
+
# - `ARCHIVED` - Archived
|
39
|
+
@status = status
|
40
|
+
# @type [ENVIRONMENT_ENUM] The environment this document index is used in
|
41
|
+
# - `DEVELOPMENT` - Development
|
42
|
+
# - `STAGING` - Staging
|
43
|
+
# - `PRODUCTION` - Production
|
44
|
+
@environment = environment
|
45
|
+
# @type [Hash{String => String}] Configuration representing how documents should be indexed
|
46
|
+
@indexing_config = indexing_config
|
47
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
48
|
+
@additional_properties = additional_properties
|
49
|
+
end
|
50
|
+
|
51
|
+
# Deserialize a JSON object to an instance of DocumentIndexRead
|
52
|
+
#
|
53
|
+
# @param json_object [JSON]
|
54
|
+
# @return [DocumentIndexRead]
|
55
|
+
def self.from_json(json_object:)
|
56
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
57
|
+
parsed_json = JSON.parse(json_object)
|
58
|
+
id = struct.id
|
59
|
+
created = DateTime.parse(parsed_json["created"])
|
60
|
+
label = struct.label
|
61
|
+
name = struct.name
|
62
|
+
status = ENTITY_STATUS.key(parsed_json["status"]) || parsed_json["status"]
|
63
|
+
environment = ENVIRONMENT_ENUM.key(parsed_json["environment"]) || parsed_json["environment"]
|
64
|
+
indexing_config = struct.indexing_config
|
65
|
+
new(id: id, created: created, label: label, name: name, status: status, environment: environment,
|
66
|
+
indexing_config: indexing_config, additional_properties: struct)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Serialize an instance of DocumentIndexRead to a JSON object
|
70
|
+
#
|
71
|
+
# @return [JSON]
|
72
|
+
def to_json(*_args)
|
73
|
+
{
|
74
|
+
"id": @id,
|
75
|
+
"created": @created,
|
76
|
+
"label": @label,
|
77
|
+
"name": @name,
|
78
|
+
"status": ENTITY_STATUS[@status] || @status,
|
79
|
+
"environment": ENVIRONMENT_ENUM[@environment] || @environment,
|
80
|
+
"indexing_config": @indexing_config
|
81
|
+
}.to_json
|
82
|
+
end
|
83
|
+
|
84
|
+
# 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.
|
85
|
+
#
|
86
|
+
# @param obj [Object]
|
87
|
+
# @return [Void]
|
88
|
+
def self.validate_raw(obj:)
|
89
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
90
|
+
obj.created.is_a?(DateTime) != false || raise("Passed value for field obj.created is not the expected type, validation failed.")
|
91
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
92
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
93
|
+
obj.status&.is_a?(ENTITY_STATUS) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
94
|
+
obj.environment&.is_a?(ENVIRONMENT_ENUM) != false || raise("Passed value for field obj.environment is not the expected type, validation failed.")
|
95
|
+
obj.indexing_config.is_a?(Hash) != false || raise("Passed value for field obj.indexing_config is not the expected type, validation failed.")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "date"
|
4
|
+
require_relative "processing_state_enum"
|
5
|
+
require_relative "document_status"
|
6
|
+
require_relative "document_document_to_document_index"
|
7
|
+
require "json"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class DocumentRead
|
11
|
+
attr_reader :id, :external_id, :last_uploaded_at, :label, :processing_state, :status, :original_file_url,
|
12
|
+
:processed_file_url, :document_to_document_indexes, :metadata, :additional_properties
|
13
|
+
|
14
|
+
# @param id [String]
|
15
|
+
# @param external_id [String] The unique id of this document as it exists in the user's system.
|
16
|
+
# @param last_uploaded_at [DateTime]
|
17
|
+
# @param label [String] A human-readable label for the document. Defaults to the originally uploaded file's file name.
|
18
|
+
# @param processing_state [PROCESSING_STATE_ENUM] The current processing state of the document
|
19
|
+
# - `QUEUED` - Queued
|
20
|
+
# - `PROCESSING` - Processing
|
21
|
+
# - `PROCESSED` - Processed
|
22
|
+
# - `FAILED` - Failed
|
23
|
+
# @param status [DOCUMENT_STATUS] The current status of the document
|
24
|
+
# - `ACTIVE` - Active
|
25
|
+
# @param original_file_url [String]
|
26
|
+
# @param processed_file_url [String]
|
27
|
+
# @param document_to_document_indexes [Array<DocumentDocumentToDocumentIndex>]
|
28
|
+
# @param metadata [Hash{String => String}] A previously supplied JSON object containing metadata that can be filtered on when searching.
|
29
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
30
|
+
# @return [DocumentRead]
|
31
|
+
def initialize(id:, last_uploaded_at:, label:, document_to_document_indexes:, external_id: nil, processing_state: nil, status: nil,
|
32
|
+
original_file_url: nil, processed_file_url: nil, metadata: nil, additional_properties: nil)
|
33
|
+
# @type [String]
|
34
|
+
@id = id
|
35
|
+
# @type [String] The unique id of this document as it exists in the user's system.
|
36
|
+
@external_id = external_id
|
37
|
+
# @type [DateTime]
|
38
|
+
@last_uploaded_at = last_uploaded_at
|
39
|
+
# @type [String] A human-readable label for the document. Defaults to the originally uploaded file's file name.
|
40
|
+
@label = label
|
41
|
+
# @type [PROCESSING_STATE_ENUM] The current processing state of the document
|
42
|
+
# - `QUEUED` - Queued
|
43
|
+
# - `PROCESSING` - Processing
|
44
|
+
# - `PROCESSED` - Processed
|
45
|
+
# - `FAILED` - Failed
|
46
|
+
@processing_state = processing_state
|
47
|
+
# @type [DOCUMENT_STATUS] The current status of the document
|
48
|
+
# - `ACTIVE` - Active
|
49
|
+
@status = status
|
50
|
+
# @type [String]
|
51
|
+
@original_file_url = original_file_url
|
52
|
+
# @type [String]
|
53
|
+
@processed_file_url = processed_file_url
|
54
|
+
# @type [Array<DocumentDocumentToDocumentIndex>]
|
55
|
+
@document_to_document_indexes = document_to_document_indexes
|
56
|
+
# @type [Hash{String => String}] A previously supplied JSON object containing metadata that can be filtered on when searching.
|
57
|
+
@metadata = metadata
|
58
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
59
|
+
@additional_properties = additional_properties
|
60
|
+
end
|
61
|
+
|
62
|
+
# Deserialize a JSON object to an instance of DocumentRead
|
63
|
+
#
|
64
|
+
# @param json_object [JSON]
|
65
|
+
# @return [DocumentRead]
|
66
|
+
def self.from_json(json_object:)
|
67
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
68
|
+
parsed_json = JSON.parse(json_object)
|
69
|
+
id = struct.id
|
70
|
+
external_id = struct.external_id
|
71
|
+
last_uploaded_at = DateTime.parse(parsed_json["last_uploaded_at"])
|
72
|
+
label = struct.label
|
73
|
+
processing_state = PROCESSING_STATE_ENUM.key(parsed_json["processing_state"]) || parsed_json["processing_state"]
|
74
|
+
status = struct.status
|
75
|
+
original_file_url = struct.original_file_url
|
76
|
+
processed_file_url = struct.processed_file_url
|
77
|
+
document_to_document_indexes = parsed_json["document_to_document_indexes"].map do |v|
|
78
|
+
v = v.to_json
|
79
|
+
DocumentDocumentToDocumentIndex.from_json(json_object: v)
|
80
|
+
end
|
81
|
+
metadata = struct.metadata
|
82
|
+
new(id: id, external_id: external_id, last_uploaded_at: last_uploaded_at, label: label,
|
83
|
+
processing_state: processing_state, status: status, original_file_url: original_file_url, processed_file_url: processed_file_url, document_to_document_indexes: document_to_document_indexes, metadata: metadata, additional_properties: struct)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Serialize an instance of DocumentRead to a JSON object
|
87
|
+
#
|
88
|
+
# @return [JSON]
|
89
|
+
def to_json(*_args)
|
90
|
+
{
|
91
|
+
"id": @id,
|
92
|
+
"external_id": @external_id,
|
93
|
+
"last_uploaded_at": @last_uploaded_at,
|
94
|
+
"label": @label,
|
95
|
+
"processing_state": PROCESSING_STATE_ENUM[@processing_state] || @processing_state,
|
96
|
+
"status": @status,
|
97
|
+
"original_file_url": @original_file_url,
|
98
|
+
"processed_file_url": @processed_file_url,
|
99
|
+
"document_to_document_indexes": @document_to_document_indexes,
|
100
|
+
"metadata": @metadata
|
101
|
+
}.to_json
|
102
|
+
end
|
103
|
+
|
104
|
+
# 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.
|
105
|
+
#
|
106
|
+
# @param obj [Object]
|
107
|
+
# @return [Void]
|
108
|
+
def self.validate_raw(obj:)
|
109
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
110
|
+
obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
|
111
|
+
obj.last_uploaded_at.is_a?(DateTime) != false || raise("Passed value for field obj.last_uploaded_at is not the expected type, validation failed.")
|
112
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
113
|
+
obj.processing_state&.is_a?(PROCESSING_STATE_ENUM) != false || raise("Passed value for field obj.processing_state is not the expected type, validation failed.")
|
114
|
+
obj.status&.is_a?(String) != false || raise("Passed value for field obj.status is not the expected type, validation failed.")
|
115
|
+
obj.original_file_url&.is_a?(String) != false || raise("Passed value for field obj.original_file_url is not the expected type, validation failed.")
|
116
|
+
obj.processed_file_url&.is_a?(String) != false || raise("Passed value for field obj.processed_file_url is not the expected type, validation failed.")
|
117
|
+
obj.document_to_document_indexes.is_a?(Array) != false || raise("Passed value for field obj.document_to_document_indexes is not the expected type, validation failed.")
|
118
|
+
obj.metadata&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.")
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "finish_reason_enum"
|
4
|
+
require_relative "normalized_log_probs"
|
5
|
+
require_relative "vellum_variable_type"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class EnrichedNormalizedCompletion
|
10
|
+
attr_reader :id, :external_id, :text, :finish_reason, :logprobs, :model_version_id, :prompt_version_id, :type,
|
11
|
+
:deployment_release_tag, :model_name, :additional_properties
|
12
|
+
|
13
|
+
# @param id [String] The Vellum-generated ID of the completion.
|
14
|
+
# @param external_id [String] The external ID that was originally provided along with the generation request, which uniquely identifies this generation in an external system.
|
15
|
+
# @param text [String] The text generated by the LLM.
|
16
|
+
# @param finish_reason [FINISH_REASON_ENUM] The reason the generation finished.
|
17
|
+
# - `LENGTH` - LENGTH
|
18
|
+
# - `STOP` - STOP
|
19
|
+
# - `UNKNOWN` - UNKNOWN
|
20
|
+
# @param logprobs [NormalizedLogProbs] The logprobs of the completion. Only present if specified in the original request options.
|
21
|
+
# @param model_version_id [String] The ID of the model version used to generate this completion.
|
22
|
+
# @param prompt_version_id [String]
|
23
|
+
# @param type [VELLUM_VARIABLE_TYPE]
|
24
|
+
# @param deployment_release_tag [String]
|
25
|
+
# @param model_name [String]
|
26
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
27
|
+
# @return [EnrichedNormalizedCompletion]
|
28
|
+
def initialize(id:, text:, model_version_id:, prompt_version_id:, deployment_release_tag:, model_name:,
|
29
|
+
external_id: nil, finish_reason: nil, logprobs: nil, type: nil, additional_properties: nil)
|
30
|
+
# @type [String] The Vellum-generated ID of the completion.
|
31
|
+
@id = id
|
32
|
+
# @type [String] The external ID that was originally provided along with the generation request, which uniquely identifies this generation in an external system.
|
33
|
+
@external_id = external_id
|
34
|
+
# @type [String] The text generated by the LLM.
|
35
|
+
@text = text
|
36
|
+
# @type [FINISH_REASON_ENUM] The reason the generation finished.
|
37
|
+
# - `LENGTH` - LENGTH
|
38
|
+
# - `STOP` - STOP
|
39
|
+
# - `UNKNOWN` - UNKNOWN
|
40
|
+
@finish_reason = finish_reason
|
41
|
+
# @type [NormalizedLogProbs] The logprobs of the completion. Only present if specified in the original request options.
|
42
|
+
@logprobs = logprobs
|
43
|
+
# @type [String] The ID of the model version used to generate this completion.
|
44
|
+
@model_version_id = model_version_id
|
45
|
+
# @type [String]
|
46
|
+
@prompt_version_id = prompt_version_id
|
47
|
+
# @type [VELLUM_VARIABLE_TYPE]
|
48
|
+
@type = type
|
49
|
+
# @type [String]
|
50
|
+
@deployment_release_tag = deployment_release_tag
|
51
|
+
# @type [String]
|
52
|
+
@model_name = model_name
|
53
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
54
|
+
@additional_properties = additional_properties
|
55
|
+
end
|
56
|
+
|
57
|
+
# Deserialize a JSON object to an instance of EnrichedNormalizedCompletion
|
58
|
+
#
|
59
|
+
# @param json_object [JSON]
|
60
|
+
# @return [EnrichedNormalizedCompletion]
|
61
|
+
def self.from_json(json_object:)
|
62
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
63
|
+
parsed_json = JSON.parse(json_object)
|
64
|
+
id = struct.id
|
65
|
+
external_id = struct.external_id
|
66
|
+
text = struct.text
|
67
|
+
finish_reason = FINISH_REASON_ENUM.key(parsed_json["finish_reason"]) || parsed_json["finish_reason"]
|
68
|
+
if parsed_json["logprobs"].nil?
|
69
|
+
logprobs = nil
|
70
|
+
else
|
71
|
+
logprobs = parsed_json["logprobs"].to_json
|
72
|
+
logprobs = NormalizedLogProbs.from_json(json_object: logprobs)
|
73
|
+
end
|
74
|
+
model_version_id = struct.model_version_id
|
75
|
+
prompt_version_id = struct.prompt_version_id
|
76
|
+
type = VELLUM_VARIABLE_TYPE.key(parsed_json["type"]) || parsed_json["type"]
|
77
|
+
deployment_release_tag = struct.deployment_release_tag
|
78
|
+
model_name = struct.model_name
|
79
|
+
new(id: id, external_id: external_id, text: text, finish_reason: finish_reason, logprobs: logprobs,
|
80
|
+
model_version_id: model_version_id, prompt_version_id: prompt_version_id, type: type, deployment_release_tag: deployment_release_tag, model_name: model_name, additional_properties: struct)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Serialize an instance of EnrichedNormalizedCompletion to a JSON object
|
84
|
+
#
|
85
|
+
# @return [JSON]
|
86
|
+
def to_json(*_args)
|
87
|
+
{
|
88
|
+
"id": @id,
|
89
|
+
"external_id": @external_id,
|
90
|
+
"text": @text,
|
91
|
+
"finish_reason": FINISH_REASON_ENUM[@finish_reason] || @finish_reason,
|
92
|
+
"logprobs": @logprobs,
|
93
|
+
"model_version_id": @model_version_id,
|
94
|
+
"prompt_version_id": @prompt_version_id,
|
95
|
+
"type": VELLUM_VARIABLE_TYPE[@type] || @type,
|
96
|
+
"deployment_release_tag": @deployment_release_tag,
|
97
|
+
"model_name": @model_name
|
98
|
+
}.to_json
|
99
|
+
end
|
100
|
+
|
101
|
+
# 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.
|
102
|
+
#
|
103
|
+
# @param obj [Object]
|
104
|
+
# @return [Void]
|
105
|
+
def self.validate_raw(obj:)
|
106
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
107
|
+
obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.")
|
108
|
+
obj.text.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
|
109
|
+
obj.finish_reason&.is_a?(FINISH_REASON_ENUM) != false || raise("Passed value for field obj.finish_reason is not the expected type, validation failed.")
|
110
|
+
obj.logprobs.nil? || NormalizedLogProbs.validate_raw(obj: obj.logprobs)
|
111
|
+
obj.model_version_id.is_a?(String) != false || raise("Passed value for field obj.model_version_id is not the expected type, validation failed.")
|
112
|
+
obj.prompt_version_id.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
|
113
|
+
obj.type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
|
114
|
+
obj.deployment_release_tag.is_a?(String) != false || raise("Passed value for field obj.deployment_release_tag is not the expected type, validation failed.")
|
115
|
+
obj.model_name.is_a?(String) != false || raise("Passed value for field obj.model_name is not the expected type, validation failed.")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "vellum_error"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class ErrorVariableValue
|
8
|
+
attr_reader :value, :additional_properties
|
9
|
+
|
10
|
+
# @param value [VellumError]
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [ErrorVariableValue]
|
13
|
+
def initialize(value: nil, additional_properties: nil)
|
14
|
+
# @type [VellumError]
|
15
|
+
@value = value
|
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 ErrorVariableValue
|
21
|
+
#
|
22
|
+
# @param json_object [JSON]
|
23
|
+
# @return [ErrorVariableValue]
|
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["value"].nil?
|
28
|
+
value = nil
|
29
|
+
else
|
30
|
+
value = parsed_json["value"].to_json
|
31
|
+
value = VellumError.from_json(json_object: value)
|
32
|
+
end
|
33
|
+
new(value: value, additional_properties: struct)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Serialize an instance of ErrorVariableValue to a JSON object
|
37
|
+
#
|
38
|
+
# @return [JSON]
|
39
|
+
def to_json(*_args)
|
40
|
+
{ "value": @value }.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.value.nil? || VellumError.validate_raw(obj: obj.value)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class ExecutePromptApiErrorResponse
|
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 [ExecutePromptApiErrorResponse]
|
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 ExecutePromptApiErrorResponse
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [ExecutePromptApiErrorResponse]
|
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 ExecutePromptApiErrorResponse 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,116 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "initiated_execute_prompt_event"
|
5
|
+
require_relative "streaming_execute_prompt_event"
|
6
|
+
require_relative "fulfilled_execute_prompt_event"
|
7
|
+
require_relative "rejected_execute_prompt_event"
|
8
|
+
|
9
|
+
module Vellum
|
10
|
+
class ExecutePromptEvent
|
11
|
+
attr_reader :member, :discriminant
|
12
|
+
|
13
|
+
private_class_method :new
|
14
|
+
alias kind_of? is_a?
|
15
|
+
# @param member [Object]
|
16
|
+
# @param discriminant [String]
|
17
|
+
# @return [ExecutePromptEvent]
|
18
|
+
def initialize(member:, discriminant:)
|
19
|
+
# @type [Object]
|
20
|
+
@member = member
|
21
|
+
# @type [String]
|
22
|
+
@discriminant = discriminant
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of ExecutePromptEvent
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [ExecutePromptEvent]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
member = case struct.state
|
32
|
+
when "INITIATED"
|
33
|
+
InitiatedExecutePromptEvent.from_json(json_object: json_object)
|
34
|
+
when "STREAMING"
|
35
|
+
StreamingExecutePromptEvent.from_json(json_object: json_object)
|
36
|
+
when "FULFILLED"
|
37
|
+
FulfilledExecutePromptEvent.from_json(json_object: json_object)
|
38
|
+
when "REJECTED"
|
39
|
+
RejectedExecutePromptEvent.from_json(json_object: json_object)
|
40
|
+
else
|
41
|
+
InitiatedExecutePromptEvent.from_json(json_object: json_object)
|
42
|
+
end
|
43
|
+
new(member: member, discriminant: struct.state)
|
44
|
+
end
|
45
|
+
|
46
|
+
# For Union Types, to_json functionality is delegated to the wrapped member.
|
47
|
+
#
|
48
|
+
# @return [JSON]
|
49
|
+
def to_json(*_args)
|
50
|
+
case @discriminant
|
51
|
+
when "INITIATED"
|
52
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
53
|
+
when "STREAMING"
|
54
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
55
|
+
when "FULFILLED"
|
56
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
57
|
+
when "REJECTED"
|
58
|
+
{ **@member.to_json, state: @discriminant }.to_json
|
59
|
+
else
|
60
|
+
{ "state": @discriminant, value: @member }.to_json
|
61
|
+
end
|
62
|
+
@member.to_json
|
63
|
+
end
|
64
|
+
|
65
|
+
# 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.
|
66
|
+
#
|
67
|
+
# @param obj [Object]
|
68
|
+
# @return [Void]
|
69
|
+
def self.validate_raw(obj:)
|
70
|
+
case obj.state
|
71
|
+
when "INITIATED"
|
72
|
+
InitiatedExecutePromptEvent.validate_raw(obj: obj)
|
73
|
+
when "STREAMING"
|
74
|
+
StreamingExecutePromptEvent.validate_raw(obj: obj)
|
75
|
+
when "FULFILLED"
|
76
|
+
FulfilledExecutePromptEvent.validate_raw(obj: obj)
|
77
|
+
when "REJECTED"
|
78
|
+
RejectedExecutePromptEvent.validate_raw(obj: obj)
|
79
|
+
else
|
80
|
+
raise("Passed value matched no type within the union, validation failed.")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# For Union Types, is_a? functionality is delegated to the wrapped member.
|
85
|
+
#
|
86
|
+
# @param obj [Object]
|
87
|
+
# @return [Boolean]
|
88
|
+
def is_a?(obj)
|
89
|
+
@member.is_a?(obj)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @param member [InitiatedExecutePromptEvent]
|
93
|
+
# @return [ExecutePromptEvent]
|
94
|
+
def self.initiated(member:)
|
95
|
+
new(member: member, discriminant: "INITIATED")
|
96
|
+
end
|
97
|
+
|
98
|
+
# @param member [StreamingExecutePromptEvent]
|
99
|
+
# @return [ExecutePromptEvent]
|
100
|
+
def self.streaming(member:)
|
101
|
+
new(member: member, discriminant: "STREAMING")
|
102
|
+
end
|
103
|
+
|
104
|
+
# @param member [FulfilledExecutePromptEvent]
|
105
|
+
# @return [ExecutePromptEvent]
|
106
|
+
def self.fulfilled(member:)
|
107
|
+
new(member: member, discriminant: "FULFILLED")
|
108
|
+
end
|
109
|
+
|
110
|
+
# @param member [RejectedExecutePromptEvent]
|
111
|
+
# @return [ExecutePromptEvent]
|
112
|
+
def self.rejected(member:)
|
113
|
+
new(member: member, discriminant: "REJECTED")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|