Class MilvusConfig
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault embedding dimension (matches the easy-rag local model / all-MiniLM-L6-v2).static final intDefault Milvus gRPC port. -
Method Summary
Modifier and TypeMethodDescriptionstatic MilvusConfig.Builderbuilder()intstatic MilvusConfigLoads Milvus settings fromeasyai.propertieson the classpath.host()static MilvusConfigConvenience factory for the common case: host, port, and collection name, with the default embeddingdimension().password()intport()username()
-
Field Details
-
DEFAULT_PORT
public static final int DEFAULT_PORTDefault Milvus gRPC port.- See Also:
-
DEFAULT_DIMENSION
public static final int DEFAULT_DIMENSIONDefault embedding dimension (matches the easy-rag local model / all-MiniLM-L6-v2).- See Also:
-
-
Method Details
-
host
-
port
public int port() -
collectionName
-
dimension
public int dimension() -
username
-
password
-
of
Convenience factory for the common case: host, port, and collection name, with the default embeddingdimension().- Parameters:
host- Milvus server hostnameport- Milvus server port (typically 19530)collectionName- the target collection- Returns:
- a new MilvusConfig
-
fromProperties
Loads Milvus settings fromeasyai.propertieson 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
-