Foundational models (FMs) are trained on vast amounts of data and utilize billions of parameters. However, to address customer inquiries regarding domain-specific private data, they must consult an authoritative knowledge base external to the model’s training data sources. This is commonly accomplished through Retrieval Augmented Generation (RAG), which fetches data from internal or proprietary sources to enhance the capabilities of FMs in specific domains without requiring model retraining. This cost-effective approach ensures that model output remains relevant, accurate, and valuable in diverse contexts.
Knowledge Bases for Amazon Bedrock offers a fully managed solution for implementing the complete RAG workflow, from data ingestion to retrieval and prompt augmentation, eliminating the need for custom integrations to data sources and data flow management. MongoDB Atlas is now available as a vector store in Knowledge Bases for Amazon Bedrock, enabling the building of RAG solutions that securely connect private data sources within an organization to FMs in Amazon Bedrock. This integration adds to the existing vector stores supported by Knowledge Bases for Amazon Bedrock, including Amazon Aurora PostgreSQL-Compatible Edition, vector engine for Amazon OpenSearch Serverless, Pinecone, and Redis Enterprise Cloud.
To utilize MongoDB Atlas as a vector store in Knowledge Bases for Amazon Bedrock, the Vector Search index in MongoDB Atlas must be configured with the appropriate field containing vector data. Once the index is set up, source data must be ingested, vector embeddings created, and stored in a MongoDB Atlas collection. Queries can then be performed by converting input text into a vector embedding and using an aggregation pipeline stage for vector search queries against fields indexed as the vector type in a vectorSearch type index.
By integrating MongoDB Atlas with Knowledge Bases for Amazon Bedrock, most of the heavy lifting is handled automatically. Once the setup is complete, RAG can be incorporated into applications, with Amazon Bedrock converting input prompts into embeddings, querying the knowledge base, augmenting FM prompts with search results, and generating responses.
To set up MongoDB Atlas as a vector store in Knowledge Bases for Amazon Bedrock, begin by creating a MongoDB Atlas cluster on AWS, followed by creating a database, collection, database user, and configuring network access. The index definition for the Vector Search index must be created, and the knowledge base must be configured by creating an AWS Secrets Manager secret, an Amazon S3 storage bucket, and synchronizing data sources with the MongoDB Atlas vector search index.
Testing the knowledge base involves querying the knowledge base with questions about Amazon Bedrock using a chosen foundation model. To build RAG applications on top of Knowledge Bases for Amazon Bedrock, the RetrieveAndGenerate API can be used to query the knowledge base and receive a response. Further customization can be achieved by using the Retrieve API to obtain semantic search responses for the RAG workflow.
Key considerations include the MongoDB Atlas cluster tier, AWS PrivateLink for secure connections, ensuring the vector embedding size matches the dimension of the embedding model, and utilizing metadata filters for precise retrieval of relevant chunks based on applied filters.
The MongoDB Atlas vector store in Knowledge Bases for Amazon Bedrock is available in the US East (N. Virginia) and US West (Oregon) Regions. For more information, try out the MongoDB Atlas integration with Knowledge Bases for Amazon Bedrock and provide feedback to AWS re:Post or your usual AWS contacts. Engage with the generative AI builder community at community.aws for further collaboration.
Source link