View information about documents in your data source - Amazon Bedrock

View information about documents in your data source

The following topics describe how to view documents in your data source. If your knowledge base is connected to an Amazon S3 data source, you can view the documents in the connected S3 bucket.

Note

If you created a new knowledge base by connecting to an S3 data source, you must sync the data source first before you can use these API operations on the data source.

View information about a subset of documents in your knowledge base

To view information about specific documents in your data source, send a GetKnowledgeBaseDocuments request with an Agents for Amazon Bedrock build-time endpoint and specify the IDs of the data source and the knowledge base it's connected to.

For each document that you want to get information for, add a DocumentIdentifier item in the documentIdentifiers array in one of the following formats:

  • If the data source is a custom one, specify the ID of the document in the id field:

    { "custom": { "id": "string" }, "dataSourceType": "CUSTOM" }
  • If the data source is an Amazon S3 one, specify the S3 URI of the document in the uri field:

    { "dataSourceType": "S3", "s3": { "uri": "string" } }

The response returns an array of items, each of which contains information about a document that you requested.

View information about all documents in your knowledge base

To view information about all documents in a data source, send a ListKnowledgeBaseDocuments request with an Agents for Amazon Bedrock build-time endpoint and specify the IDs of tthe data source and the knowledge base it's connected to. You also have the following options:

  • Specify the maxResults to limit the number of results to return.

  • If the results do not fit into a response, a value is returned in the nextToken field of the response. You can use this value in the nextToken field of a subsequent request to get the next batch of results.