feat: add ai_search_namespaces and ai_search binding types#13027
feat: add ai_search_namespaces and ai_search binding types#13027petebacondarwin merged 4 commits intocloudflare:mainfrom
Conversation
🦋 Changeset detectedLatest commit: b35c8f2 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
092ea72 to
4425684
Compare
|
Codeowners approval required for this PR:
Show detailed file reviewers |
78ed937 to
45ee84b
Compare
45ee84b to
64e7ded
Compare
1315e92 to
52a0d3b
Compare
9be3ffc to
f3cfb67
Compare
7e67fab to
10bccfd
Compare
daa9a7d to
519bed5
Compare
7f6cb6f to
7097522
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
Hi @G4brym - nice work on this. I have added a load of comments (sorry) but also I would really like there to be an e2e test (perhaps in a remote binding test) that demonstrates that the deployment of the remote binding is functional in practice.
9c91fa4 to
93fb683
Compare
Add two new AI Search binding types to Wrangler, Miniflare, and workers-utils: - ai_search_namespaces: namespace binding with dynamic instance CRUD - ai_search: single instance binding bound to one instance in a namespace Both are remote-only in local dev. Namespace auto-creation during deploy follows the R2 bucket provisioning pattern — checks for HTTP 404 on the namespace API before deciding to provision. The namespace field on ai_search defaults to 'default' if omitted. Changes across 3 packages: - workers-utils: config schema, runtime types, metadata/binding unions, validation, defaults, reverse mapping - wrangler: upload form with INHERIT_SYMBOL/dryRun handling, provisioning handler, API helpers, print bindings, config diffs, dev utils, miniflare mapping - miniflare: schema-only plugin with remote proxy for local dev
93fb683 to
982f9e7
Compare
petebacondarwin
left a comment
There was a problem hiding this comment.
Great! Let's land this.
I have run the remote binding tests locally using our Dev Prod Testing account (since this is on a fork and can't run here). Also @G4brym has run them locally too using his account.
Summary
Add two new AI Search binding types to Wrangler, Miniflare, and workers-utils:
ai_search_namespaces: namespace binding — namespace name is required, provisions automatically at deploy time (like R2 buckets) if it doesn't existai_search: single instance binding — bound directly to a pre-existing instance in the default namespaceBoth binding types are remote-only in local dev (Miniflare proxies to the remote API).
Changes
workers-utils:
ai_search_namespaces.namespaceis required (type + validator in sync)wrangler:
INHERIT_SYMBOL/dryRunhandlingai_search_namespaces— checks for HTTP 404 before provisioning (same pattern as R2)getAISearchNamespace,createAISearchNamespace)miniflare:
A picture of a cute animal (not mandatory, but encouraged)
portuguese water dog, aka the obama family dog
