Class: OCI::GenerativeAiInference::Models::SummarizeTextDetails
- Inherits:
-
Object
- Object
- OCI::GenerativeAiInference::Models::SummarizeTextDetails
- Defined in:
- lib/oci/generative_ai_inference/models/summarize_text_details.rb
Overview
Details for the request to summarize text.
Constant Summary collapse
- LENGTH_ENUM =
[ LENGTH_SHORT = 'SHORT'.freeze, LENGTH_MEDIUM = 'MEDIUM'.freeze, LENGTH_LONG = 'LONG'.freeze, LENGTH_AUTO = 'AUTO'.freeze ].freeze
- FORMAT_ENUM =
[ FORMAT_PARAGRAPH = 'PARAGRAPH'.freeze, FORMAT_BULLETS = 'BULLETS'.freeze, FORMAT_AUTO = 'AUTO'.freeze ].freeze
- EXTRACTIVENESS_ENUM =
[ EXTRACTIVENESS_LOW = 'LOW'.freeze, EXTRACTIVENESS_MEDIUM = 'MEDIUM'.freeze, EXTRACTIVENESS_HIGH = 'HIGH'.freeze, EXTRACTIVENESS_AUTO = 'AUTO'.freeze ].freeze
Instance Attribute Summary collapse
-
#additional_command ⇒ String
A free-form instruction for modifying how the summaries get generated.
-
#compartment_id ⇒ String
[Required] The OCID of compartment that the user is authorized to use to call into the Generative AI service.
-
#extractiveness ⇒ String
Controls how close to the original text the summary is.
-
#format ⇒ String
Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points.
-
#input ⇒ String
[Required] The input string to be summarized.
-
#is_echo ⇒ BOOLEAN
Whether or not to include the original inputs in the response.
-
#length ⇒ String
Indicates the approximate length of the summary.
-
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
-
#temperature ⇒ Float
A number that sets the randomness of the generated output.
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 = {}) ⇒ SummarizeTextDetails
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 = {}) ⇒ SummarizeTextDetails
Initializes the object
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 119 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.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.temperature = attributes[:'temperature'] if attributes[:'temperature'] self.temperature = 1.0 if temperature.nil? && !attributes.key?(:'temperature') # rubocop:disable Style/StringLiterals self.additional_command = attributes[:'additionalCommand'] if attributes[:'additionalCommand'] raise 'You cannot provide both :additionalCommand and :additional_command' if attributes.key?(:'additionalCommand') && attributes.key?(:'additional_command') self.additional_command = attributes[:'additional_command'] if attributes[:'additional_command'] self.length = attributes[:'length'] if attributes[:'length'] self.length = "AUTO" if length.nil? && !attributes.key?(:'length') # rubocop:disable Style/StringLiterals self.format = attributes[:'format'] if attributes[:'format'] self.format = "AUTO" if format.nil? && !attributes.key?(:'format') # rubocop:disable Style/StringLiterals self.extractiveness = attributes[:'extractiveness'] if attributes[:'extractiveness'] self.extractiveness = "AUTO" if extractiveness.nil? && !attributes.key?(:'extractiveness') # rubocop:disable Style/StringLiterals end |
Instance Attribute Details
#additional_command ⇒ String
A free-form instruction for modifying how the summaries get generated. Should complete the sentence "Generate a summary _". For example, "focusing on the next steps" or "written by Yoda".
56 57 58 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 56 def additional_command @additional_command end |
#compartment_id ⇒ String
[Required] The OCID of compartment that the user is authorized to use to call into the Generative AI service.
41 42 43 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 41 def compartment_id @compartment_id end |
#extractiveness ⇒ String
Controls how close to the original text the summary is. High extractiveness summaries will lean towards reusing sentences verbatim, while low extractiveness summaries will tend to paraphrase more.
68 69 70 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 68 def extractiveness @extractiveness end |
#format ⇒ String
Indicates the style in which the summary will be delivered - in a free form paragraph or in bullet points. If "AUTO" is selected, the best option will be picked based on the input text.
64 65 66 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 64 def format @format end |
#input ⇒ String
[Required] The input string to be summarized.
33 34 35 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 33 def input @input end |
#is_echo ⇒ BOOLEAN
Whether or not to include the original inputs in the response.
45 46 47 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 45 def is_echo @is_echo end |
#length ⇒ String
Indicates the approximate length of the summary. If "AUTO" is selected, the best option will be picked based on the input text.
60 61 62 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 60 def length @length end |
#serving_mode ⇒ OCI::GenerativeAiInference::Models::ServingMode
This attribute is required.
37 38 39 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 37 def serving_mode @serving_mode end |
#temperature ⇒ Float
A number that sets the randomness of the generated output. Lower temperatures mean less random generations.
Use lower numbers for tasks with a correct answer such as question answering or summarizing. High temperatures can generate hallucinations or factually incorrect information. Start with temperatures lower than 1.0, and increase the temperature for more creative outputs, as you regenerate the prompts to refine the outputs.
52 53 54 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 52 def temperature @temperature end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 71 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'input': :'input', 'serving_mode': :'servingMode', 'compartment_id': :'compartmentId', 'is_echo': :'isEcho', 'temperature': :'temperature', 'additional_command': :'additionalCommand', 'length': :'length', 'format': :'format', 'extractiveness': :'extractiveness' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 88 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'input': :'String', 'serving_mode': :'OCI::GenerativeAiInference::Models::ServingMode', 'compartment_id': :'String', 'is_echo': :'BOOLEAN', 'temperature': :'Float', 'additional_command': :'String', 'length': :'String', 'format': :'String', 'extractiveness': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 197 def ==(other) return true if equal?(other) self.class == other.class && input == other.input && serving_mode == other.serving_mode && compartment_id == other.compartment_id && is_echo == other.is_echo && temperature == other.temperature && additional_command == other.additional_command && length == other.length && format == other.format && extractiveness == other.extractiveness end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 235 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
215 216 217 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 215 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
224 225 226 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 224 def hash [input, serving_mode, compartment_id, is_echo, temperature, additional_command, length, format, extractiveness].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
268 269 270 271 272 273 274 275 276 277 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 268 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
262 263 264 |
# File 'lib/oci/generative_ai_inference/models/summarize_text_details.rb', line 262 def to_s to_hash.to_s end |