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 notebook shows how to use functionality related to the
YDB
vector store.
Setup
First, set up a local YDB with Docker:langchain-ydb
to use this integration
Credentials
There are no credentials for this notebook, just make sure you have installed the packages as shown above. If you want to get best in-class automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:Initialization
Manage vector store
Once you have created your vector store, you can interact with it by adding and deleting different items.Add items to vector store
Prepare documents to work with:add_documents
function.
Delete items from vector store
You can delete items from your vector store by ID using thedelete
function.
Query vector store
Once your vector store has been created and relevant documents have been added, you will likely want to query it during the execution of your chain or agent.Query directly
Similarity search
A simple similarity search can be performed as follows:Similarity search with score
You can also perform a search with a score:Filtering
You can search with filters as described below:Query by turning into retriever
You can also transform the vector store into a retriever for easier usage in your chains. Here’s how to transform your vector store into a retriever and then invoke the retriever with a simple query and filter.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 allYDB
features and configurations head to the API reference:python.langchain.com/api_reference/community/vectorstores/langchain_community.vectorstores.ydb.YDB.html