AS AgentScopeAPI 手册 / API Reference

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
uriStringURI(类型 `String`)。the Milvus server URI (e.g., "http://localhost:19530")
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:862–865

collectionName

public Builder collectionName(String collectionName)

设置集合名称。

Sets the collection name.

参数Parameters
名称Name类型Type说明Description
collectionNameString集合到使用的名称。the name of the collection to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:873–876

dimensions

public Builder dimensions(int dimensions)

设置向量维度。

Sets the vector dimensions.

参数Parameters
名称Name类型Type说明Description
dimensionsint向量维度(类型 `int`)。the dimension of vectors that will be stored
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:884–887

token

public Builder token(String token)

设置令牌。

Sets the authentication token.

参数Parameters
名称Name类型Type说明Description
tokenString令牌(类型 `String`)。the authentication token
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:897–900

username

public Builder username(String username)

设置该配置项。

Sets the username for authentication.

参数Parameters
名称Name类型Type说明Description
usernameStringusername(类型 `String`)。the username
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:910–913

password

public Builder password(String password)

设置密码。

Sets the password for authentication.

参数Parameters
名称Name类型Type说明Description
passwordString密码。the password
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:923–926

connectTimeoutMs

public Builder connectTimeoutMs(long connectTimeoutMs)

设置连接超时 Ms。

Sets the connection timeout in milliseconds.

参数Parameters
名称Name类型Type说明Description
connectTimeoutMslong连接超时 Ms(类型 `long`)。the connection timeout in milliseconds
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:936–939

metricType

public Builder metricType(IndexParam.MetricType metricType)

设置指标类型。

Sets the metric type for vector similarity search.

参数Parameters
名称Name类型Type说明Description
metricTypeIndexParam.MetricType指标类型。the metric type
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:951–954

databaseName

public Builder databaseName(String databaseName)

设置数据库名称。

Sets the database name.

参数Parameters
名称Name类型Type说明Description
databaseNameString数据库名称。the database name
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:962–965

databaseProperties

public Builder databaseProperties(Map<String, String> databaseProperties)

设置数据库属性。

Sets the database properties.

参数Parameters
名称Name类型Type说明Description
databasePropertiesMap<String, String>数据库属性。the database properties
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/MilvusStore.java:973–976

build

public MilvusStore build() throws VectorStoreException

构建新的MilvusStore 实例。

Builds a new MilvusStore instance.

返回Returns MilvusStore
一种新的MilvusStore 实例。a new MilvusStore instance
抛出Throws
  • VectorStoreException 可能抛出 `VectorStoreException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/core/rag/store/MilvusStore.java:988–1005
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.