AgentsforBedrockRuntime / Client / get_document_content

get_document_content

AgentsforBedrockRuntime.Client.get_document_content(**kwargs)

Retrieves the content of an ingested document from a knowledge base. Returns a pre-signed URL for secure document access.

See also: AWS API Documentation

Request Syntax

response = client.get_document_content(
    dataSourceId='string',
    documentId='string',
    knowledgeBaseId='string',
    outputFormat='RAW'|'EXTRACTED',
    userContext={
        'userId': 'string'
    }
)
Parameters:
  • dataSourceId (string) –

    [REQUIRED]

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

  • documentId (string) –

    [REQUIRED]

    The unique identifier of the document to retrieve content for.

  • knowledgeBaseId (string) –

    [REQUIRED]

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

  • outputFormat (string) – The output format for the document content. RAW returns the original file. EXTRACTED returns parsed text as JSON. Defaults to RAW.

  • userContext (dict) –

    Contains information about the user making the request. Use this to pass user identity information for access control filtering, so that retrieval results only include documents the user is authorized to access.

    • userId (string) – [REQUIRED]

      The identifier of the user making the retrieval request.

Return type:

dict

Returns:

Response Syntax

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

Response Structure

  • (dict) –

    • documentContentLength (integer) –

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

    • mimeType (string) –

      The MIME type of the document content. For RAW format, this is the original file type (for example, application/pdf). For EXTRACTED format, this is always application/json.

    • presignedUrl (string) –

      A pre-signed URL for downloading the document content. The URL expires after 5 minutes.

Exceptions

  • AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundException

  • AgentsforBedrockRuntime.Client.exceptions.ValidationException

  • AgentsforBedrockRuntime.Client.exceptions.InternalServerException

  • AgentsforBedrockRuntime.Client.exceptions.ThrottlingException

  • AgentsforBedrockRuntime.Client.exceptions.AccessDeniedException