Class: OCI::GenerativeAiInference::Models::EmbedTextDetails
- Inherits:
-
Object
- Object
- OCI::GenerativeAiInference::Models::EmbedTextDetails
- Defined in:
- lib/oci/generative_ai_inference/models/embed_text_details.rb
Overview
Details for the request to embed texts.
Constant Summary collapse
- TRUNCATE_ENUM =
[ TRUNCATE_NONE = 'NONE'.freeze, TRUNCATE_START = 'START'.freeze, TRUNCATE_END = 'END'.freeze ].freeze
- INPUT_TYPE_ENUM =
[ INPUT_TYPE_SEARCH_DOCUMENT = 'SEARCH_DOCUMENT'.freeze, INPUT_TYPE_SEARCH_QUERY = 'SEARCH_QUERY'.freeze, INPUT_TYPE_CLASSIFICATION = 'CLASSIFICATION'.freeze, INPUT_TYPE_CLUSTERING = 'CLUSTERING'.freeze, INPUT_TYPE_IMAGE = 'IMAGE'.freeze ].freeze
Instance Attribute Summary collapse
-
#compartment_id ⇒ String
[Required] The OCID of compartment in which to call the Generative AI service to create text embeddings.
-
#input_type ⇒ String
Specifies the input type.
-
#inputs ⇒ Array<String>
[Required] Provide a list of strings or one base64 encoded image with
input_type
setting toIMAGE
. -
#is_echo ⇒ BOOLEAN
Whether or not to include the original inputs in the response.
-
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
-
#truncate ⇒ String
For an input that's longer than the maximum token length, specifies which part of the input text will be truncated.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ EmbedTextDetails
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ EmbedTextDetails
Initializes the object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 89 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.inputs = attributes[:'inputs'] if attributes[:'inputs'] self.serving_mode = attributes[:'servingMode'] if attributes[:'servingMode'] raise 'You cannot provide both :servingMode and :serving_mode' if attributes.key?(:'servingMode') && attributes.key?(:'serving_mode') self.serving_mode = attributes[:'serving_mode'] if attributes[:'serving_mode'] self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId'] raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id') self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id'] self.is_echo = attributes[:'isEcho'] unless attributes[:'isEcho'].nil? self.is_echo = false if is_echo.nil? && !attributes.key?(:'isEcho') # rubocop:disable Style/StringLiterals raise 'You cannot provide both :isEcho and :is_echo' if attributes.key?(:'isEcho') && attributes.key?(:'is_echo') self.is_echo = attributes[:'is_echo'] unless attributes[:'is_echo'].nil? self.is_echo = false if is_echo.nil? && !attributes.key?(:'isEcho') && !attributes.key?(:'is_echo') # rubocop:disable Style/StringLiterals self.truncate = attributes[:'truncate'] if attributes[:'truncate'] self.truncate = "NONE" if truncate.nil? && !attributes.key?(:'truncate') # rubocop:disable Style/StringLiterals self.input_type = attributes[:'inputType'] if attributes[:'inputType'] raise 'You cannot provide both :inputType and :input_type' if attributes.key?(:'inputType') && attributes.key?(:'input_type') self.input_type = attributes[:'input_type'] if attributes[:'input_type'] end |
Instance Attribute Details
#compartment_id ⇒ String
[Required] The OCID of compartment in which to call the Generative AI service to create text embeddings.
35 36 37 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 35 def compartment_id @compartment_id end |
#input_type ⇒ String
Specifies the input type.
47 48 49 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 47 def input_type @input_type end |
#inputs ⇒ Array<String>
[Required] Provide a list of strings or one base64 encoded image with input_type
setting to IMAGE
. If text embedding, each string can be words, a phrase, or a paragraph. The maximum length of each string entry in the list is 512 tokens.
27 28 29 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 27 def inputs @inputs end |
#is_echo ⇒ BOOLEAN
Whether or not to include the original inputs in the response. Results are index-based.
39 40 41 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 39 def is_echo @is_echo end |
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
31 32 33 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 31 def serving_mode @serving_mode end |
#truncate ⇒ String
For an input that's longer than the maximum token length, specifies which part of the input text will be truncated.
43 44 45 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 43 def truncate @truncate end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 50 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'inputs': :'inputs', 'serving_mode': :'servingMode', 'compartment_id': :'compartmentId', 'is_echo': :'isEcho', 'truncate': :'truncate', 'input_type': :'inputType' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 64 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'inputs': :'Array<String>', 'serving_mode': :'OCI::GenerativeAiInference::Models::ServingMode', 'compartment_id': :'String', 'is_echo': :'BOOLEAN', 'truncate': :'String', 'input_type': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 150 def ==(other) return true if equal?(other) self.class == other.class && inputs == other.inputs && serving_mode == other.serving_mode && compartment_id == other.compartment_id && is_echo == other.is_echo && truncate == other.truncate && input_type == other.input_type end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 185 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
165 166 167 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 165 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
174 175 176 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 174 def hash [inputs, serving_mode, compartment_id, is_echo, truncate, input_type].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
218 219 220 221 222 223 224 225 226 227 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 218 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
212 213 214 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 212 def to_s to_hash.to_s end |