Class: RubyAmazonBedrock::PayloadBuilders::Cohere::EmbedBase
- Defined in:
- lib/bedrock_runtime/payload_builders/cohere/embed_base.rb
Overview
Builds and returns a payload hash suitable for the Cohere command 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 payload suitable for text embedding or search tasks.
- #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 payload suitable for text embedding or search tasks. The method configures the necessary payload structure for processing text input, specifically for embedding or indexing in an AI-driven search system.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bedrock_runtime/payload_builders/cohere/embed_base.rb', line 23 def build { model_id: model_id, content_type: 'application/json', accept: '*/*', body: { texts: [@prompt], input_type: parameters[:input_type], truncate: parameters[:truncate] }.to_json } end |
#model_id ⇒ Object
36 37 38 |
# File 'lib/bedrock_runtime/payload_builders/cohere/embed_base.rb', line 36 def model_id # noop end |
#parameters ⇒ Object
40 41 42 43 44 45 |
# File 'lib/bedrock_runtime/payload_builders/cohere/embed_base.rb', line 40 def parameters { input_type: @options[:input_type] || 'search_document', truncate: @options[:truncate] || 'NONE' } end |