Announcing Azure Cosmos DB Vector Store Integration with LangChain.js!
We’re simplifying AI app development by integrating Azure Cosmos DB’s cost-effective and scalable vector search directly with LangChain.js! This powerful combination empowers JavaScript developers to efficiently manage fast and accurate data retrieval with Azure Cosmos DB’s scalability and efficient vector search capabilities. This offers a powerful solution for developers aiming to leverage vector search capabilities in their applications. Azure Cosmos DB supports vector indexing and search, allowing for efficient handling of high-dimensional vectors. By using Azure Cosmos DB’s vector store, developers can keep vectors directly within their documents, enabling seamless integration with LangChain.js for advanced vector search queries.
To get started, simply import the package using a package manager of your choice
- npm:
npm install @langchain/azure-cosmosdb @langchain/core
- yarn:
yarn add @langchain/azure-cosmosdb @langchain/core
- pnpm:
pnpm add @langchain/azure-cosmosdb @langchain/core
Check out the LangChain.js documentation for full details on installation. Next, you should be ready to start building AI apps with either Azure Cosmos DB for NoSQL or Azure Cosmos DB for MongoDB vCore.
Azure Cosmos DB for NoSQL
Azure Cosmos DB for NoSQL is a world-class schema-free database that has built-in vector indexing and search at any scale. This provides flexibility for developers, mission-critical workloads, and serverless applications.
You can easily import the integration functions for use in your JavaScript applications using:
import { AzureCosmosDBNoSQLVectorStore } from "@langchain/azure-cosmosdb";
Now you’re ready to start building AI apps using Azure Cosmos DB for NoSQL’s LangChain.js integration!
Azure Cosmos DB for MongoDB vCore
Azure Cosmos DB for MongoDB vCore provides a fully managed, MongoDB-compatible database service with native vector indexing and search capabilities. This allows developers to use their existing MongoDB skills and tools while benefiting from Azure’s robust infrastructure.
You can easily import the integration functions for use in your JavaScript applications using:
import { AzureCosmosDBMongoDBVectorStore, AzureCosmosDBMongoDBSimilarityType, } from "@langchain/azure-cosmosdb";
Now you’re ready to start building AI apps using Azure Cosmos DB for MongoDB vCore’s LangChain.js integration!
Build a Serverless AI Chat with RAG using LangChain.js
Creating AI applications can often feel daunting and time-intensive. However, leveraging LangChain.js alongside Azure Cosmos DB can significantly streamline the development process. In this sample, we’ll explore a chatbot application that utilizes a collection of enterprise documents to provide insightful responses to user inquiries. Check out the code on Github
To help you get started, we’ve included sample data that you can easily use, but feel free to substitute it with your own content! Our example features a fictional company, Contoso Real Estate, which enables customers to ask support-related questions about its products. The sample data encompasses essential documents, including the terms of service, privacy policy, and a support guide.
The application is made from multiple components and is a great starting point for building more complex AI applications.:
- A web app made with a single chat web component built with Lit and hosted on Azure Static Web Apps.
- A serverless API built with Azure Functions and using LangChain.js to ingest the documents and generate responses to the user chat queries.
- A database to store the text extracted from the documents and the vectors generated by LangChain.js, using Azure Cosmos DB for NoSQL.
- A file storage to store the source documents, using Azure Blob Storage.
And there you have it! Azure Cosmos DB now features vector store integration with LangChain.js, making it even easier for developers to take advantage of fast and efficient vector search capabilities in their JavaScript AI applications, and there are many ways to get started quickly.
Learn more about Vector Search in Azure Cosmos DB
- LangChain.js documentation
- Build a Serverless RAG Chatbot with Azure Cosmos DB + LangChain.JS
- Generative AI For Beginners
- Ask YouTube: LangChain.js + Azure Quickstart sample
- Azure Cosmos DB for NoSQL
- Azure Cosmos DB for MongoDB vCore
Leave a review
Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we’ll gift you $50. Get started here.
About Azure Cosmos DB
Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.
Try Azure Cosmos DB for free here. To stay in the loop on Azure Cosmos DB updates, follow us on X, YouTube, and LinkedIn.
0 comments