Interface EmbeddingStore<Embedded>
- Type Parameters:
Embedded- The class of the object that has been embedded. Typically, this isTextSegment.
- All Known Implementing Classes:
AbstractAzureAiSearchEmbeddingStore, AbstractAzureCosmosDBNoSqlEmbeddingStore, AstraDbEmbeddingStore, AzureAiSearchContentRetriever, AzureAiSearchEmbeddingStore, AzureCosmosDbMongoVCoreEmbeddingStore, AzureCosmosDBNoSqlContentRetriever, AzureCosmosDbNoSqlEmbeddingStore, CassandraEmbeddingStore, ChromaEmbeddingStore, CoherenceEmbeddingStore, CouchbaseEmbeddingStore, ElasticsearchEmbeddingStore, InfinispanEmbeddingStore, InMemoryEmbeddingStore, MariaDbEmbeddingStore, MilvusEmbeddingStore, MongoDbEmbeddingStore, OpenSearchEmbeddingStore, OracleEmbeddingStore, PgVectorEmbeddingStore, PineconeEmbeddingStore, QdrantEmbeddingStore, TablestoreEmbeddingStore, VespaEmbeddingStore, WeaviateEmbeddingStore
public interface EmbeddingStore<Embedded>
Represents a store for embeddings, also known as a vector database.
-
Method Summary
Modifier and TypeMethodDescriptionAdds a given embedding to the store.Adds a given embedding and the corresponding content that has been embedded to the store.voidAdds a given embedding to the store.Adds multiple embeddings to the store.Adds multiple embeddings and their corresponding contents that have been embedded to the store.default voidAdds multiple embeddings and their corresponding contents that have been embedded to the store.generateIds(int n) Generates list of UUID stringsdefault voidRemoves a single embedding from the store by ID.default voidRemoves all embeddings from the store.default voidRemoves all embeddings that match the specifiedFilterfrom the store.default voidremoveAll(Collection<String> ids) Removes all embeddings that match the specified IDs from the store.search(EmbeddingSearchRequest request) Searches for the most similar (closest in the embedding space)Embeddings.
-
Method Details
-
add
-
add
-
add
Adds a given embedding and the corresponding content that has been embedded to the store.- Parameters:
embedding- The embedding to be added to the store.embedded- Original content that was embedded.- Returns:
- The auto-generated ID associated with the added embedding.
-
addAll
-
addAll
Adds multiple embeddings and their corresponding contents that have been embedded to the store.- Parameters:
embeddings- A list of embeddings to be added to the store.embedded- A list of original contents that were embedded.- Returns:
- A list of auto-generated IDs associated with the added embeddings.
-
generateIds
-
addAll
Adds multiple embeddings and their corresponding contents that have been embedded to the store.- Parameters:
ids- A list of IDs associated with the added embeddings.embeddings- A list of embeddings to be added to the store.embedded- A list of original contents that were embedded.
-
remove
Removes a single embedding from the store by ID.- Parameters:
id- The unique ID of the embedding to be removed.
-
removeAll
Removes all embeddings that match the specified IDs from the store.- Parameters:
ids- A collection of unique IDs of the embeddings to be removed.
-
removeAll
Removes all embeddings that match the specifiedFilterfrom the store.- Parameters:
filter- The filter to be applied to theMetadataof theTextSegmentduring removal. Only embeddings whoseTextSegment'sMetadatamatch theFilterwill be removed.
-
removeAll
default void removeAll()Removes all embeddings from the store. -
search
Searches for the most similar (closest in the embedding space)Embeddings.
All search criteria are defined inside theEmbeddingSearchRequest.
EmbeddingSearchRequest.filter()can be used to filter by various metadata entries (e.g., user/memory ID). Please note that not allEmbeddingStoreimplementations supportFiltering.- Parameters:
request- A request to search in anEmbeddingStore. Contains all search criteria.- Returns:
- An
EmbeddingSearchResultcontaining all foundEmbeddings.
-