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 ].freeze
Instance Attribute Summary collapse
-
#compartment_id ⇒ String
[Required] The OCID of compartment that the user is authorized to use to call into the Generative AI service.
-
#input_type ⇒ String
Specifies the input type.
-
#inputs ⇒ Array<String>
[Required] Provide a list of strings with a maximum number of 96 entries.
-
#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
88 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 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 88 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 that the user is authorized to use to call into the Generative AI service.
34 35 36 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 34 def compartment_id @compartment_id end |
#input_type ⇒ String
Specifies the input type.
46 47 48 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 46 def input_type @input_type end |
#inputs ⇒ Array<String>
[Required] Provide a list of strings with a maximum number of 96 entries. Each string can be words, a phrase, or a paragraph. The maximum length of each string entry in the list is 512 tokens.
26 27 28 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 26 def inputs @inputs end |
#is_echo ⇒ BOOLEAN
Whether or not to include the original inputs in the response. Results are index-based.
38 39 40 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 38 def is_echo @is_echo end |
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
30 31 32 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 30 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.
42 43 44 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 42 def truncate @truncate end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 49 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.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 63 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.
149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 149 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
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 184 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
164 165 166 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 164 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
173 174 175 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 173 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
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 217 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
211 212 213 |
# File 'lib/oci/generative_ai_inference/models/embed_text_details.rb', line 211 def to_s to_hash.to_s end |