RAG-1300: Add Web Search binding types#6768
Merged
danlapid merged 1 commit intoMay 21, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6768 +/- ##
=======================================
Coverage 66.62% 66.62%
=======================================
Files 402 402
Lines 115914 115914
Branches 19425 19425
=======================================
Hits 77231 77231
Misses 27094 27094
Partials 11589 11589 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fd21008 to
64e0c6a
Compare
64e0c6a to
ed7419c
Compare
Adds TypeScript type definitions for the new `web_search` binding kind:
- WebSearch (abstract class with single `search()` method)
- WebSearchSearchOptions (query + optional limit)
- WebSearchResult (url, title, description?, lastModifiedDate?,
imageUrl?, faviconUrl?)
- WebSearchResponseMetadata (query, requestId, latencyMs)
- WebSearchSearchResponse ({ items, metadata })
The container types are named `WebSearchSearchOptions` /
`WebSearchSearchResponse` to avoid a name collision with the
pre-existing `WebSearchOptions` type in ai.d.ts (used by the
OpenAI-compatible `web_search_options` field on Workers AI chat
completions).
Discovery-only by design: no `snippets`, `content`, or
`scoringDetails` fields. Pay-per-Crawl alignment -- callers fetch
URLs themselves via the global `fetch()` API if they need bodies.
`lastModifiedDate` is exposed as a naive ISO-8601 datetime string
(e.g. `"2025-11-30T04:39:48"`) when the upstream catalog knows it.
Snapshots are the upstream baseline with only the appended
`defines/web-search.d.ts` block; they were not full-regenerated to
avoid sweeping in unrelated drift.
ed7419c to
279db6b
Compare
jqmmes
approved these changes
May 21, 2026
petebacondarwin
approved these changes
May 21, 2026
Contributor
petebacondarwin
left a comment
There was a problem hiding this comment.
types look fine - should unblock miniflare stuff?
Member
Author
this will be a remote only binding, so this pr can wait for the repo to be unlocked. meanwhile on workers sdk repo we can continue without typegen |
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 TypeScript types for the new
web_searchWorkers binding.WebSearch.search({ query, limit? })→{ items, metadata }WebSearchResult:url,title,description?,lastModifiedDate?,imageUrl?,faviconUrl?WebSearchResponseMetadata:query,requestId,latencyMslimitdefaults to 10, capped at 20Discovery-only — no page bodies. Callers
fetch()URLs themselves; Pay-per-Crawl and publisher controls apply at the fetch site.Wrangler binding is a single object (one shared web corpus, no namespace/instance):
{ "web_search": { "binding": "WEBSEARCH" } }Snapshot also contains a 2-line
ChatCompletionsBasefix onBase_Ai_Cf_Google_Gemma_4_26B_A4B_IT.inputs— matches what bazel generates from currentai.d.ts; needed forcheck-snapshotto pass. Pre-existing drift fromfff20c4f0. Happy to split out if preferred.