Agents for Amazon Bedrock Runtime

2026/11/05 - Agents for Amazon Bedrock Runtime - 1 updated api methods

Changes  Amazon Bedrock Managed Knowledge Base now supports an optional mediaId parameter in GetDocumentContent that you can use to retrieve images embedded in source documents.

GetDocumentContent (updated) Link ΒΆ
Changes (request)
{'mediaId': 'string'}

Retrieves the content of an ingested document from a knowledge base, or of an image embedded in the document. Returns a pre-signed URL for downloading the content. Use this operation to display the source of a Retrieve result.

See also: AWS API Documentation

Request Syntax

client.get_document_content(
    dataSourceId='string',
    documentId='string',
    knowledgeBaseId='string',
    mediaId='string',
    outputFormat='RAW'|'EXTRACTED',
    userContext={
        'userId': 'string'
    }
)
type dataSourceId:

string

param dataSourceId:

[REQUIRED]

The unique identifier of the data source that contains the document.

type documentId:

string

param documentId:

[REQUIRED]

The unique identifier of the document to retrieve content for.

type knowledgeBaseId:

string

param knowledgeBaseId:

[REQUIRED]

The unique identifier of the knowledge base that contains the document.

type mediaId:

string

param mediaId:

The unique identifier (in UUID format) of an image embedded in the specified document. Set this parameter to the _media_id value in the metadata of the corresponding Retrieve result. If you specify this parameter, the response contains a pre-signed URL for the image instead of the document, and you must omit outputFormat or set it to RAW.

type outputFormat:

string

param outputFormat:

The output format for the content. You can specify one of the following values:

RAW

Returns the original document, or the selected image if you specify mediaId.

EXTRACTED

Returns parsed document text as JSON.

If you omit this parameter, the default is RAW. You can't use EXTRACTED with mediaId.

type userContext:

dict

param userContext:

Contains information about the user making the request. This is used for access control filtering to ensure that results only include documents the user is authorized to access.

  • userId (string) -- [REQUIRED]

    The identifier of the user making the retrieval request.

rtype:

dict

returns:

Response Syntax

{
    'documentContentLength': 123,
    'mimeType': 'string',
    'presignedUrl': 'string'
}

Response Structure

  • (dict) --

    • documentContentLength (integer) --

      The size, in bytes, of the content available at the pre-signed URL.

    • mimeType (string) --

      The MIME type of the returned content. For RAW format, this is the original file type (for example, application/pdf), or the image type (for example, image/png) if you specify mediaId. For EXTRACTED format, this is always application/json.

    • presignedUrl (string) --

      A pre-signed URL for downloading the document content, or the selected image if you specify mediaId. The URL expires after 5 minutes.