Class QdrantStore.Builder

java.lang.Object
io.agentscope.core.rag.store.QdrantStore.Builder
Enclosing class:
QdrantStore

public static class QdrantStore.Builder extends Object
Builder for creating QdrantStore instances with fluent configuration.

Example usage:


 QdrantStore store = QdrantStore.builder()
     .location("http://localhost:6333")
     .collectionName("my_collection")
     .dimensions(1024)
     .apiKey("my-api-key")
     .useTransportLayerSecurity(true)
     .checkCompatibility(false)
     .build();
 
  • Method Details

    • location

      public QdrantStore.Builder location(String location)
      Sets the Qdrant server location.
      Parameters:
      location - the Qdrant server location (e.g., "http://localhost:6333" or "localhost:6334")
      Returns:
      this builder
    • collectionName

      public QdrantStore.Builder collectionName(String collectionName)
      Sets the collection name.
      Parameters:
      collectionName - the name of the collection to use
      Returns:
      this builder
    • dimensions

      public QdrantStore.Builder dimensions(int dimensions)
      Sets the vector dimensions.
      Parameters:
      dimensions - the dimension of vectors that will be stored
      Returns:
      this builder
    • apiKey

      public QdrantStore.Builder apiKey(String apiKey)
      Sets the API key for authentication.
      Parameters:
      apiKey - the API key (optional, null for no authentication)
      Returns:
      this builder
    • useTransportLayerSecurity

      public QdrantStore.Builder useTransportLayerSecurity(boolean useTransportLayerSecurity)
      Sets whether to use Transport Layer Security (TLS) for gRPC connections.

      Default is false. Set to true to enable TLS encryption for secure connections.

      Parameters:
      useTransportLayerSecurity - true to enable TLS, false otherwise
      Returns:
      this builder
    • checkCompatibility

      public QdrantStore.Builder checkCompatibility(boolean checkCompatibility)
      Sets whether to check client-server compatibility.

      Default is true. Set to false to skip version compatibility checks, which can be useful when connecting to older Qdrant servers or when compatibility checks fail incorrectly.

      Parameters:
      checkCompatibility - true to enable compatibility checks, false to skip
      Returns:
      this builder
    • build

      public QdrantStore build() throws VectorStoreException
      Builds a new QdrantStore instance.

      The client connection is established immediately during construction. If the connection fails or the collection cannot be created, a VectorStoreException is thrown.

      Returns:
      a new QdrantStore instance
      Throws:
      IllegalArgumentException - if required parameters are invalid
      VectorStoreException - if client initialization or collection creation fails