YDB is a versatile open source Distributed SQL Database that combines high availability and scalability with strong consistency and ACID transactions. It accommodates transactional (OLTP), analytical (OLAP), and streaming workloads simultaneously.This guide provides a quick overview for getting started with the
YDBVectorStore vector store. For detailed documentation of all features and configurations, head to the YDB LangChain.js guide.
Setup
Set up a local YDB instance with Docker:@ydbjs/langchain and @langchain/core to use this integration.
This guide uses OpenAI embeddings as an example. You can use other supported embeddings models instead.
Credentials
There are no credentials required for a local YDB instance. Make sure you have installed the packages shown above. If you are using OpenAI embeddings for this guide, set your OpenAI key:Instantiation
To instantiate the vector store, pass an embeddings model and a connection string. When the store creates the driver, it also manages its lifecycle:await using syntax automatically disposes of the store and closes its driver when the variable goes out of scope. If you do not use await using, call close() manually when you are finished:
Manage vector store
Add items to vector store
Add documents using theaddDocuments method. Documents without an ID receive auto-generated UUIDs, and re-inserting a document with an existing ID replaces it.
Delete items from vector store
Delete specific documents by ID:Query vector store
Once your vector store has been created and the relevant documents have been added, you will most likely wish to query it during the running of your chain or agent.Query directly
Perform a simple similarity search as follows:AND logic:
Query by turning into retriever
You can also transform the vector store into a retriever for easier usage in your chains:Usage for retrieval-augmented generation
For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:API reference
For detailed documentation of allYDBVectorStore features and configurations, including search strategies, approximate nearest-neighbor indexing, and column customization, head to the YDB LangChain.js guide.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

