NOTE : Before try this tutorial, get Pinecone host key to can connect to Amazon Bedrock, then store Pinecone host key to AWS Secret Manager.
I want to create RAG (retrieval augmented generation) financial customer service and data analyst using Amazon Bedrock features such as Amazon Bedrock Knowledge Base and Agent.
First, go to Pinecone then create database index with several steps below.
Choose capacity mode and cloud provider. But for starter plan, can choose serverless and AWS only. Can't choose pods or another cloud provider such as Google Cloud and Azure.
Second, go to AWS Secret Manager then create Pinecone secret key with several steps below.
Choose "Other type of secret". Then fill key/value as a Pinecone API Key (must "apiKey" and your Pinecone API Key (I censored)).
Finally, result of Bedrock Knowledge Base for RAG.
Embedding model using Amazon Titan Embedding and vector database using Pinecone.
Copy inference profile ARN. For this tutorial, copy US Nova Micro.
Test knowledge base before deploy to Bedrock Agent.
Test knowledge base before deploy to Bedrock Agent.
But, if want to sync from another S3 bucket, how to sync? I explain this solution.
Go to IAM then click IAM role for Bedrock Knowledge Base like this. Click S3 policy.
This policy only can sync for "all-in-bedrock" S3 bucket. But if I want to sync another S3 bucket. Example I have S3 bucket name "bedrock-kb", can't sync because this S3 policy can't detect.
Edit S3 policy configuration like this screenshot for can sync all S3 bucket.
Then, result of Bedrock Agent for RAG.
Instruction for this agent using Amazon Nova Micro.
Associate agent with knowledge base that already created.
Bedrock Agent version and alias
Copy inference profile ARN. For this tutorial, copy US Nova Micro.
Test Bedrock Agent with scenario if a question is not related with knowledge base.
Test Bedrock Agent with scenario if a question is related with knowledge base.
I create all steps using boto3 SDK, you can see my Github for this tutorial.
Thank you,
Budi :)
Top comments (0)