Builder
public static class Builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:904–1042构建器,用于构建并配置目标实例。位于 io.agentscope.core.rag.store 包。核心成员包括 jdbcUrl、username、password、schema、tableName、dimensions。
Builder for creating PgVectorStore instances with fluent configuration.
Example usage:
`PgVectorStore store = PgVectorStore.builder()
.jdbcUrl("jdbc:postgresql://localhost:5432/mydb")
.username("postgres")
.password("password")
.schema("my_schema")
.tableName("embeddings")
.dimensions(1024)
.distanceType(PgVectorStore.DistanceType.COSINE)
.connectionTimeoutMs(30000)
.build();
`
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder jdbcUrl(String jdbcUrl) | 设置PostgreSQL JDBC URL。 Sets the PostgreSQL JDBC URL. |
public Builder username(String username) | 设置该配置项。 Sets the database username. |
public Builder password(String password) | 设置数据库密码。 Sets the database password. |
public Builder schema(String schema) | 设置数据库模式。 Sets the database schema. |
public Builder tableName(String tableName) | 设置该配置项。 Sets the table name. |
public Builder dimensions(int dimensions) | 设置向量维度。 Sets the vector dimensions. |
public Builder distanceType(DistanceType distanceType) | 设置该配置项。 Sets the distance type for vector similarity search. |
public Builder connectionTimeoutMs(long connectionTimeoutMs) | 设置连接超时 Ms。 Sets the connection timeout in milliseconds. |
public PgVectorStore build() throws VectorStoreException | 构建新的PgVectorStore 实例。 Builds a new PgVectorStore instance. |
方法详情Method Detail
jdbcUrl
public Builder jdbcUrl(String jdbcUrl)
设置PostgreSQL JDBC URL。
Sets the PostgreSQL JDBC URL.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
jdbcUrl | String | JDBC URL(类型 `String`)。the JDBC URL (e.g., "jdbc:postgresql://localhost:5432/mydb") |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:922–925username
public Builder username(String username)
设置该配置项。
Sets the database username.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
username | String | username(类型 `String`)。the username |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:933–936password
public Builder password(String password)
设置数据库密码。
Sets the database password.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
password | String | 密码。the password |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:944–947schema
public Builder schema(String schema)
设置数据库模式。
Sets the database schema.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
schema | String | 模式定义(类型 `String`)。the schema name (e.g., "my_schema") |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:957–960tableName
public Builder tableName(String tableName)
设置该配置项。
Sets the table name.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
tableName | String | table 名称(类型 `String`)。the name of the table to use |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:968–971dimensions
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/PgVectorStore.java:979–982distanceType
public Builder distanceType(DistanceType distanceType)
设置该配置项。
Sets the distance type for vector similarity search.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
distanceType | DistanceType | distance 类型(类型 `DistanceType`)。the distance type |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:992–995connectionTimeoutMs
public Builder connectionTimeoutMs(long connectionTimeoutMs)
设置连接超时 Ms。
Sets the connection timeout in milliseconds.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
connectionTimeoutMs | long | 连接超时 Ms(类型 `long`)。the connection timeout in milliseconds |
Builder返回当前实例,以支持链式调用。this builder
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:1005–1008build
public PgVectorStore build() throws VectorStoreException
构建新的PgVectorStore 实例。
Builds a new PgVectorStore instance.
PgVectorStore一种新的PgVectorStore 实例。a new PgVectorStore instance
VectorStoreException可能抛出 `VectorStoreException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/core/rag/store/PgVectorStore.java:1020–1041