Home icon

Use LangChain and vector search on Amazon DocumentDB to build a generative AI chatbot

Database Blog



This article discusses building a generative AI chatbot using LangChain and vector search with Amazon DocumentDB. It shows how to leverage Amazon DocumentDB's support for vector search along with AWS AI services like Amazon Bedrock and SageMaker, as well as third-party tools like LangChain and OpenAI.

Specifically, the article covers:

  • How to use Retrieval Augmented Generation (RAG) with large language models (LLMs) to retrieve relevant data from a knowledge base and augment prompts
  • Creating an HNSW index on an Amazon DocumentDB collection for vector search
  • Loading and embedding documents from a PDF using LangChain and Amazon Titan Text Embeddings
  • Initializing a reasoning agent like Anthropic Claude from Amazon Bedrock
  • Using the RetrievalQA chain to query the vector index and generate answers
  • The benefits of combining DocumentDB's JSON flexibility with vector search for AI applications


Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

May 1
2024
Automate chatbot for document and data retrieval using Amazon Bedrock Agents and Knowledge Bases
Mar 17
2025
Build a .NET Context-Aware Generative AI Chatbot using Amazon Bedrock and LangChain
Jun 10
2024
Build a FedRAMP compliant generative AI-powered chatbot using Amazon Aurora Machine Learning and Amazon Bedrock
May 24
2024
How LeadSquared accelerated chatbot deployments with generative AI using Amazon Bedrock and Amazon Aurora PostgreSQL

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.