Skip to content

feat(vectorize): add Vectorize (V2) binding#1019

Draft
connyay wants to merge 1 commit into
cloudflare:mainfrom
connyay:cjh-vectorize
Draft

feat(vectorize): add Vectorize (V2) binding#1019
connyay wants to merge 1 commit into
cloudflare:mainfrom
connyay:cjh-vectorize

Conversation

@connyay

@connyay connyay commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Adds the Cloudflare Vectorize binding. The bulk is generated from a curated types/vectorize.d.ts via ts-gen (same approach as the email binding), with a thin hand-written layer for the parts ts-gen can't infer: the EnvBinding impl, env.vectorize(binding), and some f32/serde conveniences.

The curated types are a V2-only subset of upstream. Filters and metadata serialize as plain objects rather than JS Maps, which Vectorize silently ignores.

Tests are a /vectorize route that hits the binding end to end. That's compile coverage on wasm32 only; there's no vitest spec because Vectorize has no local Miniflare emulator. See examples/vectorize for a semantic-search example using Workers AI embeddings.

Regenerating the bindings needs the ts-gen string-enum codegen fixes (pending upstream, plus a submodule bump). The committed output already includes them, so the crate compiles against the pinned wasm-bindgen as-is.

Adds the Cloudflare Vectorize binding. The bulk is generated from a curated
`types/vectorize.d.ts` via ts-gen (same approach as the `email` binding), with a
thin hand-written layer for the parts ts-gen can't infer: the `EnvBinding` impl,
`env.vectorize(binding)`, and some `f32`/serde conveniences.

The curated types are a V2-only subset of upstream. Filters and metadata
serialize as plain objects rather than JS `Map`s, which Vectorize silently
ignores.

Tests are a `/vectorize` route that hits the binding end to end. That's compile
coverage on wasm32 only; there's no vitest spec because Vectorize has no local
Miniflare emulator. See examples/vectorize for a semantic-search example using
Workers AI embeddings.

Regenerating the bindings needs the ts-gen string-enum codegen fixes (pending
upstream, plus a submodule bump). The committed output already includes them, so
the crate compiles against the pinned wasm-bindgen as-is.
@connyay

connyay commented Jun 23, 2026

Copy link
Copy Markdown
Contributor Author

Supersedes #660 and #609 with ts-gen plumbing

Needs wasm-bindgen/ts-gen#30 to land properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant