Class WeaviateVectorStore

java.lang.Object
org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
org.springframework.ai.vectorstore.weaviate.WeaviateVectorStore
All Implemented Interfaces:
Consumer<List<Document>>, DocumentWriter, VectorStore, VectorStoreRetriever

public class WeaviateVectorStore extends AbstractObservationVectorStore
A vector store implementation that stores and retrieves vectors in a Weaviate 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.

Example usage with builder:


 // Create the vector store with builder
 WeaviateVectorStore vectorStore = WeaviateVectorStore.builder(weaviateClient, embeddingModel)
     .options(options)                     	  // Optional: use custom options
     .consistencyLevel(ConsistentLevel.QUORUM)  // Optional: Set consistency level (default: ONE)
     .filterMetadataFields(List.of(             // Optional: Configure filterable metadata fields
         MetadataField.text("country"),
         MetadataField.number("year")
     ))
     .build();
 
Since:
1.0.0
Author:
Christian Tzolov, EddĂș MelĂ©ndez, Josh Long, Soby Chacko, Thomas Vitale, Jonghoon Park