Class: AWSCDK::Bedrock::CfnAgent::InferenceConfigurationProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::Bedrock::CfnAgent::InferenceConfigurationProperty
- Defined in:
- bedrock/cfn_agent.rb
Overview
Base inference parameters to pass to a model in a call to Converse or ConverseStream . For more information, see Inference parameters for foundation models .
If you need to pass additional parameters that the model supports, use the additional_model_request_fields request field in the call to Converse or ConverseStream . For more information, see Model parameters .
Instance Attribute Summary collapse
-
#maximum_length ⇒ Numeric?
readonly
The maximum number of tokens allowed in the generated response.
-
#stop_sequences ⇒ Array<String>?
readonly
A list of stop sequences.
-
#temperature ⇒ Numeric?
readonly
The likelihood of the model selecting higher-probability options while generating a response.
-
#top_k ⇒ Numeric?
readonly
While generating a response, the model determines the probability of the following token at each point of generation.
-
#top_p ⇒ Numeric?
readonly
The percentage of most-likely candidates that the model considers for the next token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(maximum_length: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil) ⇒ InferenceConfigurationProperty
constructor
A new instance of InferenceConfigurationProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(maximum_length: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil) ⇒ InferenceConfigurationProperty
Returns a new instance of InferenceConfigurationProperty.
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 |
# File 'bedrock/cfn_agent.rb', line 1412 def initialize(maximum_length: nil, stop_sequences: nil, temperature: nil, top_k: nil, top_p: nil) @maximum_length = maximum_length Jsii::Type.check_type(@maximum_length, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "maximumLength") unless @maximum_length.nil? @stop_sequences = stop_sequences Jsii::Type.check_type(@stop_sequences, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7InByaW1pdGl2ZSI6InN0cmluZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "stopSequences") unless @stop_sequences.nil? @temperature = temperature Jsii::Type.check_type(@temperature, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "temperature") unless @temperature.nil? @top_k = top_k Jsii::Type.check_type(@top_k, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "topK") unless @top_k.nil? @top_p = top_p Jsii::Type.check_type(@top_p, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJudW1iZXIifQ==")), "topP") unless @top_p.nil? end |
Instance Attribute Details
#maximum_length ⇒ Numeric? (readonly)
The maximum number of tokens allowed in the generated response.
1429 1430 1431 |
# File 'bedrock/cfn_agent.rb', line 1429 def maximum_length @maximum_length end |
#stop_sequences ⇒ Array<String>? (readonly)
A list of stop sequences.
A stop sequence is a sequence of characters that causes the model to stop generating the response.
1436 1437 1438 |
# File 'bedrock/cfn_agent.rb', line 1436 def stop_sequences @stop_sequences end |
#temperature ⇒ Numeric? (readonly)
The likelihood of the model selecting higher-probability options while generating a response.
A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models .
1445 1446 1447 |
# File 'bedrock/cfn_agent.rb', line 1445 def temperature @temperature end |
#top_k ⇒ Numeric? (readonly)
While generating a response, the model determines the probability of the following token at each point of generation.
The value that you set for top_k is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set top_k to 50, the model selects the next token from among the top 50 most likely choices.
1452 1453 1454 |
# File 'bedrock/cfn_agent.rb', line 1452 def top_k @top_k end |
#top_p ⇒ Numeric? (readonly)
The percentage of most-likely candidates that the model considers for the next token.
For example, if you choose a value of 0.8 for top_p , the model selects from the top 80% of the probability distribution of tokens that could be next in the sequence.
The default value is the default value for the model that you are using. For more information, see Inference parameters for foundation models .
1461 1462 1463 |
# File 'bedrock/cfn_agent.rb', line 1461 def top_p @top_p end |
Class Method Details
.jsii_properties ⇒ Object
1463 1464 1465 1466 1467 1468 1469 1470 1471 |
# File 'bedrock/cfn_agent.rb', line 1463 def self.jsii_properties { :maximum_length => "maximumLength", :stop_sequences => "stopSequences", :temperature => "temperature", :top_k => "topK", :top_p => "topP", } end |
Instance Method Details
#to_jsii ⇒ Object
1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 |
# File 'bedrock/cfn_agent.rb', line 1473 def to_jsii result = {} result.merge!({ "maximumLength" => @maximum_length, "stopSequences" => @stop_sequences, "temperature" => @temperature, "topK" => @top_k, "topP" => @top_p, }) result.compact end |