feat(ai-search-provider): add AI Search provider for the AI SDK#602
Draft
aninibread wants to merge 2 commits into
Draft
feat(ai-search-provider): add AI Search provider for the AI SDK#602aninibread wants to merge 2 commits into
aninibread wants to merge 2 commits into
Conversation
New standalone package wrapping Cloudflare AI Search's `ai_search_namespaces`
Workers binding for the Vercel AI SDK:
- createAISearchNamespace({ binding }).get(instanceName) returns an instance
client with chat() (a LanguageModelV3), search(), and item helpers
(upload/uploadAndPoll/list/delete/get().info()/get().download()); the
namespace client also exposes list().
- Chat completions map retrieved chunks to AI SDK `source` parts and support
streaming (SSE) with truncation detection.
- Namespace-only surface by design: the namespace binding is a superset of the
single-instance binding (get() is synchronous/lazy; a default namespace
exists for every account).
Also points workers-ai-provider's AI Search docs at the new package; its own
legacy createAISearch/createAutoRAG (AutoRAG binding) are unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: a6c830e The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
commit: |
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
Adds a standalone
ai-search-providerpackage — a Vercel AI SDK provider wrapping Cloudflare AI Search's newai_search_namespacesWorkers binding. AI SDK apps can upload files to AI Search for indexing, then search that content with natural language or generate chat responses grounded in the retrieved context.workers-ai-provideris left as-is (its legacycreateAISearch/createAutoRAGstill wrap theAutoRAGbinding); only its AI Search docs section now points to the new package.API
createAISearchNamespace({ binding }).get(instanceName)returns an instance client withchat()(aLanguageModelV3),search(), anditems(upload/uploadAndPoll/list/delete/get().info()/get().download()); the namespace client also exposeslist().Design decisions
ai_search_namespacesbinding is a functional superset of the single-instanceai_searchbinding (get()is synchronous/lazy; adefaultnamespace exists for every account), giving a clean namespace→instance split with no duplicated chat/search.sourceparts (sourceType: "url", with the raw chunk underproviderMetadata.aisearch); streaming parses SSE and detects truncation via the documented[DONE]sentinel.Testing
pnpm --filter ai-search-provider test:ci.AI_SEARCH_INSTANCE=<name> pnpm --filter ai-search-provider test:e2e(skips when unset; not run in CI).Changesets
ai-search-provider: minor (initial0.1.0)workers-ai-provider: patch (docs pointer only)