feat(vectorize): add Vectorize (V2) binding#1019
Draft
connyay wants to merge 1 commit into
Draft
Conversation
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.
Contributor
Author
|
Supersedes #660 and #609 with ts-gen plumbing Needs wasm-bindgen/ts-gen#30 to land properly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the Cloudflare Vectorize binding. The bulk is generated from a curated
types/vectorize.d.tsvia ts-gen (same approach as theemailbinding), with a thin hand-written layer for the parts ts-gen can't infer: theEnvBindingimpl,env.vectorize(binding), and somef32/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
/vectorizeroute 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.