A Chromia vector store for LangChain.js
LangChain.js lets you swap vector stores behind one interface: add documents, delete them, run a similarity search, or turn the store into a retriever. We wrote a Chromia vector store for @langchain/community so that a LangChain.js app can keep its embeddings on a Chromia blockchain. The work lives in our fork of langchain-ai/langchainjs. All credit for the framework goes to the LangChain maintainers and contributors.
What we added
The integration is about 400 lines in libs/langchain-community/src/vectorstores/chromia.ts, plus package wiring, two example scripts (search and delete) and a docs notebook. It extends LangChain's VectorStore base class and talks to Chromia through postchain-client, the standard Chromia client library.
You construct it with any LangChain embeddings model and a postchain client:
1import { Chromia } from "@langchain/community/vectorstores/chromia";23const vectorStore = new Chromia(embeddings, {4 client: postchainClient,5 numDimensions: embeddings.dimensions,6});
How it maps to Chromia
Writes and reads go to operations and queries defined on the Chromia side:
addDocumentsembeds the text andaddVectorssubmits anadd_messagesoperation in a transaction throughclient.sendTransaction.deletesubmits adelete_messagesoperation with the ids to remove.similaritySearchVectorWithScorecalls thequery_closest_objectsquery with the query vector and a query template (get_messages_with_distance), then turns the results back into LangChainDocumentobjects with a distance score and their metadata.
Because it implements the base class, the usual helpers work as expected: similaritySearch, similaritySearchWithScore, filtered search, fromTexts, fromDocuments, and asRetriever, including MMR retrieval.
A follow-up commit tightened the response handling and how stored metadata is parsed back into document metadata.
Upstream status
We opened the integration upstream as langchain-ai/langchainjs PR #8041. That PR was closed without being merged, so the code is not part of the published @langchain/community package. Anyone who wants to use it today can take the files from our fork, which is otherwise a plain mirror of upstream.
Why it matters to us
Chromia stores data in a relational model on chain, which makes it a reasonable place to keep agent memory that other parties can verify. Wrapping it as a standard LangChain vector store means an existing retrieval pipeline can point at Chromia by changing the store, without rewriting the rest of the chain.
