Update AI Search binding types to match implementation#6541
Merged
npaun merged 1 commit intocloudflare:mainfrom Apr 15, 2026
Merged
Update AI Search binding types to match implementation#6541npaun merged 1 commit intocloudflare:mainfrom
npaun merged 1 commit intocloudflare:mainfrom
Conversation
289a8a4 to
eb14f4d
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
30a017f to
f7eacf0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6541 +/- ##
=======================================
Coverage 70.92% 70.92%
=======================================
Files 438 438
Lines 123626 123626
Branches 19450 19450
=======================================
Hits 87685 87685
Misses 24403 24403
Partials 11538 11538 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f7eacf0 to
631b577
Compare
1193fc7 to
06bb66f
Compare
Sync ai-search.d.ts with the binding-entrypoint implementation: - Add query variant to AiSearchSearchRequest (discriminated union) - Add AiSearchNamespace.search()/chatCompletions() for multi-instance fan-out - Add AiSearchNamespace.list() params (pagination, search, ordering) - Add AiSearchItem.sync(), logs(), chunks() methods - Add AiSearchJob.cancel() method - Add AiSearchOptions with full retrieval, cache, reranking, query_rewrite fields - Expand AiSearchConfig and AiSearchInstanceInfo with all typed fields - Expand AiSearchListItemsParams with search, sort, status, source, metadata filters - Expand scoring_details with keyword_rank, vector_rank, reranking_score, fusion_method - Add engine stats (vectorize/r2) to AiSearchStatsResponse - Fix AiSearchItemInfo.status: 'processing' -> 'running' - Add Blob to upload() content type, poll options to uploadAndPoll() - Add missing types: Multi-search/chat, item logs/chunks, list instance params - Update generated snapshots (latest + experimental)
06bb66f to
f62f8dd
Compare
Naapperas
approved these changes
Apr 14, 2026
petebacondarwin
approved these changes
Apr 15, 2026
Contributor
petebacondarwin
left a comment
There was a problem hiding this comment.
Assuming that these types accurately match the runtime code in the product - LGTM
jqmmes
approved these changes
Apr 15, 2026
npaun
approved these changes
Apr 15, 2026
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.
Summary
Syncs
types/defines/ai-search.d.ts(and generated snapshots) with the actual AI Search binding entrypoint implementation. The workerd type definitions had fallen behind, missing several methods, type variants, and fields that the binding already supports.New methods
AiSearchNamespace:search(),chatCompletions()for multi-instance fan-out;list()now accepts pagination/search/ordering paramsAiSearchItem:sync()(trigger re-indexing),logs()(processing logs),chunks()(indexed chunks)AiSearchJob:cancel()(cancel running job)New types
AiSearchMessage,AiSearchOptions(shared across requests)AiSearchMultiSearchRequest/Response,AiSearchMultiChatCompletionsRequest/Response(namespace fan-out)AiSearchListInstancesParams(instance list pagination/search/ordering)AiSearchItemLogsParams/Log/Response,AiSearchItemChunksParams/Chunk/Response(item sub-resources)Type expansions
AiSearchSearchRequest: now a discriminated union supporting both{ query: string }and{ messages: [...] }AiSearchOptions.retrieval: addedfusion_method,keyword_match_mode,metadata_only,return_on_failure,boost_byAiSearchOptions: addedcachesub-objectAiSearchStatsResponse: addedenginefield (vectorize/r2 storage stats)AiSearchInstanceInfo: expanded from 8 to 25+ typed fieldsAiSearchConfig: expanded from 11 to 22+ typed fieldsAiSearchListItemsParams: addedsearch,sort_by,status,source,metadata_filterscoring_details: addedkeyword_rank,vector_rank,reranking_score,fusion_methodupload()/uploadAndPoll(): content type now includesBlob; poll options added (pollIntervalMs,timeoutMs)Fixes
AiSearchItemInfo.status:'processing'→'running'(matches actual API response)AiSearchItemInfo: added missing fields (next_action,error,checksum,chunks_count,file_size, etc.)