AS AgentScopeAPI 手册 / API Reference

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
jdbcUrlStringJDBC URL(类型 `String`)。the JDBC URL (e.g., "jdbc:postgresql://localhost:5432/mydb")
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/PgVectorStore.java:922–925

username

public Builder username(String username)

设置该配置项。

Sets the database username.

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

password

public Builder password(String password)

设置数据库密码。

Sets the database password.

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

schema

public Builder schema(String schema)

设置数据库模式。

Sets the database schema.

参数Parameters
名称Name类型Type说明Description
schemaString模式定义(类型 `String`)。the schema name (e.g., "my_schema")
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/PgVectorStore.java:957–960

tableName

public Builder tableName(String tableName)

设置该配置项。

Sets the table name.

参数Parameters
名称Name类型Type说明Description
tableNameStringtable 名称(类型 `String`)。the name of the table to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/PgVectorStore.java:968–971

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/PgVectorStore.java:979–982

distanceType

public Builder distanceType(DistanceType distanceType)

设置该配置项。

Sets the distance type for vector similarity search.

参数Parameters
名称Name类型Type说明Description
distanceTypeDistanceTypedistance 类型(类型 `DistanceType`)。the distance type
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/core/rag/store/PgVectorStore.java:992–995

connectionTimeoutMs

public Builder connectionTimeoutMs(long connectionTimeoutMs)

设置连接超时 Ms。

Sets the connection timeout in milliseconds.

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

build

public PgVectorStore build() throws VectorStoreException

构建新的PgVectorStore 实例。

Builds a new PgVectorStore instance.

返回Returns PgVectorStore
一种新的PgVectorStore 实例。a new PgVectorStore instance
抛出Throws
  • VectorStoreException 可能抛出 `VectorStoreException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/core/rag/store/PgVectorStore.java:1020–1041
基于官方固定版本源码静态生成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.