Class: PromptBuilder::Serializers::Converse::Request
- Defined in:
- lib/prompt_builder/serializers/converse/request.rb
Overview
Request serializer for the Amazon Bedrock Converse API format.
Unsupported Open Responses features
These session fields are not supported and are silently omitted from the serialized output:
background— background/async mode is not supported on the Converse endpointfrequency_penalty— not supported by the Converse APIinclude— response-field inclusion is an Open Responses-only conceptmax_tool_calls— per-request tool-call caps are not supportedparallel_tool_calls— parallel tool call control is not supportedpresence_penalty— not supported by the Converse APIprompt_cache_key/prompt_cache_retention— explicit prompt cache keys are not supportedreasoning— extended thinking is not supported on the Converse endpointsafety_identifier— no equivalent user-safety field on the Converse endpointstore— server-side response storage is not supportedstream— SSE streaming is handled outside the Converse request payloadstream_options— stream event options are not supportedtop_logprobs— log probability output is not supportedtruncation— server-side context truncation is not supported
Partially supported session fields (unsupported keys/values are omitted):
metadata— only scalar values are forwarded torequestMetadata; Hash/Array values are omittedtext— onlyformat.type == "json_schema"is supported
Tool choice restrictions:
tool_choice: "none"has no Converse representation and is omitted
Input content restrictions:
Reasoningitems are silently skippedRefusalContentis dropped silently (a parsed response refusal can stay in session history without breaking subsequent request_payload calls)OutputText.annotationsandOutputText.logprobsare dropped silentlyInputImagecontent is only supported in user messages (assistant images are omitted)InputImage.detailandInputImage.file_idare silently ignoredInputFilecontent is only supported in user messages (assistant files are omitted)InputFile.file_idis silently ignoredInputVideocontent is only supported in user messages (assistant videos are omitted)InputImagerequires base64dataor an S3 URI (+s3://...+); content with a public URL is omittedInputFilerequires base64file_dataor an S3 URI; format is detected from the filename orfile_urlextensionInputVideorequires an S3 URI (+s3://...+); a non-S3 URL is omitted- Tool (+FunctionCallOutput+) results support text, image, document, and video content; other content is omitted
Features in Converse not available through Open Responses
The following Converse parameters cannot be set through the Open Responses
canonical format but are recognized via session extra keys:
stopSequences— custom stop sequences (+stop_sequences+)- Guardrail policies (+guardrail_config+)
- Per-model passthrough fields (+additional_model_request_fields+)
- Requested provider response fields (+additional_model_response_field_paths+)
performanceConfiglatency settings (+performance_config+)- Prompt management variables (+prompt_variables+)
Prompt caching markers (+cachePoint+) are emitted via the cache_point
content extra. Cross-region routing via inference profiles is selected
through the model id and needs no request field.
Constant Summary collapse
- IMAGE_MEDIA_TYPE_FORMATS =
{ "image/jpeg" => "jpeg", "image/jpg" => "jpeg", "image/png" => "png", "image/gif" => "gif", "image/webp" => "webp" }.freeze
- IMAGE_URL_EXTENSION_FORMATS =
{ "jpg" => "jpeg", "jpeg" => "jpeg", "png" => "png", "gif" => "gif", "webp" => "webp" }.freeze
- DOCUMENT_FILENAME_EXTENSION_FORMATS =
{ "pdf" => "pdf", "csv" => "csv", "doc" => "doc", "docx" => "docx", "xls" => "xls", "xlsx" => "xlsx", "html" => "html", "htm" => "html", "txt" => "txt", "md" => "md", "markdown" => "md" }.freeze
- VIDEO_URL_EXTENSION_FORMATS =
{ "mkv" => "mkv", "mov" => "mov", "mp4" => "mp4", "webm" => "webm", "flv" => "flv", "mpeg" => "mpeg", "mpg" => "mpeg", "wmv" => "wmv", "3gp" => "three_gp" }.freeze