Users can now select Pinecone as a Knowledge Base for Amazon Bedrock, a fully managed service from Amazon Web Services (AWS) for building GenAI applications.
The Pinecone vector database is a key component of the AI tech stack, helping companies solve one of the biggest challenges in deploying GenAI solutions — hallucinations — by allowing them to store, search, and find the most relevant and up-to-date information from company data and send that context to Large Language Models (LLMs) with every query. This workflow is called Retrieval Augmented Generation (RAG), and with Pinecone, it aids in providing relevant, accurate, and fast responses from search or GenAI applications to end users.
With the release of Knowledge Bases for Amazon Bedrock, developers can integrate their enterprise data into Amazon Bedrock using Pinecone as the fully-managed vector database to build GenAI applications that are:
Pinecone as a Knowledge Base for Amazon Bedrock is currently available in private preview. Learn more here and in the product walkthrough below.
In Bedrock, users interact with Agents that are capable of combining the natural language interface of the supported LLMs with those of a Knowledge Base. Bedrock’s Knowledge Base feature uses the supported LLMs to generate embeddings from the original data source. These embeddings are stored in Pinecone, and the Pinecone index is used to retrieve semantically relevant content upon the user’s query to the agent.
Note: the LLM used for embeddings may be different than the one used for the natural language generation. For example, you may choose to use Amazon Titan to generate embeddings and use Anthropic’s Claude to generate natural language responses.
Additionally, Agents for Amazon Bedrock may be configured to execute various actions in the context of responding to a user’s query - but we won’t get into this functionality in this post.
A Bedrock Knowledge base ingests raw text data or documents found in Amazon S3, embeds the content and upserts the embeddings into Pinecone. Then, a Bedrock agent can interact with the knowledge base to retrieve the most semantically relevant content given a user’s query.
Overall, the Knowledge Base feature is a valuable tool for users who want to improve their AI models’ performance. With Bedrock’s LLMs and Pinecone, users can easily integrate their data from AWS storage solutions and enhance the accuracy and relevance of their AI models.
In this post, we’ll go through the steps required for creating a Knowledge Base for Amazon Bedrock as well as an agent that will retrieve information from the knowledge base.
The process of using the Bedrock knowledge with Pinecone works as follows:
The knowledge base we’ll build is going to rely on a Pinecone index. After signing up to Pinecone, follow the quickstart guide to create your Pinecone index, and retrieve your index’s endpoint and apiKey
from the Pinecone console.
After setting up your Pinecone index, you’ll have to create a secret in AWS’s Secrets Manager.
apiKey
and then paste your Pinecone API key as it’s corresponding value.Our knowledge base is going to draw on data saved in S3. This data will be embedded and then saved in Pinecone.
s3://…
) for the following configuration steps.After setting up our data source, it’s time to configure the knowledge base itself.
metadata
)
Once the knowledge base is created, all that’s left is to create an agent that will use it for retrieval.
Once the agent has been created, you’ll see the following:
Your agent is now set up and ready to go! In the next section, we’ll review how to interact with the newly created agent.
In order to deploy the agent, we need to create an alias for it which points to a specific version of the agent.
Once the alias is created, we’ll be able to see it in the agent view:
To test the newly created agent, we’ll turn to the playground on the right of the screen when we open the agent.
In this example, we used a FAQ document for Amazon’s S3 Access Points for our source data. When we ask a question about this topic. If we ask a question about this topic using an agent without a knowledge base, we’ll get the following response:
Let’s compare that with an agent that is utilizing a knowledge base:
As we can see the answer is much more detailed, and includes multiple citations that point to the data source used to create the knowledge base. This is the power of the RAG pattern it ensures that the LLM can base it’s reposes on information that is semantically relevant to the user query, while preserving the references to the original data.