☁️
CF WIKI
← 返回产品目录 | 内容快照:2026-06-16
数据 / 存储

Vectorize

向量数据库,用于相似度搜索、RAG、推荐和分类。

官方文档 ↗
按向量数 + 查询次数计费。
向量RAGAI
知识库问答、语义搜索、推荐、异常检测
{
  "vectorize": [
    { "binding": "VEC", "index_name": "kb" }
  ]
}
// 写
await env.VEC.insert([
  { id: "doc-1", values: embedding, metadata: { title } },
]);

// 查(topK 相似)
const matches = await env.VEC.query(queryEmbedding, {
  topK: 5,
  filter: { lang: "zh" },
});
  • 维度在建 index 时定死,后续不能改
  • metadata 不是全文搜索;只能做等值/范围过滤
  • 嵌入要自己生成(Workers AI 或外部模型);注意维度一致
已复制
🔍 ESC