Class: Vellum::PromptTemplateBlockPropertiesRequest
- Inherits:
-
Object
- Object
- Vellum::PromptTemplateBlockPropertiesRequest
- Defined in:
- lib/vellum_ai/types/prompt_template_block_properties_request.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#blocks ⇒ Object
readonly
Returns the value of attribute blocks.
-
#chat_message_unterminated ⇒ Object
readonly
Returns the value of attribute chat_message_unterminated.
-
#chat_role ⇒ Object
readonly
Returns the value of attribute chat_role.
-
#chat_source ⇒ Object
readonly
Returns the value of attribute chat_source.
-
#function_description ⇒ Object
readonly
Returns the value of attribute function_description.
-
#function_forced ⇒ Object
readonly
Returns the value of attribute function_forced.
-
#function_name ⇒ Object
readonly
Returns the value of attribute function_name.
-
#function_parameters ⇒ Object
readonly
Returns the value of attribute function_parameters.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#template_type ⇒ Object
readonly
Returns the value of attribute template_type.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ PromptTemplateBlockPropertiesRequest
Deserialize a JSON object to an instance of PromptTemplateBlockPropertiesRequest.
-
.validate_raw(obj:) ⇒ Void
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.
Instance Method Summary collapse
- #initialize(chat_role: nil, chat_message_unterminated: nil, chat_source: nil, template: nil, template_type: nil, function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil) ⇒ PromptTemplateBlockPropertiesRequest constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of PromptTemplateBlockPropertiesRequest to a JSON object.
Constructor Details
#initialize(chat_role: nil, chat_message_unterminated: nil, chat_source: nil, template: nil, template_type: nil, function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil) ⇒ PromptTemplateBlockPropertiesRequest
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 25 def initialize(chat_role: nil, chat_message_unterminated: nil, chat_source: nil, template: nil, template_type: nil, function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil) # @type [CHAT_MESSAGE_ROLE] @chat_role = chat_role # @type [Boolean] @chat_message_unterminated = # @type [String] @chat_source = chat_source # @type [String] @template = template # @type [VELLUM_VARIABLE_TYPE] @template_type = template_type # @type [String] @function_name = function_name # @type [String] @function_description = function_description # @type [Hash{String => String}] @function_parameters = function_parameters # @type [Boolean] @function_forced = function_forced # @type [Array<PromptTemplateBlockRequest>] @blocks = blocks # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def additional_properties @additional_properties end |
#blocks ⇒ Object (readonly)
Returns the value of attribute blocks.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def blocks @blocks end |
#chat_message_unterminated ⇒ Object (readonly)
Returns the value of attribute chat_message_unterminated.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def @chat_message_unterminated end |
#chat_role ⇒ Object (readonly)
Returns the value of attribute chat_role.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def chat_role @chat_role end |
#chat_source ⇒ Object (readonly)
Returns the value of attribute chat_source.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def chat_source @chat_source end |
#function_description ⇒ Object (readonly)
Returns the value of attribute function_description.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def function_description @function_description end |
#function_forced ⇒ Object (readonly)
Returns the value of attribute function_forced.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def function_forced @function_forced end |
#function_name ⇒ Object (readonly)
Returns the value of attribute function_name.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def function_name @function_name end |
#function_parameters ⇒ Object (readonly)
Returns the value of attribute function_parameters.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def function_parameters @function_parameters end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def template @template end |
#template_type ⇒ Object (readonly)
Returns the value of attribute template_type.
10 11 12 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 10 def template_type @template_type end |
Class Method Details
.from_json(json_object:) ⇒ PromptTemplateBlockPropertiesRequest
Deserialize a JSON object to an instance of PromptTemplateBlockPropertiesRequest
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 55 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) chat_role = CHAT_MESSAGE_ROLE.key(parsed_json["chat_role"]) || parsed_json["chat_role"] = struct. chat_source = struct.chat_source template = struct.template template_type = VELLUM_VARIABLE_TYPE.key(parsed_json["template_type"]) || parsed_json["template_type"] function_name = struct.function_name function_description = struct.function_description function_parameters = struct.function_parameters function_forced = struct.function_forced blocks = parsed_json["blocks"].map do |v| v = v.to_json PromptTemplateBlockRequest.from_json(json_object: v) end new(chat_role: chat_role, chat_message_unterminated: , chat_source: chat_source, template: template, 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) end |
.validate_raw(obj:) ⇒ Void
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.
97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 97 def self.validate_raw(obj:) obj.chat_role&.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.chat_role is not the expected type, validation failed.") obj.&.is_a?(Boolean) != false || raise("Passed value for field obj.chat_message_unterminated is not the expected type, validation failed.") obj.chat_source&.is_a?(String) != false || raise("Passed value for field obj.chat_source is not the expected type, validation failed.") obj.template&.is_a?(String) != false || raise("Passed value for field obj.template is not the expected type, validation failed.") obj.template_type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.template_type is not the expected type, validation failed.") obj.function_name&.is_a?(String) != false || raise("Passed value for field obj.function_name is not the expected type, validation failed.") obj.function_description&.is_a?(String) != false || raise("Passed value for field obj.function_description is not the expected type, validation failed.") obj.function_parameters&.is_a?(Hash) != false || raise("Passed value for field obj.function_parameters is not the expected type, validation failed.") obj.function_forced&.is_a?(Boolean) != false || raise("Passed value for field obj.function_forced is not the expected type, validation failed.") obj.blocks&.is_a?(Array) != false || raise("Passed value for field obj.blocks is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of PromptTemplateBlockPropertiesRequest to a JSON object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/vellum_ai/types/prompt_template_block_properties_request.rb', line 78 def to_json(*_args) { "chat_role": CHAT_MESSAGE_ROLE[@chat_role] || @chat_role, "chat_message_unterminated": @chat_message_unterminated, "chat_source": @chat_source, "template": @template, "template_type": VELLUM_VARIABLE_TYPE[@template_type] || @template_type, "function_name": @function_name, "function_description": @function_description, "function_parameters": @function_parameters, "function_forced": @function_forced, "blocks": @blocks }.to_json end |