Class: RubyAmazonBedrock::PayloadBuilders::Meta::Base
- Defined in:
- lib/bedrock_runtime/payload_builders/meta/base.rb
Overview
Builds and returns a payload hash suitable for the Meta 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
Llama213bChatV1, Llama270bChatV1, Llama370bInstructV1, Llama38bInstructV1
Instance Method Summary collapse
-
#build ⇒ Hash
Constructs and returns a payload formatted for text generation requests.
- #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
Constructs and returns a payload formatted for text generation requests. This method assembles the necessary data structure for processing text input through an AI model, with various parameters to guide the generation process.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/bedrock_runtime/payload_builders/meta/base.rb', line 25 def build { model_id: model_id, content_type: 'application/json', accept: '*/*', body: { prompt: @prompt, max_gen_len: parameters[:max_gen_len], temperature: parameters[:temperature], top_p: parameters[:top_p] }.to_json } end |
#model_id ⇒ Object
39 40 41 |
# File 'lib/bedrock_runtime/payload_builders/meta/base.rb', line 39 def model_id # noop end |
#parameters ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/bedrock_runtime/payload_builders/meta/base.rb', line 43 def parameters { max_gen_len: @options[:max_tokens] || 512, temperature: @options[:temperature] || 0.5, top_p: @options[:top_p] || 0.9 } end |