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.
RAWreturns the original file.EXTRACTEDreturns parsed text as JSON. Defaults toRAW.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
RAWformat, this is the original file type (for example,application/pdf). ForEXTRACTEDformat, this is alwaysapplication/json.presignedUrl (string) –
A pre-signed URL for downloading the document content. The URL expires after 5 minutes.
Exceptions
AgentsforBedrockRuntime.Client.exceptions.ResourceNotFoundExceptionAgentsforBedrockRuntime.Client.exceptions.ValidationExceptionAgentsforBedrockRuntime.Client.exceptions.InternalServerExceptionAgentsforBedrockRuntime.Client.exceptions.ThrottlingExceptionAgentsforBedrockRuntime.Client.exceptions.AccessDeniedException