You need to enable JavaScript to run this app.
文档中心
向量数据库VikingDB

向量数据库VikingDB

复制全文
下载 pdf
库管理
GetOpenVikingCollection — 查询库详情
复制全文
下载 pdf
GetOpenVikingCollection — 查询库详情

GetOpenVikingCollection 用于查询指定 OpenViking 库的详情,返回库名、版本、项目、状态、VLM / Embedding 模型配置以及创建、更新时间。

说明

注意:
建议与创建库配合使用(CreateOpenVikingCollection - 创建库),创建库获取ResourceID,使用本接口轮询建库状态。
建库接口调用成功仅表示请求已受理,库尚未就绪。调用方须在建库后轮询本接口,待 Result.Status 变为 READY 后,才能调用检索、文件、命令等接口。
库状态流转:INIT(初始化中)→ READY(就绪)或 FAILED(初始化失败)。
本接口返回的模型配置中,Credentials[].ApiKey 始终脱敏。

前置条件

完成“数据库管理使用说明”页面的 AK/SK 获取后,可调用本接口。调用者需具备目标 OpenViking 库的查询权限。
调用前需获取目标库的 ResourceID,可在库信息页面查询,也可使用 CreateOpenVikingCollection 接口返回的库 ID。

请求接口

Action

GetOpenVikingCollection

请求方法

POST

Content-Type

application/json

请求参数

字段

类型

必填

说明

ResourceID

string

是

库 ID,形如 ov-xxxxxxxxxxxxxxxx。可从 CreateOpenVikingCollection 的响应或控制台库列表获取。

响应参数

字段

类型

说明

Name

string

库名(创建时指定)

Creator

string

创建者火山子账号名,通过 API 创建的库将返回 AK SK 所属的子账号名

Project

string

项目(创建时指定)

ResourceID

string

库 ID(创建库接口返回)

Version

string

库版本(个人版:developer;企业版:enterprise)

Description

string

库描述(创建时指定)

Status

string

库状态,枚举:

  • INIT:库初始化资源准备中
  • READY:创建成功,可使用
  • FAILED:创建失败

可轮询此字段查看建库进度

OpenvikingVersion

string

OpenViking 数据库内核版本

VLM

object

生成模型配置,返回 Credentials 列表,API Key 凭据脱敏返回

Embedding

object

Embedding 模型配置,返回 Credentials 列表,API Key 凭据脱敏返回

CreateTime

int64

创建时间(Unix 精确至秒)

UpdateTime

int64

更新时间(Unix 精确至秒)

OutputLanguageOverride

string

库的语言配置

库状态说明

状态

说明

调用方处理

INIT

库正在初始化,尚未就绪

继续轮询本接口,等待状态变化

READY

库已就绪

可调用检索、文件、命令等接口

FAILED

库初始化失败

停止等待就绪,排查初始化失败原因

模型配置

字段

类型

说明

ModelName

string

模型名,embedding只支持doubao-embedding-vision,vlm只支持doubao-seed-2.0-lite

ModelVersion

string

模型版本

Credentials

array

有序凭证列表(支持多凭证 failover),模型调用时,使用Credentials配置的顺序请求。

凭证对象列表元素

字段

类型

说明

Source

string

模型凭证来源,列表内不可重复,枚举值:
方舟接入点:volcengine
AgentPlan :agentplan
CodingPlan:codeplan

ApiKeyID

string

与 ApiKey 二选一返回

ApiKey

string

与 ApiKeyID 二选一返回

EndpointID

string

Source为volcengine时必填,其它来源禁填

常见错误码

HTTP 状态码

错误码

说明

400

InvalidParameter

请求参数缺失、格式错误或校验不通过,具体原因见错误消息

400

MissingParameter

缺少必填参数

401

AuthenticationError

签名缺失或无效

403

AuthenticationError

身份校验失败

403

AccessDenied

当前账号无权查询该 OpenViking 库

404

ResourceNotExist

指定的 OpenViking 库不存在

429

QuotaExceeded

超出配额或触发限流

500

InternalError

服务内部错误

完整示例

Python 请求示例

import os
import datetime
import hashlib
import hmac
from urllib.parse import quote

import requests, json

def norm_query(params):
    query = ""
    for key in sorted(params.keys()):
        if type(params[key]) == list:
            for k in params[key]:
                query = (
                        query + quote(key, safe="-_.~") + "=" + quote(k, safe="-_.~") + "&"
                )
        else:
            query = (query + quote(key, safe="-_.~") + "=" + quote(params[key], safe="-_.~") + "&")
    query = query[:-1]
    return query.replace("+", "%20")

def hmac_sha256(key: bytes, content: str):
    return hmac.new(key, content.encode("utf-8"), hashlib.sha256).digest()

