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, 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
Retrieveresult.See also: AWS API Documentation
Request Syntax
response = client.get_document_content( dataSourceId='string', documentId='string', knowledgeBaseId='string', mediaId='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.
mediaId (string) – The unique identifier (in UUID format) of an image embedded in the specified document. Set this parameter to the
_media_idvalue in the metadata of the correspondingRetrieveresult. If you specify this parameter, the response contains a pre-signed URL for the image instead of the document, and you must omitoutputFormator set it toRAW.outputFormat (string) –
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 useEXTRACTEDwithmediaId.userContext (dict) –
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.
- Return type:
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
RAWformat, this is the original file type (for example,application/pdf), or the image type (for example,image/png) if you specifymediaId. ForEXTRACTEDformat, this is alwaysapplication/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.
Exceptions
AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExceptionAgentsforBedrockRuntime.Client.exceptions.ValidationExceptionAgentsforBedrockRuntime.Client.exceptions.InternalServerExceptionAgentsforBedrockRuntime.Client.exceptions.ThrottlingExceptionAgentsforBedrockRuntime.Client.exceptions.AccessDeniedException