cloudflare-vectorize
БесплатноБез исполняемых скриптовНе проверенCloudflare Vectorize is a managed vector database that Cloudflare Workers query through a binding, used for semantic search and retrieval-augmented generation…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Cloudflare Vectorize
Overview
Cloudflare Vectorize stores embeddings and answers approximate nearest-neighbor queries from Workers through a binding. It supports metadata filtering, namespaces, and pairs with Workers AI for embeddings and generation.
Limits that shape the design (Cloudflare limits page, August 2026): up to 1536 dimensions (float32), 10 KiB metadata per vector, 64-byte IDs, 20 million vectors per index, upsert batches of 1000 from a Worker (5000 over the HTTP API), topK up to 100, but only 50 when you return values or all metadata. Dimensions and metric are fixed at creation. Legacy V1 indexes (200,000 vectors, topK 20) are deprecated; everything below is V2.
Instructions
1. Create the index and bind it
# 768 dimensions for @cf/baai/bge-base-en-v1.5
npx wrangler vectorize create docs-search --dimensions=768 --metric=cosine
# Metadata filtering needs an index per property, created BEFORE you insert (max 10 per index)
npx wrangler vectorize create-metadata-index docs-search --property-name=category --type=string
npx wrangler vectorize create-metadata-index docs-search --property-name=published_at --type=number
Metrics are cosine, euclidean and dot-product. --preset configures dimensions and metric for a known embedding model. Vectors upserted before a metadata index exists are not in it until you upsert them again.
Bind it in wrangler.jsonc (TOML vectorize works too):
{
"name": "docs-search-worker",
"main": "src/index.ts",
"compatibility_date": "2026-10-01",
"vectorize": [{ "binding": "VECTORIZE", "index_name": "docs-search" }],
"ai": { "binding": "AI" }
}
Run npx wrangler types after editing the config to generate the Env type, instead of hand-writing it.
2. Insert and upsert
Vector values must be a dense number[], Float32Array or Float64Array whose length equals the index dimensions. Writes are asynchronous: the call returns a mutation ID and vectors become queryable after a few seconds.
insert()keeps the first vector stored for an ID and ignores later ones.upsert()replaces the whole vector (values and metadata) for an ID. Use it for updates.
const result = await env.VECTORIZE.upsert([
{
id: "intro-001",
values: embedding, // 768 numbers
metadata: { title: "Introduction to Workers", url: "/docs/intro", category: "guide", published_at: 1760000000 },
},
]);
// result.mutationId identifies the asynchronous write
Metadata keys cannot be empty, contain . or ", or start with $.
3. Query
const results = await env.VECTORIZE.query(queryVector, {
topK: 5,
returnMetadata: "all", // "none" (default) | "indexed" | "all"
returnValues: false,
});
// results.matches: [{ id, score, metadata }], best match first
returnMetadata: "indexed" is faster but returns only indexed properties (long strings may be truncated). returnValues: true switches to exact scoring and is slower. queryById(id, options) searches with a vector already stored in the index.
4. Metadata filters and namespaces
A filter is applied first, then topK is taken from the filtered set. Operators: $eq, $ne, $in, $nin, $lt, $lte, $gt, $gte. Several keys are ANDed; a range may combine one upper and one lower bound; a filter must be under 2048 bytes of JSON.
const results = await env.VECTORIZE.query(queryVector, {
topK: 10,
returnMetadata: "all",
filter: { category: { $in: ["guide", "tutorial"] }, published_at: { $gte: 1750000000 } },
});
Namespaces partition one index, for example per customer. Set namespace on upsert and on query; the namespace filter runs before metadata filters. An index holds up to 1000 namespaces on Workers Free and 50,000 on Paid.
await env.VECTORIZE.upsert([{ id: "kb-17", values: embedding, namespace: "customer-4821", metadata: { text: "Reset steps..." } }]);
const hits = await env.VECTORIZE.query(queryVector, { topK: 5, namespace: "customer-4821" });
5. Read, delete, describe
const vectors = await env.VECTORIZE.getByIds(["intro-001", "intro-002"]);
await env.VECTORIZE.deleteByIds(["intro-001"]);
const details = await env.VECTORIZE.describe(); // dimensions, metric
6. RAG with Workers AI
env.AI.run for a text embedding model returns { shape, data }; pass data[0] (one vector) to query(), never the whole response.
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const { question } = (await request.json()) as { question: string };
const embedding = await env.AI.run("@cf/baai/bge-base-en-v1.5", { text: [question] });
const search = await env.VECTORIZE.query(embedding.data[0], { topK: 3, returnMetadata: "all" });
const context = search.matches.map((m) => m.metadata?.text as string).filter(Boolean).join("\n\n");
const answer = await env.AI.run("@cf/meta
Установить cloudflare-vectorize в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cloudflare-vectorize?
Cloudflare Vectorize is a managed vector database that Cloudflare Workers query through a binding, used for semantic search and retrieval-augmented generation (RAG) with Workers AI embeddings. Use when building semantic search on Cloudflare Workers, a RAG pipeline at the edge, or when storing and querying embeddings with metadata filtering and namespaces without running a separate vector database.
Как установить скилл cloudflare-vectorize?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cloudflare-vectorize запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
agent-skill-stack
Find, evaluate, and assemble the smallest compatible set of AI Agent Skills for an end-to-end natural-language goal. Use when a user wants Skills for a…
от GitHubbuild-evidence-map
Build an auditable evidence map for a contested technical choice, research synthesis, proposal review, or consequential decision. Use when Copilot must…
от GitHubpinecone-rag
Build production RAG pipelines and persistent agent memory using Pinecone as the vector database backend. ALWAYS USE THIS SKILL when the user mentions…
от GitHubqdrant-monitoring-debugging
Diagnoses Qdrant production issues using metrics and observability tools. Use when someone reports 'optimizer stuck', 'indexing too slow', 'memory too high'…
от GitHub