Interface EmbeddingStore<Embedded>

Type Parameters:
Embedded - The class of the object that has been embedded. Typically, this is TextSegment.
All Known Implementing Classes:
AbstractAzureAiSearchEmbeddingStore, AstraDbEmbeddingStore, AzureAiSearchContentRetriever, AzureAiSearchEmbeddingStore, AzureCosmosDbMongoVCoreEmbeddingStore, 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 Details Link icon

    • add Link icon

      String add(Embedding embedding)
      Adds a given embedding to the store.
      Parameters:
      embedding - The embedding to be added to the store.
      Returns:
      The auto-generated ID associated with the added embedding.
    • add Link icon

      void add(String id, Embedding embedding)
      Adds a given embedding to the store.
      Parameters:
      id - The unique identifier for the embedding to be added.
      embedding - The embedding to be added to the store.
    • add Link icon

      String add(Embedding embedding, Embedded embedded)
      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 Link icon

      List<String> addAll(List<Embedding> embeddings)
      Adds multiple embeddings to the store.
      Parameters:
      embeddings - A list of embeddings to be added to the store.
      Returns:
      A list of auto-generated IDs associated with the added embeddings.
    • addAll Link icon

      default List<String> addAll(List<Embedding> embeddings, List<Embedded> embedded)
      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 Link icon

      default List<String> generateIds(int n)
      Generates list of UUID strings
      Parameters:
      n - - dimension of list
    • addAll Link icon

      default void addAll(List<String> ids, List<Embedding> embeddings, List<Embedded> embedded)
      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 Link icon

      default void remove(String id)
      Removes a single embedding from the store by ID.
      Parameters:
      id - The unique ID of the embedding to be removed.
    • removeAll Link icon

      default void removeAll(Collection<String> ids)
      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 Link icon

      default void removeAll(Filter filter)
      Removes all embeddings that match the specified Filter from the store.
      Parameters:
      filter - The filter to be applied to the Metadata of the TextSegment during removal. Only embeddings whose TextSegment's Metadata match the Filter will be removed.
    • removeAll Link icon

      default void removeAll()
      Removes all embeddings from the store.
    • search Link icon

      Searches for the most similar (closest in the embedding space) Embeddings.
      All search criteria are defined inside the EmbeddingSearchRequest.
      EmbeddingSearchRequest.filter() can be used to filter by various metadata entries (e.g., user/memory ID). Please note that not all EmbeddingStore implementations support Filtering.
      Parameters:
      request - A request to search in an EmbeddingStore. Contains all search criteria.
      Returns:
      An EmbeddingSearchResult containing all found Embeddings.