Knowledge bases for Amazon Bedrock - Amazon Bedrock

Knowledge bases for Amazon Bedrock

Knowledge bases for Amazon Bedrock provides you the capability of amassing data sources into a repository of information. With knowledge bases, you can easily build an application that takes advantage of retrieval augmented generation (RAG), a technique in which the retrieval of information from data sources augments the generation of model responses. Once set up, you can take advantage of a knowledge base in the following ways.

  • Configure your RAG application to use the RetrieveAndGenerate API to query your knowledge base and generate responses from the information it retrieves.

  • Load your document and configure RAG to query your knowledge base and generate responses about the document you loaded. The document is deleted upon completion of analysis and is not stored in the knowledge base.

  • Associate your knowledge base with an agent (for more information, see Agents for Amazon Bedrock) to add RAG capability to the agent by helping it reason through the steps it can take to help end users.

  • Create a custom orchestration flow in your application by using the Retrieve API to retrieve information directly from the knowledge base.

A knowledge base can be used not only to answer user queries, and analyze documents, but also to augment prompts provided to foundation models by providing context to the prompt. Knowledge base responses also come with citations, such that users can find further information by looking up the exact text that a response is based on and also check that the response makes sense and is factually correct.

You take the following steps to set up and use your knowledge base.

  1. Gather source documents to add to your knowledge base.

  2. (Optional) Create a metadata file for each source document to allow for filtering of results during knowledge base query.

  3. Upload your data to an Amazon S3 bucket.

  4. (Optional) Set up a vector index in a supported vector store to index your data. You can skip this step if you plan to use the Amazon Bedrock console to create an Amazon OpenSearch Serverless vector database for you.

  5. Create and configure your knowledge base.

  6. Ingest your data by generating embeddings with a foundation model and storing them in a supported vector store.

  7. Set up your application or agent to query the knowledge base and return augmented responses.