Class: LLM::Bedrock::RequestAdapter::Completion Private
- Inherits:
-
Object
- Object
- LLM::Bedrock::RequestAdapter::Completion
- Includes:
- RequestAdapter::Role, RequestAdapter::Tool
- Defined in:
- lib/llm/providers/bedrock/request_adapter/completion.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Adapts a single message to Bedrock Converse content blocks.
Bedrock Converse content blocks include:
- { text: "..." }
- { image: { format: "png", source: { bytes: "..." } } }
- { document: { format: "pdf", name: "...", source: { bytes: "..." } } }
- { toolUse: { toolUseId: "...", name: "...", input: ... } }
- {toolResult: {toolUseId: "...", content: [{ text: "..." }]}}
Instance Method Summary collapse
-
#initialize(llm, message) ⇒ Completion
constructor
private
A new instance of Completion.
-
#adapt ⇒ Hash?
private
Adapts the message for the Bedrock Converse API.
Methods included from RequestAdapter::Tool
#tool_call_arguments, #tool_call_arguments_json, #tool_calls
Methods included from RequestAdapter::Role
#adapt_message_role, #adapt_role
Constructor Details
#initialize(llm, message) ⇒ Completion
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Completion.
22 23 24 25 |
# File 'lib/llm/providers/bedrock/request_adapter/completion.rb', line 22 def initialize(llm, ) @llm = llm @message = end |
Instance Method Details
#adapt ⇒ Hash?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adapts the message for the Bedrock Converse API
30 31 32 33 34 35 36 37 38 |
# File 'lib/llm/providers/bedrock/request_adapter/completion.rb', line 30 def adapt catch(:abort) do if Hash === {role: (), content: adapt_content([:content])} else end end end |