Class CoherenceVectorStore
java.lang.Object
org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
org.springframework.ai.vectorstore.coherence.CoherenceVectorStore
- All Implemented Interfaces:
Consumer<List<Document>>,DocumentWriter,VectorStore,VectorStoreRetriever,org.springframework.beans.factory.InitializingBean
public class CoherenceVectorStore
extends AbstractObservationVectorStore
implements org.springframework.beans.factory.InitializingBean
Integration of Coherence Coherence 24.09+ as a Vector Store.
Coherence Coherence 24.09 (or later) provides numerous features useful for artificial intelligence such as Vectors, Similarity search, HNSW indexes, and binary quantization.
This Spring AI Vector store supports the following features:
- Vectors with unspecified or fixed dimensions
- Distance type for similarity search (note that similarity threshold can be used only with distance type COSINE and DOT when ingested vectors are normalized, see forcedNormalization)
- Vector indexes (HNSW or Binary Quantization)
- Exact and Approximate similarity search
- Filter expression evaluation
- Since:
- 1.0.0
- Author:
- Aleks Seovic, Thomas Vitale
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for creatingCoherenceVectorStoreinstances.static enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final CoherenceVectorStore.DistanceTypestatic final Stringstatic final CoherenceFilterExpressionConverterFields inherited from class org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
batchingStrategy, embeddingModel -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProtected constructor that accepts a builder instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidstatic CoherenceVectorStore.Builderbuilder(com.tangosol.net.Session session, EmbeddingModel embeddingModel) Creates a new builder for configuring and creating CoherenceVectorStore instances.createObservationContextBuilder(String operationName) Create a newVectorStoreObservationContext.Builderinstance.voidPerform the actual add operation.voidPerform the actual delete operation.doSimilaritySearch(SearchRequest request) Perform the actual similarity search operation.<T> Optional<T> Returns the native client if available in this vector store implementation.Methods inherited from class org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
add, delete, delete, doDelete, similaritySearchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.ai.document.DocumentWriter
writeMethods inherited from interface org.springframework.ai.vectorstore.VectorStore
accept, delete, getNameMethods inherited from interface org.springframework.ai.vectorstore.VectorStoreRetriever
similaritySearch
-
Field Details
-
DEFAULT_MAP_NAME
- See Also:
-
DEFAULT_DISTANCE_TYPE
-
FILTER_EXPRESSION_CONVERTER
-
-
Constructor Details
-
CoherenceVectorStore
Protected constructor that accepts a builder instance. This is the preferred way to create new CoherenceVectorStore instances.- Parameters:
builder- the configured builder instance
-
-
Method Details
-
builder
public static CoherenceVectorStore.Builder builder(com.tangosol.net.Session session, EmbeddingModel embeddingModel) Creates a new builder for configuring and creating CoherenceVectorStore instances.- Returns:
- a new builder instance
-
doAdd
Description copied from class:AbstractObservationVectorStorePerform the actual add operation.- Specified by:
doAddin classAbstractObservationVectorStore- Parameters:
documents- the documents to add
-
doDelete
Description copied from class:AbstractObservationVectorStorePerform the actual delete operation.- Specified by:
doDeletein classAbstractObservationVectorStore- Parameters:
idList- the list of document IDs to delete
-
doSimilaritySearch
Description copied from class:AbstractObservationVectorStorePerform the actual similarity search operation.- Specified by:
doSimilaritySearchin classAbstractObservationVectorStore- Parameters:
request- the search request- Returns:
- the list of documents that match the query request conditions
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
createObservationContextBuilder
Description copied from class:AbstractObservationVectorStoreCreate a newVectorStoreObservationContext.Builderinstance.- Specified by:
createObservationContextBuilderin classAbstractObservationVectorStore- Parameters:
operationName- the operation name- Returns:
- the observation context builder
-
getNativeClient
Description copied from interface:VectorStoreReturns the native client if available in this vector store implementation. Note on usage: 1. Returns empty Optional when no native client is available 2. Due to Java type erasure, runtime type checking is not possible Example usage: When working with implementation with known native client: Optionalclient = vectorStore.getNativeClient(); Note: Using Optionalinvalid input: '<'?> will return the native client if one exists, rather than an empty Optional. For type safety, prefer using the specific client type. - Specified by:
getNativeClientin interfaceVectorStore- Type Parameters:
T- The type of the native client- Returns:
- Optional containing native client if available, empty Optional otherwise
-