Class: RubyAmazonBedrock::PayloadBuilders::Amazon::Base
- Defined in:
- lib/bedrock_runtime/payload_builders/amazon/base.rb
Overview
Builds and returns a payload hash suitable for the Amazon model processing. This method constructs a payload with specific parameters like ‘model_id`, `content_type`, `accept`, and a `body` that includes various AI-related settings.
Direct Known Subclasses
Instance Method Summary collapse
-
#build ⇒ Hash
Builds and returns a hash representing the payload for a text generation request.
- #model_id ⇒ Object
- #parameters ⇒ Object
Methods inherited from Base
Constructor Details
This class inherits a constructor from RubyAmazonBedrock::PayloadBuilders::Base
Instance Method Details
#build ⇒ Hash
Builds and returns a hash representing the payload for a text generation request. This method prepares the necessary data structure for processing an input text through a specified model. It includes various configuration parameters for text generation.
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bedrock_runtime/payload_builders/amazon/base.rb', line 28 def build { model_id: model_id, content_type: 'application/json', accept: '*/*', body: { inputText: @prompt, textGenerationConfig: parameters }.to_json } end |
#model_id ⇒ Object
40 41 42 |
# File 'lib/bedrock_runtime/payload_builders/amazon/base.rb', line 40 def model_id # noop end |
#parameters ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/bedrock_runtime/payload_builders/amazon/base.rb', line 44 def parameters { maxTokenCount: @options[:max_tokens] || 4096, stopSequences: @options[:stop_sequences] || [], temperature: @options[:temperature] || 0, topP: @options[:top_p] || 1 } end |