Class: PromptBuilder::Serializers::Converse::Response

Inherits:
Base
  • Object
show all
Defined in:
lib/prompt_builder/serializers/converse/response.rb

Overview

Response parser for the Amazon Bedrock Converse API format.

Constant Summary collapse

RESPONSE_ID_HEADER =

The response id header set by Bedrock (the AWS request metadata id).

"x-amzn-requestid"

Class Method Summary collapse

Methods inherited from Base

request_payload

Class Method Details

.parse_response(hash, headers: nil) ⇒ PromptBuilder::Response

Parse a Converse response into a PromptBuilder::Response. The Converse API does not include a response id in the body; Bedrock returns it in the request metadata headers, so the id is read from headers when they are given.

Parameters:

  • hash (Hash)

    the response hash in Converse format

  • headers (Hash, #each, nil) (defaults to: nil)

    the HTTP response headers

Returns:

Raises:



23
24
25
26
# File 'lib/prompt_builder/serializers/converse/response.rb', line 23

def parse_response(hash, headers: nil)
  check_error_response!(hash)
  deserialize_response(hash, headers)
end