Class: OCI::GenerativeAiInference::Models::RerankTextDetails
- Inherits:
-
Object
- Object
- OCI::GenerativeAiInference::Models::RerankTextDetails
- Defined in:
- lib/oci/generative_ai_inference/models/rerank_text_details.rb
Overview
Details required for a rerank request.
Instance Attribute Summary collapse
-
#compartment_id ⇒ String
[Required] The OCID of the compartment to call into the Generative AI service LLMs.
-
#documents ⇒ Array<String>
[Required] A list of document strings to rerank based on the query asked.
-
#input ⇒ String
[Required] Input query for search in the documents.
-
#is_echo ⇒ BOOLEAN
Whether or not to return the documents in the response.
-
#max_chunks_per_document ⇒ Integer
The maximum number of chunks to produce internally from a document.
-
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
-
#top_n ⇒ Integer
The number of most relevant documents or indices to return.
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 = {}) ⇒ RerankTextDetails
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 = {}) ⇒ RerankTextDetails
Initializes the object
82 83 84 85 86 87 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 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 82 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.input = attributes[:'input'] if attributes[:'input'] 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.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.documents = attributes[:'documents'] if attributes[:'documents'] self.top_n = attributes[:'topN'] if attributes[:'topN'] raise 'You cannot provide both :topN and :top_n' if attributes.key?(:'topN') && attributes.key?(:'top_n') self.top_n = attributes[:'top_n'] if attributes[:'top_n'] 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.max_chunks_per_document = attributes[:'maxChunksPerDocument'] if attributes[:'maxChunksPerDocument'] raise 'You cannot provide both :maxChunksPerDocument and :max_chunks_per_document' if attributes.key?(:'maxChunksPerDocument') && attributes.key?(:'max_chunks_per_document') self.max_chunks_per_document = attributes[:'max_chunks_per_document'] if attributes[:'max_chunks_per_document'] end |
Instance Attribute Details
#compartment_id ⇒ String
[Required] The OCID of the compartment to call into the Generative AI service LLMs.
17 18 19 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 17 def compartment_id @compartment_id end |
#documents ⇒ Array<String>
[Required] A list of document strings to rerank based on the query asked.
25 26 27 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 25 def documents @documents end |
#input ⇒ String
[Required] Input query for search in the documents.
13 14 15 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 13 def input @input end |
#is_echo ⇒ BOOLEAN
Whether or not to return the documents in the response.
33 34 35 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 33 def is_echo @is_echo end |
#max_chunks_per_document ⇒ Integer
The maximum number of chunks to produce internally from a document.
37 38 39 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 37 def max_chunks_per_document @max_chunks_per_document end |
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
21 22 23 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 21 def serving_mode @serving_mode end |
#top_n ⇒ Integer
The number of most relevant documents or indices to return. Defaults to the length of the documents.
29 30 31 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 29 def top_n @top_n end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 40 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'input': :'input', 'compartment_id': :'compartmentId', 'serving_mode': :'servingMode', 'documents': :'documents', 'top_n': :'topN', 'is_echo': :'isEcho', 'max_chunks_per_document': :'maxChunksPerDocument' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 55 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'input': :'String', 'compartment_id': :'String', 'serving_mode': :'OCI::GenerativeAiInference::Models::ServingMode', 'documents': :'Array<String>', 'top_n': :'Integer', 'is_echo': :'BOOLEAN', 'max_chunks_per_document': :'Integer' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 132 def ==(other) return true if equal?(other) self.class == other.class && input == other.input && compartment_id == other.compartment_id && serving_mode == other.serving_mode && documents == other.documents && top_n == other.top_n && is_echo == other.is_echo && max_chunks_per_document == other.max_chunks_per_document end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 168 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
148 149 150 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 148 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
157 158 159 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 157 def hash [input, compartment_id, serving_mode, documents, top_n, is_echo, max_chunks_per_document].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
201 202 203 204 205 206 207 208 209 210 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 201 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
195 196 197 |
# File 'lib/oci/generative_ai_inference/models/rerank_text_details.rb', line 195 def to_s to_hash.to_s end |