Vectorize
Vectorize is Cloudflare’s vector database. wrangler-deploy creates and manages Vectorize indexes per stage alongside your Workers.
Config
Section titled “Config”export default defineConfig({ version: 1, workers: ["apps/api"], resources: { embeddings: { type: "vectorize", dimensions: 1536, metric: "cosine", }, "embeddings-large": { type: "vectorize", dimensions: 4096, metric: "euclidean", description: "High-dimension embeddings for semantic search", }, // Or use a preset "fast-embeddings": { type: "vectorize", preset: "fast-embeddings-default", }, },});Options
Section titled “Options”| Option | Type | Description |
|---|---|---|
dimensions | number | Vector dimensions (required without preset) |
metric | "euclidean" | "cosine" | "dot-product" | Similarity metric |
preset | string | Use a preset config instead of manual dimensions |
description | string | Optional description |
# Apply creates the vectorize indexwd apply --stage production
# State shows the index IDwd status --stage productionUsage in Workers
Section titled “Usage in Workers”Once provisioned, use the binding in your Worker:
export default { async fetch(request, env) { const vectors = await env.EMBEDDINGS.query(...) }}Config Reference