Class AbstractObservationVectorStore
java.lang.Object
org.springframework.ai.vectorstore.observation.AbstractObservationVectorStore
- All Implemented Interfaces:
Consumer<List<Document>>
,DocumentWriter
,VectorStore
- Direct Known Subclasses:
AzureVectorStore
,CassandraVectorStore
,ChromaVectorStore
,CoherenceVectorStore
,CosmosDBVectorStore
,CouchbaseSearchVectorStore
,ElasticsearchVectorStore
,GemFireVectorStore
,HanaCloudVectorStore
,MariaDBVectorStore
,MilvusVectorStore
,MongoDBAtlasVectorStore
,Neo4jVectorStore
,OpenSearchVectorStore
,OracleVectorStore
,PgVectorStore
,PineconeVectorStore
,QdrantVectorStore
,RedisVectorStore
,SimpleVectorStore
,TypesenseVectorStore
,WeaviateVectorStore
Abstract base class for
VectorStore
implementations that provides observation
capabilities.- Since:
- 1.0.0
- Author:
- Christian Tzolov, Soby Chacko
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.ai.vectorstore.VectorStore
VectorStore.Builder<T extends VectorStore.Builder<T>>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AbstractObservationVectorStore instance with the specified builder settings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Create a newAbstractObservationVectorStore
instance.createObservationContextBuilder
(String operationName) Create a newVectorStoreObservationContext.Builder
instance.void
Deletes documents from the vector store.void
delete
(Filter.Expression filterExpression) Deletes documents from the vector store based on filter criteria.abstract void
Perform the actual add operation.abstract void
Perform the actual delete operation.protected void
doDelete
(Filter.Expression filterExpression) Template method for concrete implementations to provide filter-based deletion logic.doSimilaritySearch
(SearchRequest request) Perform the actual similarity search operation.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.document.DocumentWriter
write
Methods inherited from interface org.springframework.ai.vectorstore.VectorStore
accept, delete, getName, getNativeClient, similaritySearch
-
Field Details
-
embeddingModel
-
batchingStrategy
-
-
Constructor Details
-
AbstractObservationVectorStore
Creates a new AbstractObservationVectorStore instance with the specified builder settings. Initializes observation-related components and the embedding model.- Parameters:
builder
- the builder containing configuration settings
-
-
Method Details
-
add
Create a newAbstractObservationVectorStore
instance.- Specified by:
add
in interfaceVectorStore
- Parameters:
documents
- the documents to add
-
delete
Description copied from interface:VectorStore
Deletes documents from the vector store.- Specified by:
delete
in interfaceVectorStore
- Parameters:
deleteDocIds
- list of document ids for which documents will be removed.
-
delete
Description copied from interface:VectorStore
Deletes documents from the vector store based on filter criteria.- Specified by:
delete
in interfaceVectorStore
- Parameters:
filterExpression
- Filter expression to identify documents to delete
-
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.
-
doAdd
Perform the actual add operation.- Parameters:
documents
- the documents to add
-
doDelete
Perform the actual delete operation.- Parameters:
idList
- the list of document IDs to delete
-
doDelete
Template method for concrete implementations to provide filter-based deletion logic.- Parameters:
filterExpression
- Filter expression to identify documents to delete
-
doSimilaritySearch
Perform the actual similarity search operation.- Parameters:
request
- the search request- Returns:
- the list of documents that match the query request conditions
-
createObservationContextBuilder
public abstract VectorStoreObservationContext.Builder createObservationContextBuilder(String operationName) Create a newVectorStoreObservationContext.Builder
instance.- Parameters:
operationName
- the operation name- Returns:
- the observation context builder
-