class FluentRedisVectorStoreAdvanced Redis Vector Store with structured metadata filtering.
This class provides advanced filtering capabilities through FilterExpression and requires explicit MetadataFieldSchema definition. It supports:
For basic filtering with simple string[] or string filters, use RedisVectorStore instead.
Embeddings interface for generating vector embeddings from text queries, enabling vector-based similarity searches.
Returns a string representing the type of vector store, which subclasses must implement to identify their specific vector storage type.
Method for adding documents to the RedisVectorStore. It first converts the documents to texts and then adds them as vectors.
Method for adding vectors to the FluentRedisVectorStore. It checks if the index exists and creates it if it doesn't, then adds the vectors in batches.
Creates a VectorStoreRetriever instance with flexible configuration options.
Method for checking if an index exists in the RedisVectorStore.
Method for creating an index in the FluentRedisVectorStore. Requires a customSchema to be defined for proper metadata indexing. If the index already exists, it does nothing.
Deletes vectors from the vector store.
Supports two deletion modes:
Method for dropping an index from the RedisVectorStore.
Return documents selected using the maximal marginal relevance. Maximal marginal relevance optimizes for similarity to the query AND diversity among selected documents.
Searches for documents similar to a text query by embedding the query and performing a similarity search on the resulting vector.
Method for performing a similarity search in the FluentRedisVectorStore. Returns documents and their similarity scores.
Searches for documents similar to a text query by embedding the query, and returns results with similarity scores.
Static method for creating a new instance of FluentRedisVectorStore from documents. It adds the documents to the FluentRedisVectorStore.
Static method for creating a new instance of FluentRedisVectorStore from texts. It creates documents from the texts and metadata, then adds them to the FluentRedisVectorStore.
The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.
Implemented as a static method to support loading logic.
const vectorStore = await FluentRedisVectorStore.fromDocuments(
docs,
embeddings,
{
redisClient: client,
indexName: "products",
customSchema: [
{ name: "category", type: "tag" },
{ name: "price", type: "numeric", options: { sortable: true } }
]
}
);
// Use advanced filtering
const results = await vectorStore.similaritySearch(
"laptop",
5,
Tag("category").eq("electronics").and(Num("price").lt(1000))
);