Create a knowledge base in Amazon Bedrock Knowledge Bases
Amazon Bedrock knowledge bases allow you to integrate proprietary information into your generative-AI applications to create Retrieval Augmented Generation (RAG) solutions. A knowledge base searches your data to find the most useful information and can use it to answer natural language questions.
Note
You can’t create a knowledge base with a root user. Log in with an IAM user before starting these steps.
When you create a knowledge base, you set up the configurations and permissions of the knowledge base, choose a data source to connect to, the embeddings model to convert the data into embeddings, and the vector store to keep the vector embeddings in. Select the tab corresponding to your method of choice and follow the steps:
- Console
-
To set up the configurations and permissions for a knowledge base
-
Sign in to the AWS Management Console using an IAM role with Amazon Bedrock permissions, and open the Amazon Bedrock console at https://console.aws.amazon.com/bedrock/
. -
From the left navigation pane, select Knowledge bases.
-
In the Knowledge bases section, select the create button.
-
(Optional) Change the default name and provide a description for your knowledge base.
-
Choose an AWS Identity and Access Management (IAM) role that provides Amazon Bedrock permission to access other required AWS services. You can let Amazon Bedrock create the service role or choose a custom role that you have created.
-
Choose a data source to connect your knowledge base to.
-
(Optional) Add tags to your knowledge base. For more information, see Tagging Amazon Bedrock resources.
-
(Optional) Configure services for which to deliver activity logs for your knowledge base.
-
Go to the next section and follow the steps at Connect a data source to your knowledge base to configure a data source.
-
Choose an embeddings model to convert your data into vector embeddings.
-
(Optional) Expand the Additional configurations section to see the following configuration options (not all models support all configurations):
-
Embeddings type – Whether to convert the data to floating-point (float32) vector embeddings (more precise, but more costly) or binary vector embeddings (less precise, but less costly). To learn about which embeddings models support binary vectors, refer to supported embeddings models.
-
Vector dimensions – Higher values improve accuracy but increase cost and latency.
-
-
Choose a vector store to store the vector embeddings that will be used for query. You have the following options:
-
Quick create a new vector store – Amazon Bedrock Knowledge Bases creates an Amazon OpenSearch Serverless vector search collection and index and configures it with the required fields for you.
-
Choose a vector store you have created – Select a supported vector store and identify the vector field names and metadata field names in the vector index. For more information, see Prerequisites for your own vector store for a knowledge base.
Note
If your data source is a Confluence, Microsoft SharePoint, or Salesforce instance, the only supported vector store service is Amazon OpenSearch Serverless.
-
-
Check the details of your knowledge base. You can edit any section before going ahead and creating your knowledge base.
Note
The time it takes to create the knowledge base depends on your specific configurations. When the creation of the knowledge base has completed, the status of the knowledge base changes to either state it is ready or available.
Once your knowledge base is ready and available, sync your data source for the first time and whenever you want to keep your content up to date. Select your knowledge base in the console and select Sync within the data source overview section.
-
- API
-
To create a knowledge base, send a CreateKnowledgeBase request (see link for request and response formats and field details) with an Agents for Amazon Bedrock build-time endpoint.
Note
If you prefer to let Amazon Bedrock create and manage a vector store for you in Amazon OpenSearch Service, use the console. For more information, see Create a knowledge base in Amazon Bedrock Knowledge Bases.
The following fields are required:
Field Basic description name A name for the knowledge base roleArn The ARN of a knowledge base service role. knowledgeBaseConfiguration Contains configurations for the knowledge base. See details below. storageConfiguration Contains configurations for the data source service that you choose. In the
knowledgeBaseConfiguration
, specifyVECTOR
as thetype
of data source that you plan to connect the knowledge base to and then specify the ARN of the embedding model to use and configurations for it. For more information, see VectorKnowledgeBaseConfiguration.The following fields are optional:
Field Use case description A description for the knowledge base. clientToken To ensure the API request completes only once. For more information, see Ensuring idempotency. tags To associate tags with the flow. For more information, see Tagging Amazon Bedrock resources.