toInvocationResult
Converts a Bedrock ContentBlock (typically from a Converse/ConverseStream output message) into an InvocationResult suitable for an HTTP response.
ContentBlock.Text becomes InvocationResult.Text.
ContentBlock.Image, ContentBlock.Audio, ContentBlock.Video and ContentBlock.Document become InvocationResult.Binary with a content type derived from the block's
format, provided the block carries inline bytes (anS3Locationsource is not proxied).
Throws
for blocks that cannot be represented as a single HTTP body (e.g. tool use/result, reasoning, or a binary block backed only by an S3Location).