Class WeaviateVectorStore
java.lang.Object
org.springframework.ai.vectorstore.WeaviateVectorStore
- All Implemented Interfaces:
Consumer<List<Document>>
,DocumentWriter
,VectorStore
,org.springframework.beans.factory.InitializingBean
public class WeaviateVectorStore
extends Object
implements VectorStore, org.springframework.beans.factory.InitializingBean
A VectorStore implementation backed by Weaviate vector database.
Note: You can assign arbitrary metadata fields with your Documents. Later will be
persisted and managed as Document fields. But only the metadata keys listed in
filterMetadataFields
can be used for similarity search
expression filters.- Author:
- Christian Tzolov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Configuration class for the WeaviateVectorStore. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWeaviateVectorStore
(WeaviateVectorStore.WeaviateVectorStoreConfig vectorStoreConfig, EmbeddingClient embeddingClient) Constructs a new WeaviateVectorStore. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds list ofDocument
s to the vector store.void
Deletes documents from the vector store.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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.ai.vectorstore.VectorStore
accept, similaritySearch
-
Field Details
-
DOCUMENT_METADATA_DISTANCE_KEY_NAME
- See Also:
-
-
Constructor Details
-
WeaviateVectorStore
public WeaviateVectorStore(WeaviateVectorStore.WeaviateVectorStoreConfig vectorStoreConfig, EmbeddingClient embeddingClient) Constructs a new WeaviateVectorStore.- Parameters:
vectorStoreConfig
- The configuration for the store.embeddingClient
- The client for embedding operations.
-
-
Method Details
-
add
Description copied from interface:VectorStore
Adds list ofDocument
s to the vector store.- Specified by:
add
in interfaceVectorStore
- Parameters:
documents
- the list of documents to store. Throws an exception if the underlying provider checks for duplicate IDs.
-
delete
Description copied from interface:VectorStore
Deletes documents from the vector store.- Specified by:
delete
in interfaceVectorStore
- Parameters:
documentIds
- list of document ids for which documents will be removed.- Returns:
-
similaritySearch
Description copied from interface:VectorStore
Retrieves documents by query embedding similarity and metadata filters to retrieve exactly the number of nearest-neighbor results that match the request criteria.- Specified by:
similaritySearch
in interfaceVectorStore
- 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.
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-