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,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
# A user input representing a JSON object
|
7
|
+
class JsonInputRequest
|
8
|
+
attr_reader :name, :value, :additional_properties
|
9
|
+
|
10
|
+
# @param name [String] The variable's name, as defined in the deployment.
|
11
|
+
# @param value [Hash{String => String}]
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [JsonInputRequest]
|
14
|
+
def initialize(name:, value:, additional_properties: nil)
|
15
|
+
# @type [String] The variable's name, as defined in the deployment.
|
16
|
+
@name = name
|
17
|
+
# @type [Hash{String => String}]
|
18
|
+
@value = value
|
19
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
@additional_properties = additional_properties
|
21
|
+
end
|
22
|
+
|
23
|
+
# Deserialize a JSON object to an instance of JsonInputRequest
|
24
|
+
#
|
25
|
+
# @param json_object [JSON]
|
26
|
+
# @return [JsonInputRequest]
|
27
|
+
def self.from_json(json_object:)
|
28
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
29
|
+
JSON.parse(json_object)
|
30
|
+
name = struct.name
|
31
|
+
value = struct.value
|
32
|
+
new(name: name, value: value, additional_properties: struct)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Serialize an instance of JsonInputRequest to a JSON object
|
36
|
+
#
|
37
|
+
# @return [JSON]
|
38
|
+
def to_json(*_args)
|
39
|
+
{ "name": @name, "value": @value }.to_json
|
40
|
+
end
|
41
|
+
|
42
|
+
# 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.
|
43
|
+
#
|
44
|
+
# @param obj [Object]
|
45
|
+
# @return [Void]
|
46
|
+
def self.validate_raw(obj:)
|
47
|
+
obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
|
48
|
+
obj.value.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
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 JsonVariableValue
|
7
|
+
attr_reader :value, :additional_properties
|
8
|
+
|
9
|
+
# @param value [Hash{String => String}]
|
10
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
11
|
+
# @return [JsonVariableValue]
|
12
|
+
def initialize(value: nil, additional_properties: nil)
|
13
|
+
# @type [Hash{String => String}]
|
14
|
+
@value = value
|
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 JsonVariableValue
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [JsonVariableValue]
|
23
|
+
def self.from_json(json_object:)
|
24
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
25
|
+
JSON.parse(json_object)
|
26
|
+
value = struct.value
|
27
|
+
new(value: value, additional_properties: struct)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Serialize an instance of JsonVariableValue to a JSON object
|
31
|
+
#
|
32
|
+
# @return [JSON]
|
33
|
+
def to_json(*_args)
|
34
|
+
{ "value": @value }.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.value&.is_a?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vellum
|
4
|
+
# @type [LOGICAL_OPERATOR]
|
5
|
+
LOGICAL_OPERATOR = {
|
6
|
+
equals: "=",
|
7
|
+
does_not_equal: "!=",
|
8
|
+
less_than: "<",
|
9
|
+
greater_than: ">",
|
10
|
+
less_than_or_equal_to: "<=",
|
11
|
+
greater_than_or_equal_to: ">=",
|
12
|
+
contains: "contains",
|
13
|
+
begins_with: "beginsWith",
|
14
|
+
ends_with: "endsWith",
|
15
|
+
does_not_contain: "doesNotContain",
|
16
|
+
does_not_begin_with: "doesNotBeginWith",
|
17
|
+
does_not_end_with: "doesNotEndWith",
|
18
|
+
null: "null",
|
19
|
+
not_null: "notNull",
|
20
|
+
in_: "in",
|
21
|
+
not_in: "notIn",
|
22
|
+
between: "between",
|
23
|
+
not_between: "notBetween"
|
24
|
+
}.freeze
|
25
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "metadata_filter_rule_combinator"
|
4
|
+
require_relative "metadata_filter_rule_request"
|
5
|
+
require_relative "logical_operator"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class MetadataFilterConfigRequest
|
10
|
+
attr_reader :combinator, :negated, :rules, :field, :operator, :value, :additional_properties
|
11
|
+
|
12
|
+
# @param combinator [METADATA_FILTER_RULE_COMBINATOR]
|
13
|
+
# @param negated [Boolean]
|
14
|
+
# @param rules [Array<MetadataFilterRuleRequest>]
|
15
|
+
# @param field [String]
|
16
|
+
# @param operator [LOGICAL_OPERATOR]
|
17
|
+
# @param value [String]
|
18
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
# @return [MetadataFilterConfigRequest]
|
20
|
+
def initialize(combinator: nil, negated: nil, rules: nil, field: nil, operator: nil, value: nil,
|
21
|
+
additional_properties: nil)
|
22
|
+
# @type [METADATA_FILTER_RULE_COMBINATOR]
|
23
|
+
@combinator = combinator
|
24
|
+
# @type [Boolean]
|
25
|
+
@negated = negated
|
26
|
+
# @type [Array<MetadataFilterRuleRequest>]
|
27
|
+
@rules = rules
|
28
|
+
# @type [String]
|
29
|
+
@field = field
|
30
|
+
# @type [LOGICAL_OPERATOR]
|
31
|
+
@operator = operator
|
32
|
+
# @type [String]
|
33
|
+
@value = value
|
34
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
35
|
+
@additional_properties = additional_properties
|
36
|
+
end
|
37
|
+
|
38
|
+
# Deserialize a JSON object to an instance of MetadataFilterConfigRequest
|
39
|
+
#
|
40
|
+
# @param json_object [JSON]
|
41
|
+
# @return [MetadataFilterConfigRequest]
|
42
|
+
def self.from_json(json_object:)
|
43
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
44
|
+
parsed_json = JSON.parse(json_object)
|
45
|
+
combinator = METADATA_FILTER_RULE_COMBINATOR.key(parsed_json["combinator"]) || parsed_json["combinator"]
|
46
|
+
negated = struct.negated
|
47
|
+
rules = parsed_json["rules"].map do |v|
|
48
|
+
v = v.to_json
|
49
|
+
MetadataFilterRuleRequest.from_json(json_object: v)
|
50
|
+
end
|
51
|
+
field = struct.field
|
52
|
+
operator = LOGICAL_OPERATOR.key(parsed_json["operator"]) || parsed_json["operator"]
|
53
|
+
value = struct.value
|
54
|
+
new(combinator: combinator, negated: negated, rules: rules, field: field, operator: operator, value: value,
|
55
|
+
additional_properties: struct)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Serialize an instance of MetadataFilterConfigRequest to a JSON object
|
59
|
+
#
|
60
|
+
# @return [JSON]
|
61
|
+
def to_json(*_args)
|
62
|
+
{
|
63
|
+
"combinator": METADATA_FILTER_RULE_COMBINATOR[@combinator] || @combinator,
|
64
|
+
"negated": @negated,
|
65
|
+
"rules": @rules,
|
66
|
+
"field": @field,
|
67
|
+
"operator": LOGICAL_OPERATOR[@operator] || @operator,
|
68
|
+
"value": @value
|
69
|
+
}.to_json
|
70
|
+
end
|
71
|
+
|
72
|
+
# 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.
|
73
|
+
#
|
74
|
+
# @param obj [Object]
|
75
|
+
# @return [Void]
|
76
|
+
def self.validate_raw(obj:)
|
77
|
+
obj.combinator&.is_a?(METADATA_FILTER_RULE_COMBINATOR) != false || raise("Passed value for field obj.combinator is not the expected type, validation failed.")
|
78
|
+
obj.negated&.is_a?(Boolean) != false || raise("Passed value for field obj.negated is not the expected type, validation failed.")
|
79
|
+
obj.rules&.is_a?(Array) != false || raise("Passed value for field obj.rules is not the expected type, validation failed.")
|
80
|
+
obj.field&.is_a?(String) != false || raise("Passed value for field obj.field is not the expected type, validation failed.")
|
81
|
+
obj.operator&.is_a?(LOGICAL_OPERATOR) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.")
|
82
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "metadata_filter_rule_combinator"
|
4
|
+
require_relative "logical_operator"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class MetadataFilterRuleRequest
|
9
|
+
attr_reader :combinator, :negated, :rules, :field, :operator, :value, :additional_properties
|
10
|
+
|
11
|
+
# @param combinator [METADATA_FILTER_RULE_COMBINATOR]
|
12
|
+
# @param negated [Boolean]
|
13
|
+
# @param rules [Array<MetadataFilterRuleRequest>]
|
14
|
+
# @param field [String]
|
15
|
+
# @param operator [LOGICAL_OPERATOR]
|
16
|
+
# @param value [String]
|
17
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
+
# @return [MetadataFilterRuleRequest]
|
19
|
+
def initialize(combinator: nil, negated: nil, rules: nil, field: nil, operator: nil, value: nil,
|
20
|
+
additional_properties: nil)
|
21
|
+
# @type [METADATA_FILTER_RULE_COMBINATOR]
|
22
|
+
@combinator = combinator
|
23
|
+
# @type [Boolean]
|
24
|
+
@negated = negated
|
25
|
+
# @type [Array<MetadataFilterRuleRequest>]
|
26
|
+
@rules = rules
|
27
|
+
# @type [String]
|
28
|
+
@field = field
|
29
|
+
# @type [LOGICAL_OPERATOR]
|
30
|
+
@operator = operator
|
31
|
+
# @type [String]
|
32
|
+
@value = value
|
33
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
34
|
+
@additional_properties = additional_properties
|
35
|
+
end
|
36
|
+
|
37
|
+
# Deserialize a JSON object to an instance of MetadataFilterRuleRequest
|
38
|
+
#
|
39
|
+
# @param json_object [JSON]
|
40
|
+
# @return [MetadataFilterRuleRequest]
|
41
|
+
def self.from_json(json_object:)
|
42
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
43
|
+
parsed_json = JSON.parse(json_object)
|
44
|
+
combinator = METADATA_FILTER_RULE_COMBINATOR.key(parsed_json["combinator"]) || parsed_json["combinator"]
|
45
|
+
negated = struct.negated
|
46
|
+
rules = parsed_json["rules"].map do |v|
|
47
|
+
v = v.to_json
|
48
|
+
MetadataFilterRuleRequest.from_json(json_object: v)
|
49
|
+
end
|
50
|
+
field = struct.field
|
51
|
+
operator = LOGICAL_OPERATOR.key(parsed_json["operator"]) || parsed_json["operator"]
|
52
|
+
value = struct.value
|
53
|
+
new(combinator: combinator, negated: negated, rules: rules, field: field, operator: operator, value: value,
|
54
|
+
additional_properties: struct)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Serialize an instance of MetadataFilterRuleRequest to a JSON object
|
58
|
+
#
|
59
|
+
# @return [JSON]
|
60
|
+
def to_json(*_args)
|
61
|
+
{
|
62
|
+
"combinator": METADATA_FILTER_RULE_COMBINATOR[@combinator] || @combinator,
|
63
|
+
"negated": @negated,
|
64
|
+
"rules": @rules,
|
65
|
+
"field": @field,
|
66
|
+
"operator": LOGICAL_OPERATOR[@operator] || @operator,
|
67
|
+
"value": @value
|
68
|
+
}.to_json
|
69
|
+
end
|
70
|
+
|
71
|
+
# 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.
|
72
|
+
#
|
73
|
+
# @param obj [Object]
|
74
|
+
# @return [Void]
|
75
|
+
def self.validate_raw(obj:)
|
76
|
+
obj.combinator&.is_a?(METADATA_FILTER_RULE_COMBINATOR) != false || raise("Passed value for field obj.combinator is not the expected type, validation failed.")
|
77
|
+
obj.negated&.is_a?(Boolean) != false || raise("Passed value for field obj.negated is not the expected type, validation failed.")
|
78
|
+
obj.rules&.is_a?(Array) != false || raise("Passed value for field obj.rules is not the expected type, validation failed.")
|
79
|
+
obj.field&.is_a?(String) != false || raise("Passed value for field obj.field is not the expected type, validation failed.")
|
80
|
+
obj.operator&.is_a?(LOGICAL_OPERATOR) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.")
|
81
|
+
obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "model_version_sandbox_snapshot"
|
4
|
+
require "json"
|
5
|
+
|
6
|
+
module Vellum
|
7
|
+
class ModelVersionBuildConfig
|
8
|
+
attr_reader :base_model, :sandbox_snapshot, :prompt_version_id, :additional_properties
|
9
|
+
|
10
|
+
# @param base_model [String] The name of the base model used to create this model version, as identified by the LLM provider.
|
11
|
+
# @param sandbox_snapshot [ModelVersionSandboxSnapshot] Information about the sandbox snapshot that was used to create this model version, if applicable.
|
12
|
+
# @param prompt_version_id [String]
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [ModelVersionBuildConfig]
|
15
|
+
def initialize(base_model:, sandbox_snapshot: nil, prompt_version_id: nil, additional_properties: nil)
|
16
|
+
# @type [String] The name of the base model used to create this model version, as identified by the LLM provider.
|
17
|
+
@base_model = base_model
|
18
|
+
# @type [ModelVersionSandboxSnapshot] Information about the sandbox snapshot that was used to create this model version, if applicable.
|
19
|
+
@sandbox_snapshot = sandbox_snapshot
|
20
|
+
# @type [String]
|
21
|
+
@prompt_version_id = prompt_version_id
|
22
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
@additional_properties = additional_properties
|
24
|
+
end
|
25
|
+
|
26
|
+
# Deserialize a JSON object to an instance of ModelVersionBuildConfig
|
27
|
+
#
|
28
|
+
# @param json_object [JSON]
|
29
|
+
# @return [ModelVersionBuildConfig]
|
30
|
+
def self.from_json(json_object:)
|
31
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
32
|
+
parsed_json = JSON.parse(json_object)
|
33
|
+
base_model = struct.base_model
|
34
|
+
if parsed_json["sandbox_snapshot"].nil?
|
35
|
+
sandbox_snapshot = nil
|
36
|
+
else
|
37
|
+
sandbox_snapshot = parsed_json["sandbox_snapshot"].to_json
|
38
|
+
sandbox_snapshot = ModelVersionSandboxSnapshot.from_json(json_object: sandbox_snapshot)
|
39
|
+
end
|
40
|
+
prompt_version_id = struct.prompt_version_id
|
41
|
+
new(base_model: base_model, sandbox_snapshot: sandbox_snapshot, prompt_version_id: prompt_version_id,
|
42
|
+
additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of ModelVersionBuildConfig to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{
|
50
|
+
"base_model": @base_model,
|
51
|
+
"sandbox_snapshot": @sandbox_snapshot,
|
52
|
+
"prompt_version_id": @prompt_version_id
|
53
|
+
}.to_json
|
54
|
+
end
|
55
|
+
|
56
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
57
|
+
#
|
58
|
+
# @param obj [Object]
|
59
|
+
# @return [Void]
|
60
|
+
def self.validate_raw(obj:)
|
61
|
+
obj.base_model.is_a?(String) != false || raise("Passed value for field obj.base_model is not the expected type, validation failed.")
|
62
|
+
obj.sandbox_snapshot.nil? || ModelVersionSandboxSnapshot.validate_raw(obj: obj.sandbox_snapshot)
|
63
|
+
obj.prompt_version_id&.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "model_version_exec_config_parameters"
|
4
|
+
require_relative "vellum_variable"
|
5
|
+
require_relative "prompt_template_block_data"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class ModelVersionExecConfig
|
10
|
+
attr_reader :parameters, :input_variables, :prompt_template, :prompt_block_data, :prompt_syntax_version,
|
11
|
+
:additional_properties
|
12
|
+
|
13
|
+
# @param parameters [ModelVersionExecConfigParameters] The generation parameters that are passed to the LLM provider at runtime.
|
14
|
+
# @param input_variables [Array<VellumVariable>] Input variables specified in the prompt template.
|
15
|
+
# @param prompt_template [String] The template used to generate prompts for this model version.
|
16
|
+
# @param prompt_block_data [PromptTemplateBlockData]
|
17
|
+
# @param prompt_syntax_version [Integer]
|
18
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
# @return [ModelVersionExecConfig]
|
20
|
+
def initialize(parameters:, input_variables:, prompt_template: nil, prompt_block_data: nil,
|
21
|
+
prompt_syntax_version: nil, additional_properties: nil)
|
22
|
+
# @type [ModelVersionExecConfigParameters] The generation parameters that are passed to the LLM provider at runtime.
|
23
|
+
@parameters = parameters
|
24
|
+
# @type [Array<VellumVariable>] Input variables specified in the prompt template.
|
25
|
+
@input_variables = input_variables
|
26
|
+
# @type [String] The template used to generate prompts for this model version.
|
27
|
+
@prompt_template = prompt_template
|
28
|
+
# @type [PromptTemplateBlockData]
|
29
|
+
@prompt_block_data = prompt_block_data
|
30
|
+
# @type [Integer]
|
31
|
+
@prompt_syntax_version = prompt_syntax_version
|
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 ModelVersionExecConfig
|
37
|
+
#
|
38
|
+
# @param json_object [JSON]
|
39
|
+
# @return [ModelVersionExecConfig]
|
40
|
+
def self.from_json(json_object:)
|
41
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
42
|
+
parsed_json = JSON.parse(json_object)
|
43
|
+
if parsed_json["parameters"].nil?
|
44
|
+
parameters = nil
|
45
|
+
else
|
46
|
+
parameters = parsed_json["parameters"].to_json
|
47
|
+
parameters = ModelVersionExecConfigParameters.from_json(json_object: parameters)
|
48
|
+
end
|
49
|
+
input_variables = parsed_json["input_variables"].map do |v|
|
50
|
+
v = v.to_json
|
51
|
+
VellumVariable.from_json(json_object: v)
|
52
|
+
end
|
53
|
+
prompt_template = struct.prompt_template
|
54
|
+
if parsed_json["prompt_block_data"].nil?
|
55
|
+
prompt_block_data = nil
|
56
|
+
else
|
57
|
+
prompt_block_data = parsed_json["prompt_block_data"].to_json
|
58
|
+
prompt_block_data = PromptTemplateBlockData.from_json(json_object: prompt_block_data)
|
59
|
+
end
|
60
|
+
prompt_syntax_version = struct.prompt_syntax_version
|
61
|
+
new(parameters: parameters, input_variables: input_variables, prompt_template: prompt_template,
|
62
|
+
prompt_block_data: prompt_block_data, prompt_syntax_version: prompt_syntax_version, additional_properties: struct)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Serialize an instance of ModelVersionExecConfig to a JSON object
|
66
|
+
#
|
67
|
+
# @return [JSON]
|
68
|
+
def to_json(*_args)
|
69
|
+
{
|
70
|
+
"parameters": @parameters,
|
71
|
+
"input_variables": @input_variables,
|
72
|
+
"prompt_template": @prompt_template,
|
73
|
+
"prompt_block_data": @prompt_block_data,
|
74
|
+
"prompt_syntax_version": @prompt_syntax_version
|
75
|
+
}.to_json
|
76
|
+
end
|
77
|
+
|
78
|
+
# 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.
|
79
|
+
#
|
80
|
+
# @param obj [Object]
|
81
|
+
# @return [Void]
|
82
|
+
def self.validate_raw(obj:)
|
83
|
+
ModelVersionExecConfigParameters.validate_raw(obj: obj.parameters)
|
84
|
+
obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.")
|
85
|
+
obj.prompt_template&.is_a?(String) != false || raise("Passed value for field obj.prompt_template is not the expected type, validation failed.")
|
86
|
+
obj.prompt_block_data.nil? || PromptTemplateBlockData.validate_raw(obj: obj.prompt_block_data)
|
87
|
+
obj.prompt_syntax_version&.is_a?(Integer) != false || raise("Passed value for field obj.prompt_syntax_version is not the expected type, validation failed.")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class ModelVersionExecConfigParameters
|
7
|
+
attr_reader :temperature, :max_tokens, :top_p, :frequency_penalty, :presence_penalty, :logit_bias, :stop, :top_k,
|
8
|
+
:custom_parameters, :additional_properties
|
9
|
+
|
10
|
+
# @param temperature [Float]
|
11
|
+
# @param max_tokens [Integer]
|
12
|
+
# @param top_p [Float]
|
13
|
+
# @param frequency_penalty [Float]
|
14
|
+
# @param presence_penalty [Float]
|
15
|
+
# @param logit_bias [Hash{String => String}]
|
16
|
+
# @param stop [Array<String>]
|
17
|
+
# @param top_k [Float]
|
18
|
+
# @param custom_parameters [Hash{String => String}]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [ModelVersionExecConfigParameters]
|
21
|
+
def initialize(top_p:, frequency_penalty:, presence_penalty:, temperature: nil, max_tokens: nil, logit_bias: nil,
|
22
|
+
stop: nil, top_k: nil, custom_parameters: nil, additional_properties: nil)
|
23
|
+
# @type [Float]
|
24
|
+
@temperature = temperature
|
25
|
+
# @type [Integer]
|
26
|
+
@max_tokens = max_tokens
|
27
|
+
# @type [Float]
|
28
|
+
@top_p = top_p
|
29
|
+
# @type [Float]
|
30
|
+
@frequency_penalty = frequency_penalty
|
31
|
+
# @type [Float]
|
32
|
+
@presence_penalty = presence_penalty
|
33
|
+
# @type [Hash{String => String}]
|
34
|
+
@logit_bias = logit_bias
|
35
|
+
# @type [Array<String>]
|
36
|
+
@stop = stop
|
37
|
+
# @type [Float]
|
38
|
+
@top_k = top_k
|
39
|
+
# @type [Hash{String => String}]
|
40
|
+
@custom_parameters = custom_parameters
|
41
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
42
|
+
@additional_properties = additional_properties
|
43
|
+
end
|
44
|
+
|
45
|
+
# Deserialize a JSON object to an instance of ModelVersionExecConfigParameters
|
46
|
+
#
|
47
|
+
# @param json_object [JSON]
|
48
|
+
# @return [ModelVersionExecConfigParameters]
|
49
|
+
def self.from_json(json_object:)
|
50
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
51
|
+
JSON.parse(json_object)
|
52
|
+
temperature = struct.temperature
|
53
|
+
max_tokens = struct.max_tokens
|
54
|
+
top_p = struct.top_p
|
55
|
+
frequency_penalty = struct.frequency_penalty
|
56
|
+
presence_penalty = struct.presence_penalty
|
57
|
+
logit_bias = struct.logit_bias
|
58
|
+
stop = struct.stop
|
59
|
+
top_k = struct.top_k
|
60
|
+
custom_parameters = struct.custom_parameters
|
61
|
+
new(temperature: temperature, max_tokens: max_tokens, top_p: top_p, frequency_penalty: frequency_penalty,
|
62
|
+
presence_penalty: presence_penalty, logit_bias: logit_bias, stop: stop, top_k: top_k, custom_parameters: custom_parameters, additional_properties: struct)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Serialize an instance of ModelVersionExecConfigParameters to a JSON object
|
66
|
+
#
|
67
|
+
# @return [JSON]
|
68
|
+
def to_json(*_args)
|
69
|
+
{
|
70
|
+
"temperature": @temperature,
|
71
|
+
"max_tokens": @max_tokens,
|
72
|
+
"top_p": @top_p,
|
73
|
+
"frequency_penalty": @frequency_penalty,
|
74
|
+
"presence_penalty": @presence_penalty,
|
75
|
+
"logit_bias": @logit_bias,
|
76
|
+
"stop": @stop,
|
77
|
+
"top_k": @top_k,
|
78
|
+
"custom_parameters": @custom_parameters
|
79
|
+
}.to_json
|
80
|
+
end
|
81
|
+
|
82
|
+
# 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.
|
83
|
+
#
|
84
|
+
# @param obj [Object]
|
85
|
+
# @return [Void]
|
86
|
+
def self.validate_raw(obj:)
|
87
|
+
obj.temperature&.is_a?(Float) != false || raise("Passed value for field obj.temperature is not the expected type, validation failed.")
|
88
|
+
obj.max_tokens&.is_a?(Integer) != false || raise("Passed value for field obj.max_tokens is not the expected type, validation failed.")
|
89
|
+
obj.top_p.is_a?(Float) != false || raise("Passed value for field obj.top_p is not the expected type, validation failed.")
|
90
|
+
obj.frequency_penalty.is_a?(Float) != false || raise("Passed value for field obj.frequency_penalty is not the expected type, validation failed.")
|
91
|
+
obj.presence_penalty.is_a?(Float) != false || raise("Passed value for field obj.presence_penalty is not the expected type, validation failed.")
|
92
|
+
obj.logit_bias&.is_a?(Hash) != false || raise("Passed value for field obj.logit_bias is not the expected type, validation failed.")
|
93
|
+
obj.stop&.is_a?(Array) != false || raise("Passed value for field obj.stop is not the expected type, validation failed.")
|
94
|
+
obj.top_k&.is_a?(Float) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.")
|
95
|
+
obj.custom_parameters&.is_a?(Hash) != false || raise("Passed value for field obj.custom_parameters is not the expected type, validation failed.")
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|