Interface VectorStore
- All Superinterfaces:
Consumer<List<Document>>
,DocumentWriter
- All Known Implementing Classes:
InMemoryVectorStore
,MilvusVectorStore
,Neo4jVectorStore
,PgVectorStore
,PineconeVectorStore
,SimplePersistentVectorStore
The
VectorStore
interface defines the operations for managing and querying
documents in a vector database. It extends DocumentWriter
to support document
writing operations. Vector databases are specialized for AI applications, performing
similarity searches based on vector representations of data rather than exact matches.
This interface allows for adding, deleting, and searching documents based on their
similarity to a given query.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
void
Adds list ofDocument
s to the vector store.Deletes documents from the vector store.similaritySearch
(String query) Retrieves documents by query embedding similarity using the defaultSearchRequest
's' search criteria.similaritySearch
(SearchRequest request) Retrieves documents by query embedding similarity and metadata filters to retrieve exactly the number of nearest-neighbor results that match the request criteria.
-
Method Details
-
add
Adds list ofDocument
s to the vector store.- Parameters:
documents
- the list of documents to store. Throws an exception if the underlying provider checks for duplicate IDs.
-
accept
-
delete
Deletes documents from the vector store.- Parameters:
idList
- list of document ids for which documents will be removed.- Returns:
-
similaritySearch
Retrieves documents by query embedding similarity and metadata filters to retrieve exactly the number of nearest-neighbor results that match the request criteria.- Parameters:
request
- Search request for set search parameters, such as the query text, topK, similarity threshold and metadata filter expressions.- Returns:
- Returns documents th match the query request conditions.
-
similaritySearch
Retrieves documents by query embedding similarity using the defaultSearchRequest
's' search criteria.- Parameters:
query
- Text to use for embedding similarity comparison.- Returns:
- Returns a list of documents that have embeddings similar to the query text embedding.
-