@infino-ai/langchain-infino
v0.0.1
Published
LangChain VectorStore for Infino — vector, full-text (BM25), hybrid (RRF), and SQL-native retrieval over one copy of your data on object storage.
Maintainers
Readme
@infino-ai/langchain-infino
LangChain.js over Infino — vector, full-text (BM25), hybrid (RRF), and SQL-native retrieval over one copy of your data on object storage.
Most "vector database" LangChain integrations expose only the vector slice of
their engine. Infino keeps your data in Apache Parquet on object storage and
runs BM25, vector, hybrid, and SQL retrieval over it from a single in-process
engine — no separate search cluster or vector store to keep in sync. This
package surfaces that whole retrieval surface, not just similaritySearch.
Infino never embeds: you bring a LangChain Embeddings object and the
integration supplies the vectors.
Installation
npm install @infino-ai/langchain-infino @langchain/core @infino-ai/infinoRuntime:
@infino-ai/infinois a native Node addon, so this runs in a Node.js runtime (incl. Node serverless functions) — not the Edge runtime or the browser. On serverless, point the catalog at object storage (s3://…), since there's no persistent local disk.
Quickstart
import { connect } from "@infino-ai/infino";
import { OpenAIEmbeddings } from "@langchain/openai";
import { InfinoVectorStore } from "@infino-ai/langchain-infino";
// A local path or an s3://bucket/prefix for durable storage; "memory://" is ephemeral.
const connection = connect("./data");
const embeddings = new OpenAIEmbeddings(); // dim must match the table — 1536 here
const store = await InfinoVectorStore.fromTexts(
["Infino runs search on object storage.", "One engine for SQL, BM25, and vectors."],
[{ source: "docs" }, { source: "docs" }],
embeddings,
{
connection,
tableName: "docs",
dim: 1536,
// Promote metadata keys to filterable scalar columns:
metadataColumns: { source: "large_utf8" },
},
);
const docs = await store.similaritySearch("search on S3", 2);
// Metadata filtering (compiled to a SQL WHERE over the promoted columns):
const filtered = await store.similaritySearch("search", 2, { source: { $eq: "docs" } });
// The whole retrieval surface, not just vectors:
const hybrid = await store.hybridSearch("search on object storage", 4); // BM25 + vector, RRF-fused
const lexical = await store.bm25Search("object storage", 4);
const retriever = store.asRetriever();Core concepts
- One table, one copy of the data.
doc_id(FTS-indexed) +page_content(FTS-indexed) +embedding+ any promoted metadata columns + a JSON catch-all for the rest. BM25, vector, hybrid, and SQL all run over it. - Bring your own embeddings. Pass any LangChain
Embeddings;dimmust match the model and the table's vector column. - Filtering.
filteris a structured metadata predicate ($eq,$ne,$gt/$gte/$lt/$lte,$in/$nin,$and/$or/$not) compiled to a SQLWHEREover the promoted metadata columns — declare those inmetadataColumnsat table creation.
API
InfinoVectorStore.fromTexts(texts, metadatas, embeddings, dbConfig)/fromDocuments(docs, embeddings, dbConfig)— create the table and insert.addDocuments/addVectors— upsert by id (re-adding overwrites).similaritySearch/similaritySearchWithScore/similaritySearchVectorWithScore(filtersupported).maxMarginalRelevanceSearch(query, { k, fetchK, lambda, filter }).hybridSearch(query, k)(BM25 + vector, RRF) ·bm25Search(query, k, mode).getByIds(ids)·delete({ ids })·asRetriever().
dbConfig: { connection, tableName, dim, metric?, nCent?, textColumn?, vectorColumn?, idColumn?, metadataColumns? }.
