Class CouchbaseEmbeddingStore

java.lang.Object
dev.langchain4j.store.embedding.couchbase.CouchbaseEmbeddingStore
All Implemented Interfaces:
dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>

public class CouchbaseEmbeddingStore extends Object implements dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
Represents a Couchbase index as an embedding store. Current implementation assumes the index uses the cosine distance metric.
Supports storing Metadata
  • Constructor Details

    • CouchbaseEmbeddingStore

      public CouchbaseEmbeddingStore(String clusterUrl, String username, String password, String bucketName, String scopeName, String collectionName, String searchIndexName, Integer dimensions)
      Creates an instance of CouchbaseEmbeddingStore
      Parameters:
      clusterUrl - the url of the couchbase cluster to be used by the store
      username - username on the cluster
      password - password on the cluster
      bucketName - name of a cluster bucket in which to store the embeddings
      scopeName - name of a scope in the bucket in which to store the embeddings
      collectionName - name of a collection in the scope in which to store the embeddings
      searchIndexName - name of the FTS index to be used for searching embeddings
      dimensions - expected size (dimensionality) of vectors that will be stored
    • CouchbaseEmbeddingStore

      public CouchbaseEmbeddingStore(String clusterUrl, String username, String password, String bucketName, String scopeName, String collectionName, String searchIndexName, Integer dimensions, Integer bucketTimeout)
      Creates an instance of CouchbaseEmbeddingStore
      Parameters:
      clusterUrl - the url of the couchbase cluster to be used by the store
      username - username on the cluster
      password - password on the cluster
      bucketName - name of a cluster bucket in which to store the embeddings
      scopeName - name of a scope in the bucket in which to store the embeddings
      collectionName - name of a collection in the scope in which to store the embeddings
      searchIndexName - name of the FTS index to be used for searching embeddings
      dimensions - expected size (dimensionality) of vectors that will be stored
      bucketTimeout - bucket connection timeout
  • Method Details

    • add

      public String add(dev.langchain4j.data.embedding.Embedding embedding)
      Specified by:
      add in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • add

      public void add(@NonNull String id, @NonNull dev.langchain4j.data.embedding.Embedding embedding)
      Specified by:
      add in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • add

      public String add(@NonNull dev.langchain4j.data.embedding.Embedding embedding, @Nullable dev.langchain4j.data.segment.TextSegment textSegment)
      Specified by:
      add in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • addAll

      public List<String> addAll(@NonNull List<dev.langchain4j.data.embedding.Embedding> embeddings)
      Specified by:
      addAll in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • addAll

      public void addAll(List<String> ids, List<dev.langchain4j.data.embedding.Embedding> embeddings, List<dev.langchain4j.data.segment.TextSegment> embedded)
      Specified by:
      addAll in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • removeAll

      public void removeAll(Collection<String> ids)
      Specified by:
      removeAll in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • removeAll

      public void removeAll()
      Specified by:
      removeAll in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • search

      public dev.langchain4j.store.embedding.EmbeddingSearchResult<dev.langchain4j.data.segment.TextSegment> search(dev.langchain4j.store.embedding.EmbeddingSearchRequest request)
      Specified by:
      search in interface dev.langchain4j.store.embedding.EmbeddingStore<dev.langchain4j.data.segment.TextSegment>
    • builder

      public static CouchbaseEmbeddingStore.Builder builder()