全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

初始化

最近更新时间:2026-11-05 15:15:23

Ks3VectorsClient 是 KS3 Vector 的 Java 客户端,用于管理向量存储桶、向量索引、向量。

初始化 Ks3VectorsClient

要使用 Java SDK 发起 KS3 Vector 请求,需先初始化一个 Ks3VectorsClient 实例,示例代码如下。

/**
 * 初始化向量客户端
 *
 * <p>向量桶使用独立域名 {@code ks3vectors.<region>.ksyuncs.com} 与独立签名(service=s3vectors),
 * 仅支持 V4 签名。endpoint/region 有默认值(BEIJING),可经 Builder 覆盖。</p>
 *
 * @return 已配置好的 {@link Ks3VectorsClient},调用方负责 {@link Ks3VectorsClient#shutdown()}
 */
private Ks3VectorsClient initVectorsClient() {
    // 金山云账号 AccessKey 拥有所有 API 访问权限,风险很高。强烈建议创建并使用子账号。
    String accessKeyId = "yourAccessKey";
    String accessKeySecret = "yourSecretKey";
    CredentialsProvider credentialsProvider = new StaticCredentialsProvider(accessKeyId, accessKeySecret);

    // 默认 endpoint=ks3vectors-cn-beijing.ksyuncs.com、region=BEIJING
    // 如需其它地域或内网,通过链式调用覆盖默认值:
    //   .endpoint("ks3vectors-cn-shanghai.ksyuncs.com").region("SHANGHAI")
    return Ks3VectorsClient.newBuilder()
            .credentialsProvider(credentialsProvider)
            .build();
}
文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