def hash_sha256(content: str):
    return hashlib.sha256(content.encode("utf-8")).hexdigest()

class ClientForConsoleApi:
    def __init__(self, ak, sk, host, region):
        self.ak = ak
        self.sk = sk
        self.host = host
        self.region = region
        self.service_code = "vikingdb"
        self.version = "2025-06-09"

    def request(self, method, action, body, query=None, header=None):
        if query is None:
            query = {}
        if header is None:
            header = {}
        credential = {
            "access_key_id": self.ak,
            "secret_access_key": self.sk,
            "service": self.service_code,
            "region": self.region,
        }
        request_param = {
            "body": json.dumps(body),
            "host": self.host,
            "path": "/",
            "method": method,
            "content_type": 'application/json',
            "date": datetime.datetime.utcnow(),
            "query": {"Action": action, "Version": self.version, **query},
        }
        if body is None:
            request_param["body"] = ""
        x_date = request_param["date"].strftime("%Y%m%dT%H%M%SZ")
        short_x_date = x_date[:8]
        x_content_sha256 = hash_sha256(request_param["body"])
        sign_result = {
            "Host": request_param["host"],
            "X-Content-Sha256": x_content_sha256,
            "X-Date": x_date,
            "Content-Type": request_param["content_type"],
        }
        signed_headers_str = ";".join(
            ["content-type", "host", "x-content-sha256", "x-date"]
        )
        canonical_request_str = "\n".join(
            [request_param["method"].upper(),
             request_param["path"],
             norm_query(request_param["query"]),
             "\n".join(
                 [
                     "content-type:" + request_param["content_type"],
                     "host:" + request_param["host"],
                     "x-content-sha256:" + x_content_sha256,
                     "x-date:" + x_date,
                 ]
             ),
             "",
             signed_headers_str,
             x_content_sha256,
             ]
        )

        hashed_canonical_request = hash_sha256(canonical_request_str)
        credential_scope = "/".join([short_x_date, credential["region"], credential["service"], "request"])
        string_to_sign = "\n".join(["HMAC-SHA256", x_date, credential_scope, hashed_canonical_request])

        k_date = hmac_sha256(credential["secret_access_key"].encode("utf-8"), short_x_date)
        k_region = hmac_sha256(k_date, credential["region"])
        k_service = hmac_sha256(k_region, credential["service"])
        k_signing = hmac_sha256(k_service, "request")
        signature = hmac_sha256(k_signing, string_to_sign).hex()

        sign_result["Authorization"] = "HMAC-SHA256 Credential={}, SignedHeaders={}, Signature={}".format(
            credential["access_key_id"] + "/" + credential_scope,
            signed_headers_str,
            signature,
        )
        header = {**header, **sign_result}
        r = requests.request(method=method,
                             url="https://{}{}".format(request_param["host"], request_param["path"]),
                             headers=header,
                             params=request_param["query"],
                             data=request_param["body"],
                             )
        return r.status_code, r.headers, r.json()

if __name__ == '__main__':
    client = ClientForConsoleApi(
        ak = "*",#替换为您的 AK
        sk ="*" ,#替换为您的 SK
        host="vikingdb.cn-beijing.volcengineapi.com", #替换为您所在地区的域名
        region="cn-beijing"
    )
    http_code, _, result_json = client.request(
        method="POST",
        action="GetOpenVikingCollection",#action替换为当前操作
        body={
          "ResourceID": "ov-20250609ab--ef01"
        }
    )
    print("req http status code: ", http_code)
    print("req result: \n", result_json)

响应示例

{
  "ResponseMetadata": {
    "RequestId": "202506091030001A2B3C4D5E6F",
    "Action": "GetOpenVikingCollection",
    "Version": "2025-06-09",
    "Service": "vikingdb",
    "Region": "cn-beijing"
  },
  "Result": {
    "Name": "my_collection",
    "Creator": "user_name",
    "Project": "default",
    "ResourceID": "ov-20250609abcdef01",
    "Version": "enterprise",
    "Source": "volcengine",
    "Description": "示例库",
    "Status": "INIT",
    "OpenvikingVersion": "0.4.17",
    "OutputLanguageOverride": "auto",
    "VLM": {
      "ModelName": "doubao-seed-2.0-lite",
      "ModelVersion":"251215",
      "Credentials": [ { "Source": "agentplan", "ApiKey": "your-a****-key" } ]
    },
    "Embedding": {
      "ModelName": "doubao-embedding-vision",
      "ModelVersion":"251215",
      "Credentials": [ { "Source": "agentplan", "ApiKey": "your-a****-key" } ]
    },
    "CreateTime": 1732000000,
    "UpdateTime": 1732003600
  }
}
最近更新时间:2026.09.10 22:39:10
这个页面对您有帮助吗?
有用
有用
无用
无用