Class MilvusConfig

java.lang.Object
dyntabs.ai.rag.MilvusConfig

public final class MilvusConfig extends Object
Immutable connection settings for a Milvus vector database collection.

Analogy: think of MilvusConfig as a JDBC connection URL — but for vectors instead of rows. Just as jdbc:postgresql://host:5432/mydb tells JDBC where the table lives, a MilvusConfig tells EasyAI where the embedding collection lives (host, port, collection) plus the one extra thing vectors need that SQL tables don't: the embedding dimension().

Used by both the ingestion side (EasyAI.indexer()) and the retrieval side (AssistantBuilder.withMilvus(MilvusConfig)), so a single MilvusConfig can describe "where the vectors live" for the whole round trip.

Create explicitly


 MilvusConfig cfg = MilvusConfig.of("localhost", 19530, "documents");
 

Or read from easyai.properties

 easyai.milvus.host=localhost
 easyai.milvus.port=19530
 easyai.milvus.collection=documents
 easyai.milvus.dimension=384
 

 MilvusConfig cfg = MilvusConfig.fromProperties();
 

The default dimension() is 384, matching the local embedding model bundled with the langchain4j-easy-rag module (and the widely used all-MiniLM-L6-v2). If you embed with a different model, set the matching dimension or Milvus will reject the inserts.

  • Field Details

    • DEFAULT_PORT

      public static final int DEFAULT_PORT
      Default Milvus gRPC port.
      See Also:
    • DEFAULT_DIMENSION

      public static final int DEFAULT_DIMENSION
      Default embedding dimension (matches the easy-rag local model / all-MiniLM-L6-v2).
      See Also:
  • Method Details

    • host

      public String host()
    • port

      public int port()
    • collectionName

      public String collectionName()
    • dimension

      public int dimension()
    • username

      public String username()
    • password

      public String password()
    • of

      public static MilvusConfig of(String host, int port, String collectionName)
      Convenience factory for the common case: host, port, and collection name, with the default embedding dimension().
      Parameters:
      host - Milvus server hostname
      port - Milvus server port (typically 19530)
      collectionName - the target collection
      Returns:
      a new MilvusConfig
    • fromProperties

      public static MilvusConfig fromProperties()
      Loads Milvus settings from easyai.properties on the classpath.

      Recognised keys: easyai.milvus.host, easyai.milvus.port, easyai.milvus.collection, easyai.milvus.dimension, easyai.milvus.username, easyai.milvus.password.

      Returns:
      a MilvusConfig populated from the properties file (with defaults applied)
    • builder

      public static MilvusConfig.Builder builder()