Class: RubyAmazonBedrock::PayloadBuilders::StabilityAi::Base
- Defined in:
- lib/bedrock_runtime/payload_builders/stability_ai/base.rb
Overview
Builds and returns a payload hash suitable for the Stability AI 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
Constructs and returns a structured payload for processing by an AI model.
- #model_id ⇒ Object
- #parameters ⇒ Object
- #type ⇒ 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 structured payload for processing by an AI model. This method assembles data in a format suitable for tasks requiring configurable prompts, such as text or image generation, with control over creativity and randomness.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/bedrock_runtime/payload_builders/stability_ai/base.rb', line 26 def build { model_id: model_id, content_type: 'application/json', accept: '*/*', body: { text_prompts: [ { text: @prompt } ], cfg_scale: parameters[:cfg_scale], seed: parameters[:seed], steps: parameters[:steps] }.to_json } end |
#model_id ⇒ Object
42 43 44 |
# File 'lib/bedrock_runtime/payload_builders/stability_ai/base.rb', line 42 def model_id # noop end |
#parameters ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/bedrock_runtime/payload_builders/stability_ai/base.rb', line 46 def parameters { cfg_scale: @options[:cfg_scale] || 10, seed: @options[:seed] || 0, steps: @options[:steps] || 30 } end |
#type ⇒ Object
54 55 56 |
# File 'lib/bedrock_runtime/payload_builders/stability_ai/base.rb', line 54 def type :image end |