Skip to content

Bedrock Knowledge Base

A RAG feature powered by Amazon Bedrock Knowledge Base. It retrieves relevant information from internal documents stored in S3 and uses it to enhance AI responses.

There are two ways to integrate with an assistant: workflow-based and BedrockClaude built-in tool. The workflow-based approach executes each step sequentially: search query generation, knowledge base retrieval, reranking, and response generation.

Responses can include links to cited source documents. Reranking for improved search accuracy and metadata-based filtering are also supported.

Setup

1. Create a Bedrock Knowledge Base

Create a Bedrock Knowledge Base using the AWS Management Console.

  1. Open the Amazon Bedrock service page in the Tokyo region of the AWS Management Console
  2. Select Knowledge bases from the left menu
  3. Click Create knowledge base
  4. Configure the knowledge base name and data source (e.g., S3 bucket)
  5. Configure the embedding model and vector store
  6. After creation, note the Knowledge Base ID

For detailed knowledge base configuration, please contact support.

2. Configure the Assistant

2-1. Workflow-based Assistant

A workflow-based configuration that sequentially executes search query generation, knowledge base retrieval, reranking, and response generation.

  1. Open the assistant edit page in the admin console
  2. Select Bedrock Knowledge Base Retrieval as the Grounding
  3. Enter the ID from step 1 in the Bedrock Knowledge Base ID field
  4. Set the Search Result Count (recommended: 100)
  5. Set the RAG Prompt ID (default is fine)

For details on configuration fields, see Grounding - Bedrock Knowledge Base Retrieval.

Optional Settings

The following can be configured as needed.

  • Search Query Generation (SQG): Automatically generates optimized search queries from user input
  • Reranking: Improves accuracy by re-ranking search results
  • Attribute Filter: Narrows search scope using metadata (JSON format)
  • Document Link: Specifies how to display links to source documents

2-2. BedrockClaude Built-in Tool Assistant

An approach where Claude searches the knowledge base as a tool. Claude autonomously determines when to search and what queries to use based on the conversation context. Multiple KBs can be configured simultaneously, allowing different KBs for different purposes.

  1. Open the assistant list in the admin console
  2. Duplicate the Claude Sonnet 4.6 Thinking with Tool assistant
  3. Open the edit page for the duplicated assistant
  4. Add an entry in the Knowledge Base Search Tool section under Platform Metadata
  5. Enter the ID from step 1 in the Knowledge Base ID field
  6. Describe what information this KB contains in the Tool Description field
  7. Set the Search Result Count

For details on configuration fields, see Platform Metadata - BedrockClaude.

Optional Settings

The following can be configured as needed.

  • Attribute Filter: Narrows search scope using metadata (JSON format)
  • Reranking: Set the reranking model ARN and result count to improve search accuracy
  • Document Link: Specifies how to display links to source documents
  • Knowledge Base Search Prompt ID: Customizes the system prompt used during tool execution

Metadata Configuration

You can attach metadata to documents uploaded to S3. Metadata enables narrowing search scope with Attribute Filters and customizing document links.

Placing Metadata Files

Place a metadata file named <filename>.metadata.json in the same S3 folder as the document.

text
s3://my-kb-bucket/docs/
├── expense-manual.pdf
└── expense-manual.pdf.metadata.json

Metadata File Format

Describe key-value pairs in the metadataAttributes object. Below is a sample.

json
{
  "metadataAttributes": {
    "document_type": "manual",
    "file_format": "pdf",
    "title": "Expense Report Manual",
    "description": "Manual covering expense categories, procedures, and guidelines",
    "category": "accounting",
    "topics": "expense report, receipt, invoice, reimbursement",
    "page_count": 2,
    "language": "en",
    "custom_url": "https://example.com/docs/expense-manual"
  }
}

A feature that displays links to source documents in AI responses. Control the behavior with the assistant's Document Link setting.

ValueBehavior
ALL (default)Display the data source's original URL as a link (additional setup required)
OFFDo not display links
Metadata key nameDisplay the value of the specified metadata key as a URL

Using ALL

To display links to files on S3 with ALL, S3 bucket access permissions must be configured. See S3 Bucket Access Permissions for details.

Custom URLs Using Metadata Keys

Set a key such as custom_url in the metadata and specify the same key name in Document Link to display any URL as the citation link.

For example, with the following metadata:

json
{
  "metadataAttributes": {
    "custom_url": "https://example.com/docs/expense-manual"
  }
}

Entering custom_url in the assistant's Document Link field will display this URL as the citation source. This is useful for linking to internal portals or other non-S3 URLs.