Interface VDBStoreBase
- All Known Implementing Classes:
ElasticsearchStore,InMemoryStore,MilvusStore,PgVectorStore,QdrantStore
This interface provides a unified API for storing and searching vector embeddings. Implementations can use in-memory storage, Qdrant, ChromaDB, or other vector databases.
The store directly stores Document objects (including metadata/payload), not just vectors. This allows retrieval of complete documents with their metadata.
Key features:
- Batch document addition for efficiency
- Vector similarity search with optional score threshold
- Document retrieval with embeddings and metadata
-
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>Adds multiple documents to the store.reactor.core.publisher.Mono<Boolean>Deletes a document from the store (optional).reactor.core.publisher.Mono<List<io.agentscope.core.rag.model.Document>>search(SearchDocumentDto searchDocumentDto) Searches for similar documents.
-
Method Details
-
add
Adds multiple documents to the store.All documents must have embedding vectors set. The store will persist both the vectors and the document metadata/payloads.
This method supports batch operations for efficiency. Implementations should handle batch insertion optimally.
- Parameters:
documents- the list of documents to store (all must have embeddings set)- Returns:
- a Mono that completes when all documents are stored
-
search
reactor.core.publisher.Mono<List<io.agentscope.core.rag.model.Document>> search(SearchDocumentDto searchDocumentDto) Searches for similar documents.This method performs vector similarity search and returns the most similar documents. Results include the document metadata and similarity scores. Optionally, embeddings may also be included in the results (implementation-dependent).
- Parameters:
searchDocumentDto- the search document DTO- Returns:
- a Mono that emits a list of Document objects with scores set, sorted by similarity (descending)
-
delete
Deletes a document from the store (optional).Default implementation throws UnsupportedOperationException. Vector stores that support deletion should override this method.
- Parameters:
id- the document ID (UUID string) to delete- Returns:
- a Mono that emits true if the deletion was successful, false otherwise
-