Knowledge Bases for Amazon Bedrock is a new feature that allows users to securely connect foundation models (FMs) to their corporate data for Retrieval Augmented Generation (RAG). This improves the precision of responses by providing access to a broader range of data without having to retrain the foundation models.
There are two new features specific to the RetrieveAndGenerate API—configuring the maximum number of results and creating custom prompts using a knowledge base prompt template.
Using the maximum number of results feature, users can control the number of search results that are retrieved and passed to the foundation model. This helps to adjust the background information available for response construction, which increases relevance and reduces hallucination in the generated responses.
The custom prompt template feature allows users to replace the default prompt with their own custom version. This determines the format, tone, and behavior of the model’s response and can be adjusted to suit specific needs.
To use these features, there are certain prerequisites. Firstly, an existing knowledge base requirement, instructions on how to create one are available. There are further detailed steps for how to use the maximum number of results feature and how to customize the knowledge base prompt template on the console.
Examples with the communicate and demonstrate the value of these features are provided in the document. For instance, certain number of maximum results can increase the accuracy of the generated response.
There are also steps on how to use the two features with the SDK (Software Development Kit). This includes how to change the maximum number of results and how to customize the prompt with different templates.
To conclude, Knowledge Bases for Amazon Bedrock has added two new features, the maximum number of results and custom prompts. These features allow users to improve the performance and accuracy of responses. Further resources are also provided for AWS environment implementation.