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,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_message_role"
|
4
|
+
require_relative "vellum_variable_type"
|
5
|
+
require_relative "prompt_template_block"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class PromptTemplateBlockProperties
|
10
|
+
attr_reader :chat_role, :chat_message_unterminated, :template, :template_type, :function_name,
|
11
|
+
:function_description, :function_parameters, :function_forced, :blocks, :additional_properties
|
12
|
+
|
13
|
+
# @param chat_role [CHAT_MESSAGE_ROLE]
|
14
|
+
# @param chat_message_unterminated [Boolean]
|
15
|
+
# @param template [String]
|
16
|
+
# @param template_type [VELLUM_VARIABLE_TYPE]
|
17
|
+
# @param function_name [String]
|
18
|
+
# @param function_description [String]
|
19
|
+
# @param function_parameters [Hash{String => String}]
|
20
|
+
# @param function_forced [Boolean]
|
21
|
+
# @param blocks [Array<PromptTemplateBlock>]
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
# @return [PromptTemplateBlockProperties]
|
24
|
+
def initialize(chat_role: nil, chat_message_unterminated: nil, template: nil, template_type: nil,
|
25
|
+
function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil)
|
26
|
+
# @type [CHAT_MESSAGE_ROLE]
|
27
|
+
@chat_role = chat_role
|
28
|
+
# @type [Boolean]
|
29
|
+
@chat_message_unterminated = chat_message_unterminated
|
30
|
+
# @type [String]
|
31
|
+
@template = template
|
32
|
+
# @type [VELLUM_VARIABLE_TYPE]
|
33
|
+
@template_type = template_type
|
34
|
+
# @type [String]
|
35
|
+
@function_name = function_name
|
36
|
+
# @type [String]
|
37
|
+
@function_description = function_description
|
38
|
+
# @type [Hash{String => String}]
|
39
|
+
@function_parameters = function_parameters
|
40
|
+
# @type [Boolean]
|
41
|
+
@function_forced = function_forced
|
42
|
+
# @type [Array<PromptTemplateBlock>]
|
43
|
+
@blocks = blocks
|
44
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
45
|
+
@additional_properties = additional_properties
|
46
|
+
end
|
47
|
+
|
48
|
+
# Deserialize a JSON object to an instance of PromptTemplateBlockProperties
|
49
|
+
#
|
50
|
+
# @param json_object [JSON]
|
51
|
+
# @return [PromptTemplateBlockProperties]
|
52
|
+
def self.from_json(json_object:)
|
53
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
54
|
+
parsed_json = JSON.parse(json_object)
|
55
|
+
chat_role = CHAT_MESSAGE_ROLE.key(parsed_json["chat_role"]) || parsed_json["chat_role"]
|
56
|
+
chat_message_unterminated = struct.chat_message_unterminated
|
57
|
+
template = struct.template
|
58
|
+
template_type = VELLUM_VARIABLE_TYPE.key(parsed_json["template_type"]) || parsed_json["template_type"]
|
59
|
+
function_name = struct.function_name
|
60
|
+
function_description = struct.function_description
|
61
|
+
function_parameters = struct.function_parameters
|
62
|
+
function_forced = struct.function_forced
|
63
|
+
blocks = parsed_json["blocks"].map do |v|
|
64
|
+
v = v.to_json
|
65
|
+
PromptTemplateBlock.from_json(json_object: v)
|
66
|
+
end
|
67
|
+
new(chat_role: chat_role, chat_message_unterminated: chat_message_unterminated, template: template,
|
68
|
+
template_type: template_type, function_name: function_name, function_description: function_description, function_parameters: function_parameters, function_forced: function_forced, blocks: blocks, additional_properties: struct)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Serialize an instance of PromptTemplateBlockProperties to a JSON object
|
72
|
+
#
|
73
|
+
# @return [JSON]
|
74
|
+
def to_json(*_args)
|
75
|
+
{
|
76
|
+
"chat_role": CHAT_MESSAGE_ROLE[@chat_role] || @chat_role,
|
77
|
+
"chat_message_unterminated": @chat_message_unterminated,
|
78
|
+
"template": @template,
|
79
|
+
"template_type": VELLUM_VARIABLE_TYPE[@template_type] || @template_type,
|
80
|
+
"function_name": @function_name,
|
81
|
+
"function_description": @function_description,
|
82
|
+
"function_parameters": @function_parameters,
|
83
|
+
"function_forced": @function_forced,
|
84
|
+
"blocks": @blocks
|
85
|
+
}.to_json
|
86
|
+
end
|
87
|
+
|
88
|
+
# 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.
|
89
|
+
#
|
90
|
+
# @param obj [Object]
|
91
|
+
# @return [Void]
|
92
|
+
def self.validate_raw(obj:)
|
93
|
+
obj.chat_role&.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.chat_role is not the expected type, validation failed.")
|
94
|
+
obj.chat_message_unterminated&.is_a?(Boolean) != false || raise("Passed value for field obj.chat_message_unterminated is not the expected type, validation failed.")
|
95
|
+
obj.template&.is_a?(String) != false || raise("Passed value for field obj.template is not the expected type, validation failed.")
|
96
|
+
obj.template_type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.template_type is not the expected type, validation failed.")
|
97
|
+
obj.function_name&.is_a?(String) != false || raise("Passed value for field obj.function_name is not the expected type, validation failed.")
|
98
|
+
obj.function_description&.is_a?(String) != false || raise("Passed value for field obj.function_description is not the expected type, validation failed.")
|
99
|
+
obj.function_parameters&.is_a?(Hash) != false || raise("Passed value for field obj.function_parameters is not the expected type, validation failed.")
|
100
|
+
obj.function_forced&.is_a?(Boolean) != false || raise("Passed value for field obj.function_forced is not the expected type, validation failed.")
|
101
|
+
obj.blocks&.is_a?(Array) != false || raise("Passed value for field obj.blocks is not the expected type, validation failed.")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "chat_message_role"
|
4
|
+
require_relative "vellum_variable_type"
|
5
|
+
require_relative "prompt_template_block_request"
|
6
|
+
require "json"
|
7
|
+
|
8
|
+
module Vellum
|
9
|
+
class PromptTemplateBlockPropertiesRequest
|
10
|
+
attr_reader :chat_role, :chat_message_unterminated, :template, :template_type, :function_name,
|
11
|
+
:function_description, :function_parameters, :function_forced, :blocks, :additional_properties
|
12
|
+
|
13
|
+
# @param chat_role [CHAT_MESSAGE_ROLE]
|
14
|
+
# @param chat_message_unterminated [Boolean]
|
15
|
+
# @param template [String]
|
16
|
+
# @param template_type [VELLUM_VARIABLE_TYPE]
|
17
|
+
# @param function_name [String]
|
18
|
+
# @param function_description [String]
|
19
|
+
# @param function_parameters [Hash{String => String}]
|
20
|
+
# @param function_forced [Boolean]
|
21
|
+
# @param blocks [Array<PromptTemplateBlockRequest>]
|
22
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
23
|
+
# @return [PromptTemplateBlockPropertiesRequest]
|
24
|
+
def initialize(chat_role: nil, chat_message_unterminated: nil, template: nil, template_type: nil,
|
25
|
+
function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil)
|
26
|
+
# @type [CHAT_MESSAGE_ROLE]
|
27
|
+
@chat_role = chat_role
|
28
|
+
# @type [Boolean]
|
29
|
+
@chat_message_unterminated = chat_message_unterminated
|
30
|
+
# @type [String]
|
31
|
+
@template = template
|
32
|
+
# @type [VELLUM_VARIABLE_TYPE]
|
33
|
+
@template_type = template_type
|
34
|
+
# @type [String]
|
35
|
+
@function_name = function_name
|
36
|
+
# @type [String]
|
37
|
+
@function_description = function_description
|
38
|
+
# @type [Hash{String => String}]
|
39
|
+
@function_parameters = function_parameters
|
40
|
+
# @type [Boolean]
|
41
|
+
@function_forced = function_forced
|
42
|
+
# @type [Array<PromptTemplateBlockRequest>]
|
43
|
+
@blocks = blocks
|
44
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
45
|
+
@additional_properties = additional_properties
|
46
|
+
end
|
47
|
+
|
48
|
+
# Deserialize a JSON object to an instance of PromptTemplateBlockPropertiesRequest
|
49
|
+
#
|
50
|
+
# @param json_object [JSON]
|
51
|
+
# @return [PromptTemplateBlockPropertiesRequest]
|
52
|
+
def self.from_json(json_object:)
|
53
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
54
|
+
parsed_json = JSON.parse(json_object)
|
55
|
+
chat_role = CHAT_MESSAGE_ROLE.key(parsed_json["chat_role"]) || parsed_json["chat_role"]
|
56
|
+
chat_message_unterminated = struct.chat_message_unterminated
|
57
|
+
template = struct.template
|
58
|
+
template_type = VELLUM_VARIABLE_TYPE.key(parsed_json["template_type"]) || parsed_json["template_type"]
|
59
|
+
function_name = struct.function_name
|
60
|
+
function_description = struct.function_description
|
61
|
+
function_parameters = struct.function_parameters
|
62
|
+
function_forced = struct.function_forced
|
63
|
+
blocks = parsed_json["blocks"].map do |v|
|
64
|
+
v = v.to_json
|
65
|
+
PromptTemplateBlockRequest.from_json(json_object: v)
|
66
|
+
end
|
67
|
+
new(chat_role: chat_role, chat_message_unterminated: chat_message_unterminated, template: template,
|
68
|
+
template_type: template_type, function_name: function_name, function_description: function_description, function_parameters: function_parameters, function_forced: function_forced, blocks: blocks, additional_properties: struct)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Serialize an instance of PromptTemplateBlockPropertiesRequest to a JSON object
|
72
|
+
#
|
73
|
+
# @return [JSON]
|
74
|
+
def to_json(*_args)
|
75
|
+
{
|
76
|
+
"chat_role": CHAT_MESSAGE_ROLE[@chat_role] || @chat_role,
|
77
|
+
"chat_message_unterminated": @chat_message_unterminated,
|
78
|
+
"template": @template,
|
79
|
+
"template_type": VELLUM_VARIABLE_TYPE[@template_type] || @template_type,
|
80
|
+
"function_name": @function_name,
|
81
|
+
"function_description": @function_description,
|
82
|
+
"function_parameters": @function_parameters,
|
83
|
+
"function_forced": @function_forced,
|
84
|
+
"blocks": @blocks
|
85
|
+
}.to_json
|
86
|
+
end
|
87
|
+
|
88
|
+
# 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.
|
89
|
+
#
|
90
|
+
# @param obj [Object]
|
91
|
+
# @return [Void]
|
92
|
+
def self.validate_raw(obj:)
|
93
|
+
obj.chat_role&.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.chat_role is not the expected type, validation failed.")
|
94
|
+
obj.chat_message_unterminated&.is_a?(Boolean) != false || raise("Passed value for field obj.chat_message_unterminated is not the expected type, validation failed.")
|
95
|
+
obj.template&.is_a?(String) != false || raise("Passed value for field obj.template is not the expected type, validation failed.")
|
96
|
+
obj.template_type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.template_type is not the expected type, validation failed.")
|
97
|
+
obj.function_name&.is_a?(String) != false || raise("Passed value for field obj.function_name is not the expected type, validation failed.")
|
98
|
+
obj.function_description&.is_a?(String) != false || raise("Passed value for field obj.function_description is not the expected type, validation failed.")
|
99
|
+
obj.function_parameters&.is_a?(Hash) != false || raise("Passed value for field obj.function_parameters is not the expected type, validation failed.")
|
100
|
+
obj.function_forced&.is_a?(Boolean) != false || raise("Passed value for field obj.function_forced is not the expected type, validation failed.")
|
101
|
+
obj.blocks&.is_a?(Array) != false || raise("Passed value for field obj.blocks is not the expected type, validation failed.")
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "block_type_enum"
|
4
|
+
require_relative "prompt_template_block_properties_request"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class PromptTemplateBlockRequest
|
9
|
+
attr_reader :id, :block_type, :properties, :additional_properties
|
10
|
+
|
11
|
+
# @param id [String]
|
12
|
+
# @param block_type [BLOCK_TYPE_ENUM]
|
13
|
+
# @param properties [PromptTemplateBlockPropertiesRequest]
|
14
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
15
|
+
# @return [PromptTemplateBlockRequest]
|
16
|
+
def initialize(id:, block_type:, properties:, additional_properties: nil)
|
17
|
+
# @type [String]
|
18
|
+
@id = id
|
19
|
+
# @type [BLOCK_TYPE_ENUM]
|
20
|
+
@block_type = block_type
|
21
|
+
# @type [PromptTemplateBlockPropertiesRequest]
|
22
|
+
@properties = properties
|
23
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
24
|
+
@additional_properties = additional_properties
|
25
|
+
end
|
26
|
+
|
27
|
+
# Deserialize a JSON object to an instance of PromptTemplateBlockRequest
|
28
|
+
#
|
29
|
+
# @param json_object [JSON]
|
30
|
+
# @return [PromptTemplateBlockRequest]
|
31
|
+
def self.from_json(json_object:)
|
32
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
33
|
+
parsed_json = JSON.parse(json_object)
|
34
|
+
id = struct.id
|
35
|
+
block_type = BLOCK_TYPE_ENUM.key(parsed_json["block_type"]) || parsed_json["block_type"]
|
36
|
+
if parsed_json["properties"].nil?
|
37
|
+
properties = nil
|
38
|
+
else
|
39
|
+
properties = parsed_json["properties"].to_json
|
40
|
+
properties = PromptTemplateBlockPropertiesRequest.from_json(json_object: properties)
|
41
|
+
end
|
42
|
+
new(id: id, block_type: block_type, properties: properties, additional_properties: struct)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Serialize an instance of PromptTemplateBlockRequest to a JSON object
|
46
|
+
#
|
47
|
+
# @return [JSON]
|
48
|
+
def to_json(*_args)
|
49
|
+
{ "id": @id, "block_type": BLOCK_TYPE_ENUM[@block_type] || @block_type, "properties": @properties }.to_json
|
50
|
+
end
|
51
|
+
|
52
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
53
|
+
#
|
54
|
+
# @param obj [Object]
|
55
|
+
# @return [Void]
|
56
|
+
def self.validate_raw(obj:)
|
57
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
58
|
+
obj.block_type.is_a?(BLOCK_TYPE_ENUM) != false || raise("Passed value for field obj.block_type is not the expected type, validation failed.")
|
59
|
+
PromptTemplateBlockPropertiesRequest.validate_raw(obj: obj.properties)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vellum
|
4
|
+
# @type [PROVIDER_ENUM]
|
5
|
+
PROVIDER_ENUM = {
|
6
|
+
anthropic: "ANTHROPIC",
|
7
|
+
aws_bedrock: "AWS_BEDROCK",
|
8
|
+
azure_openai: "AZURE_OPENAI",
|
9
|
+
cohere: "COHERE",
|
10
|
+
google: "GOOGLE",
|
11
|
+
hosted: "HOSTED",
|
12
|
+
mosaicml: "MOSAICML",
|
13
|
+
openai: "OPENAI",
|
14
|
+
fireworks_ai: "FIREWORKS_AI",
|
15
|
+
huggingface: "HUGGINGFACE",
|
16
|
+
mystic: "MYSTIC",
|
17
|
+
pyq: "PYQ",
|
18
|
+
replicate: "REPLICATE"
|
19
|
+
}.freeze
|
20
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RawPromptExecutionOverridesRequest
|
7
|
+
attr_reader :body, :headers, :url, :additional_properties
|
8
|
+
|
9
|
+
# @param body [Hash{String => String}]
|
10
|
+
# @param headers [Hash{String => String}] The raw headers to send to the model host.
|
11
|
+
# @param url [String] The raw URL to send to the model host.
|
12
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
13
|
+
# @return [RawPromptExecutionOverridesRequest]
|
14
|
+
def initialize(body: nil, headers: nil, url: nil, additional_properties: nil)
|
15
|
+
# @type [Hash{String => String}]
|
16
|
+
@body = body
|
17
|
+
# @type [Hash{String => String}] The raw headers to send to the model host.
|
18
|
+
@headers = headers
|
19
|
+
# @type [String] The raw URL to send to the model host.
|
20
|
+
@url = url
|
21
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
22
|
+
@additional_properties = additional_properties
|
23
|
+
end
|
24
|
+
|
25
|
+
# Deserialize a JSON object to an instance of RawPromptExecutionOverridesRequest
|
26
|
+
#
|
27
|
+
# @param json_object [JSON]
|
28
|
+
# @return [RawPromptExecutionOverridesRequest]
|
29
|
+
def self.from_json(json_object:)
|
30
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
31
|
+
JSON.parse(json_object)
|
32
|
+
body = struct.body
|
33
|
+
headers = struct.headers
|
34
|
+
url = struct.url
|
35
|
+
new(body: body, headers: headers, url: url, additional_properties: struct)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Serialize an instance of RawPromptExecutionOverridesRequest to a JSON object
|
39
|
+
#
|
40
|
+
# @return [JSON]
|
41
|
+
def to_json(*_args)
|
42
|
+
{ "body": @body, "headers": @headers, "url": @url }.to_json
|
43
|
+
end
|
44
|
+
|
45
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
46
|
+
#
|
47
|
+
# @param obj [Object]
|
48
|
+
# @return [Void]
|
49
|
+
def self.validate_raw(obj:)
|
50
|
+
obj.body&.is_a?(Hash) != false || raise("Passed value for field obj.body is not the expected type, validation failed.")
|
51
|
+
obj.headers&.is_a?(Hash) != false || raise("Passed value for field obj.headers is not the expected type, validation failed.")
|
52
|
+
obj.url&.is_a?(String) != false || raise("Passed value for field obj.url is not the expected type, validation failed.")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisterPromptErrorResponse
|
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 [RegisterPromptErrorResponse]
|
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 RegisterPromptErrorResponse
|
20
|
+
#
|
21
|
+
# @param json_object [JSON]
|
22
|
+
# @return [RegisterPromptErrorResponse]
|
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 RegisterPromptErrorResponse 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,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisterPromptModelParametersRequest
|
7
|
+
attr_reader :temperature, :max_tokens, :stop, :top_p, :top_k, :frequency_penalty, :presence_penalty, :logit_bias,
|
8
|
+
:custom_parameters, :additional_properties
|
9
|
+
|
10
|
+
# @param temperature [Float]
|
11
|
+
# @param max_tokens [Integer]
|
12
|
+
# @param stop [Array<String>]
|
13
|
+
# @param top_p [Float]
|
14
|
+
# @param top_k [Integer]
|
15
|
+
# @param frequency_penalty [Float]
|
16
|
+
# @param presence_penalty [Float]
|
17
|
+
# @param logit_bias [Hash{String => String}]
|
18
|
+
# @param custom_parameters [Hash{String => String}]
|
19
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
20
|
+
# @return [RegisterPromptModelParametersRequest]
|
21
|
+
def initialize(temperature:, max_tokens:, top_p:, frequency_penalty:, presence_penalty:, stop: nil, top_k: nil,
|
22
|
+
logit_bias: nil, custom_parameters: nil, additional_properties: nil)
|
23
|
+
# @type [Float]
|
24
|
+
@temperature = temperature
|
25
|
+
# @type [Integer]
|
26
|
+
@max_tokens = max_tokens
|
27
|
+
# @type [Array<String>]
|
28
|
+
@stop = stop
|
29
|
+
# @type [Float]
|
30
|
+
@top_p = top_p
|
31
|
+
# @type [Integer]
|
32
|
+
@top_k = top_k
|
33
|
+
# @type [Float]
|
34
|
+
@frequency_penalty = frequency_penalty
|
35
|
+
# @type [Float]
|
36
|
+
@presence_penalty = presence_penalty
|
37
|
+
# @type [Hash{String => String}]
|
38
|
+
@logit_bias = logit_bias
|
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 RegisterPromptModelParametersRequest
|
46
|
+
#
|
47
|
+
# @param json_object [JSON]
|
48
|
+
# @return [RegisterPromptModelParametersRequest]
|
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
|
+
stop = struct.stop
|
55
|
+
top_p = struct.top_p
|
56
|
+
top_k = struct.top_k
|
57
|
+
frequency_penalty = struct.frequency_penalty
|
58
|
+
presence_penalty = struct.presence_penalty
|
59
|
+
logit_bias = struct.logit_bias
|
60
|
+
custom_parameters = struct.custom_parameters
|
61
|
+
new(temperature: temperature, max_tokens: max_tokens, stop: stop, top_p: top_p, top_k: top_k,
|
62
|
+
frequency_penalty: frequency_penalty, presence_penalty: presence_penalty, logit_bias: logit_bias, custom_parameters: custom_parameters, additional_properties: struct)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Serialize an instance of RegisterPromptModelParametersRequest to a JSON object
|
66
|
+
#
|
67
|
+
# @return [JSON]
|
68
|
+
def to_json(*_args)
|
69
|
+
{
|
70
|
+
"temperature": @temperature,
|
71
|
+
"max_tokens": @max_tokens,
|
72
|
+
"stop": @stop,
|
73
|
+
"top_p": @top_p,
|
74
|
+
"top_k": @top_k,
|
75
|
+
"frequency_penalty": @frequency_penalty,
|
76
|
+
"presence_penalty": @presence_penalty,
|
77
|
+
"logit_bias": @logit_bias,
|
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.stop&.is_a?(Array) != false || raise("Passed value for field obj.stop is not the expected type, validation failed.")
|
90
|
+
obj.top_p.is_a?(Float) != false || raise("Passed value for field obj.top_p is not the expected type, validation failed.")
|
91
|
+
obj.top_k&.is_a?(Integer) != false || raise("Passed value for field obj.top_k is not the expected type, validation failed.")
|
92
|
+
obj.frequency_penalty.is_a?(Float) != false || raise("Passed value for field obj.frequency_penalty is not the expected type, validation failed.")
|
93
|
+
obj.presence_penalty.is_a?(Float) != false || raise("Passed value for field obj.presence_penalty is not the expected type, validation failed.")
|
94
|
+
obj.logit_bias&.is_a?(Hash) != false || raise("Passed value for field obj.logit_bias 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
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
|
5
|
+
module Vellum
|
6
|
+
class RegisterPromptPrompt
|
7
|
+
attr_reader :id, :label, :additional_properties
|
8
|
+
|
9
|
+
# @param id [String] The ID of the generated prompt.
|
10
|
+
# @param label [String] A human-friendly label for the generated prompt.
|
11
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
12
|
+
# @return [RegisterPromptPrompt]
|
13
|
+
def initialize(id:, label:, additional_properties: nil)
|
14
|
+
# @type [String] The ID of the generated prompt.
|
15
|
+
@id = id
|
16
|
+
# @type [String] A human-friendly label for the generated prompt.
|
17
|
+
@label = label
|
18
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
19
|
+
@additional_properties = additional_properties
|
20
|
+
end
|
21
|
+
|
22
|
+
# Deserialize a JSON object to an instance of RegisterPromptPrompt
|
23
|
+
#
|
24
|
+
# @param json_object [JSON]
|
25
|
+
# @return [RegisterPromptPrompt]
|
26
|
+
def self.from_json(json_object:)
|
27
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
28
|
+
JSON.parse(json_object)
|
29
|
+
id = struct.id
|
30
|
+
label = struct.label
|
31
|
+
new(id: id, label: label, additional_properties: struct)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Serialize an instance of RegisterPromptPrompt to a JSON object
|
35
|
+
#
|
36
|
+
# @return [JSON]
|
37
|
+
def to_json(*_args)
|
38
|
+
{ "id": @id, "label": @label }.to_json
|
39
|
+
end
|
40
|
+
|
41
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
42
|
+
#
|
43
|
+
# @param obj [Object]
|
44
|
+
# @return [Void]
|
45
|
+
def self.validate_raw(obj:)
|
46
|
+
obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
|
47
|
+
obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "prompt_template_block_data_request"
|
4
|
+
require_relative "registered_prompt_input_variable_request"
|
5
|
+
require "json"
|
6
|
+
|
7
|
+
module Vellum
|
8
|
+
class RegisterPromptPromptInfoRequest
|
9
|
+
attr_reader :prompt_block_data, :input_variables, :additional_properties
|
10
|
+
|
11
|
+
# @param prompt_block_data [PromptTemplateBlockDataRequest]
|
12
|
+
# @param input_variables [Array<RegisteredPromptInputVariableRequest>] The input variables specified in the prompt template.
|
13
|
+
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
14
|
+
# @return [RegisterPromptPromptInfoRequest]
|
15
|
+
def initialize(prompt_block_data:, input_variables:, additional_properties: nil)
|
16
|
+
# @type [PromptTemplateBlockDataRequest]
|
17
|
+
@prompt_block_data = prompt_block_data
|
18
|
+
# @type [Array<RegisteredPromptInputVariableRequest>] The input variables specified in the prompt template.
|
19
|
+
@input_variables = input_variables
|
20
|
+
# @type [OpenStruct] Additional properties unmapped to the current class definition
|
21
|
+
@additional_properties = additional_properties
|
22
|
+
end
|
23
|
+
|
24
|
+
# Deserialize a JSON object to an instance of RegisterPromptPromptInfoRequest
|
25
|
+
#
|
26
|
+
# @param json_object [JSON]
|
27
|
+
# @return [RegisterPromptPromptInfoRequest]
|
28
|
+
def self.from_json(json_object:)
|
29
|
+
struct = JSON.parse(json_object, object_class: OpenStruct)
|
30
|
+
parsed_json = JSON.parse(json_object)
|
31
|
+
if parsed_json["prompt_block_data"].nil?
|
32
|
+
prompt_block_data = nil
|
33
|
+
else
|
34
|
+
prompt_block_data = parsed_json["prompt_block_data"].to_json
|
35
|
+
prompt_block_data = PromptTemplateBlockDataRequest.from_json(json_object: prompt_block_data)
|
36
|
+
end
|
37
|
+
input_variables = parsed_json["input_variables"].map do |v|
|
38
|
+
v = v.to_json
|
39
|
+
RegisteredPromptInputVariableRequest.from_json(json_object: v)
|
40
|
+
end
|
41
|
+
new(prompt_block_data: prompt_block_data, input_variables: input_variables, additional_properties: struct)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Serialize an instance of RegisterPromptPromptInfoRequest to a JSON object
|
45
|
+
#
|
46
|
+
# @return [JSON]
|
47
|
+
def to_json(*_args)
|
48
|
+
{ "prompt_block_data": @prompt_block_data, "input_variables": @input_variables }.to_json
|
49
|
+
end
|
50
|
+
|
51
|
+
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
|
52
|
+
#
|
53
|
+
# @param obj [Object]
|
54
|
+
# @return [Void]
|
55
|
+
def self.validate_raw(obj:)
|
56
|
+
PromptTemplateBlockDataRequest.validate_raw(obj: obj.prompt_block_data)
|
57
|
+
obj.input_variables.is_a?(Array) != false || raise("Passed value for field obj.input_variables is not the expected type, validation failed.")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|