Builder
public static class Builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:842–1006构建器,用于构建并配置目标实例。位于 io.agentscope.core.rag.store 包。核心成员包括 uri、collectionName、dimensions、token、username、password。
Builder for creating MilvusStore instances with fluent configuration.
Example usage:
`MilvusStore store = MilvusStore.builder()
.uri("http://localhost:19530")
.collectionName("my_collection")
.dimensions(1024)
.token("root:Milvus")
.connectTimeoutMs(30000)
.metricType(IndexParam.MetricType.COSINE)
.build();
`
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder uri(String uri) | 设置URI。 Sets the Milvus server URI. |
public Builder collectionName(String collectionName) | 设置集合名称。 Sets the collection name. |
public Builder dimensions(int dimensions) | 设置向量维度。 Sets the vector dimensions. |
public Builder token(String token) | 设置令牌。 Sets the authentication token. |
public Builder username(String username) | 设置该配置项。 Sets the username for authentication. |
public Builder password(String password) | 设置密码。 Sets the password for authentication. |
public Builder connectTimeoutMs(long connectTimeoutMs) | 设置连接超时 Ms。 Sets the connection timeout in milliseconds. |
public Builder metricType(IndexParam.MetricType metricType) | 设置指标类型。 Sets the metric type for vector similarity search. |
public Builder databaseName(String databaseName) | 设置数据库名称。 Sets the database name. |
public Builder databaseProperties(Map<String, String> databaseProperties) | 设置数据库属性。 Sets the database properties. |
public MilvusStore build() throws VectorStoreException | 构建新的MilvusStore 实例。 Builds a new MilvusStore instance. |
方法详情Method Detail
uri
public Builder uri(String uri)
设置URI。
Sets the Milvus server URI.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
uri | String | URI(类型 `String`)。the Milvus server URI (e.g., "http://localhost:19530") |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:862–865collectionName
public Builder collectionName(String collectionName)
设置集合名称。
Sets the collection name.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
collectionName | String | 集合到使用的名称。the name of the collection to use |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:873–876dimensions
public Builder dimensions(int dimensions)
设置向量维度。
Sets the vector dimensions.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dimensions | int | 向量维度(类型 `int`)。the dimension of vectors that will be stored |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:884–887token
public Builder token(String token)
设置令牌。
Sets the authentication token.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
token | String | 令牌(类型 `String`)。the authentication token |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:897–900username
public Builder username(String username)
设置该配置项。
Sets the username for authentication.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
username | String | username(类型 `String`)。the username |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:910–913password
public Builder password(String password)
设置密码。
Sets the password for authentication.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
password | String | 密码。the password |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:923–926connectTimeoutMs
public Builder connectTimeoutMs(long connectTimeoutMs)
设置连接超时 Ms。
Sets the connection timeout in milliseconds.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
connectTimeoutMs | long | 连接超时 Ms(类型 `long`)。the connection timeout in milliseconds |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:936–939metricType
public Builder metricType(IndexParam.MetricType metricType)
设置指标类型。
Sets the metric type for vector similarity search.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
metricType | IndexParam.MetricType | 指标类型。the metric type |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:951–954databaseName
public Builder databaseName(String databaseName)
设置数据库名称。
Sets the database name.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
databaseName | String | 数据库名称。the database name |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:962–965databaseProperties
public Builder databaseProperties(Map<String, String> databaseProperties)
设置数据库属性。
Sets the database properties.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
databaseProperties | Map<String, String> | 数据库属性。the database properties |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/MilvusStore.java:973–976build
public MilvusStore build() throws VectorStoreException
构建新的MilvusStore 实例。
Builds a new MilvusStore instance.
MilvusStore一种新的MilvusStore 实例。a new MilvusStore instance
VectorStoreException可能抛出 `VectorStoreException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/core/rag/store/MilvusStore.java:988–1005