Skip to main content
turbopuffer is a fast, cost-efficient vector database for search and retrieval.
This guide shows how to use the TurbopufferVectorStore with LangChain.

Setup

To use the turbopuffer vector store, you need to install the langchain-turbopuffer integration package.

Credentials

Create a turbopuffer account at turbopuffer.com and get an API key.
If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:

Initialization

Create a turbopuffer client and namespace, then initialize the vector store:

Manage vector store

Once you have created your vector store, you can interact with it by adding and deleting items.

Add items to vector store

Delete items from vector store

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

Performing a simple similarity search can be done as follows:

Similarity search with score

You can also search with score. Lower distance means more similar:

Query by turning into retriever

You can also transform the vector store into a retriever for easier usage in your chains.

Filtering

turbopuffer supports metadata filtering using tuple expressions. Pass filters to any search method:
See the turbopuffer filter documentation for the full list of supported filter operators.