Repository navigation
feat(providers)!: AI SDK-shaped provider factories, request layer and callers (source) - #224
Closed
cunninghamcard-bit wants to merge 18 commits into
Closed
cunninghamcard-bit wants to merge 18 commits into
cunninghamcard-bit wants to merge 18 commits into
Conversation
What: the source of the provider-factory work in one step: the injectable request layer, resolvable settings and call-level retry in provider-utils; the Provider trait and provider registry in core; a create_* factory per vendor package, the OpenAI-compatible package, Groq and DeepSeek as their own packages, the built-in provider table and by-name creation; and the ffi, language bindings, CLI, web console and replay following the new creation path. Existing tests that still apply are adjusted. Why: third of four parts split out of the provider-factory pull request. The changes to core and provider-utils break every caller, so the source of all crates has to move together to compile; this part is the smallest unit that passes the gate. New tests and documentation follow in the last part. The commit-by-commit history of this work is in that pull request. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
…low upstream; migrate ported model tests What: bindings use the same default language model as Rust (Responses); Azure resolves its token provider only without an Authorization header; the Responses factory sets the file id prefix; every request carries the upstream `ai-sdk-<package>/<version>` user-agent suffix added once in provider-utils; vendor settings match upstream (plain api keys, generate id, no extra fields; compatible gains supported urls and usage conversion and applies the request transform to chat only); language and image middleware take the upstream wrapping hooks and id overrides; NoSuchProvider carries model id, type and available providers; Anthropic usage iterations keep their fields. Removes the OpenAIChatModel alias and a tool-model name in a comment. Migrates the sixteen test files ported from upstream (embedding, image, speech, transcription, files, video) to the factory API and fixes the five divergences they exposed; restores two DeepSeek strict tests; deletes hand-written tests in options.rs and fetch.rs. Why: review against the pinned provider packages found these factory and request-layer differences; ported tests are migrated, not deleted. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
Why: carry up the stack the fixes made after the third independent review on the branches below; this branch's code is converted to them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
…converter errors, Anthropic generate_id What: Cohere and Mistral resolve a bare image media type by detection and reject what cannot be detected, in upstream's order and wording; the public Bedrock message converter returns an unsupported-functionality error for a tool-content file type it cannot send instead of a txt document; Anthropic settings gain generate_id and the model uses it for source ids as upstream does. Why: items left open by the previous fix commit; the media type helper only exists from this branch upward. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
Why: carry up the stack the fixes made after the third independent review on the branches below; this branch's code is converted to them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
… the files version member What: the shared OpenAI-style option parser takes the field schema from the caller; OpenAI, Azure, Groq and DeepSeek each own their schema in their options.rs and Azure passes the OpenAI one. Anthropic spells its namespace and the skill type value once in options.rs. The files model no longer exposes a specification version; the two migrated tests keep their provider-name assertion only. Why: the provider boundary check forbids vendor names in shared packages and the removed version member; the earlier commit had reintroduced both. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
Why: carry up the stack the fixes made after the third independent review on the branches below; this branch's code is converted to them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
Why: carry the formatting commit up the stack; no code change. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
Why: the branch below keeps the sixteen upstream-ported test files in their old form; this branch already carries them migrated to the factory API, so the tree is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS
Contributor
Author
|
Folded into #214 while consolidating the RFC-0036 stack from twelve pull requests into four. This branch is unchanged; its commits are part of the range #214 now shows (base 🤖 Generated with Claude Code |
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.
What
Move provider construction, the shared request layer and their callers to package factories shaped by the AI SDK. This is the source and caller migration after
rfc-0036/upstream-samples, followingfactory-test-removal, and beforeprovider-factory(#214), which adds further tests and documentation. The branch also restores upstream-ported tests removed before the factory migration and includes the converter and response-parser changes needed by these implementations. Core, provider-utils, vendor packages, FFI, language bindings, CLI, web console and replay move together because they share the changed creation and request interfaces.Before and after
create_*factories, settings and default instances create models throughProvider;createOpenAI,createAnthropicand the other package provider modules are the references. Built-increate_provider,provider_namesanddefault_providersassemble package factories and compatible presets; this built-in table is an aimux extension.Provider::language_model, selecting Responses ascreateOpenAIdoes; explicit chat and completion remain available. The Responses factory supplies thefile-prefix fromopenai-provider.ts.Option<String>keys and header maps. Packages with an environment-key fallback load it when requests run; OpenAI-compatible sends no authorization for an absent or empty key. Azure andPresetSettingsretain resolvable keys; Azure also has a resolvable token provider. Mistral, Cohere and Anthropic expose the upstreamgenerateIdhook. A dynamic request credential does not make every settings field dynamic.OpenAICompatibleProviderSettingsincludessupported_urlsandconvert_usage;transform_request_bodyapplies only to chat, as inopenai-compatible-provider.ts. Groq and DeepSeek have their own package settings and conversion behavior.withUserAgentSuffixandpostToApi.azure-openai-provider.ts.create_provider_registryresolves combined IDs at the first separator and applies language/image middleware. Wrappers accept model/provider ID overrides; language hooks receive both generation and streaming callbacks, followingcreateProviderRegistry,wrapLanguageModelandwrapImageModel.NoSuchProvidercarries provider ID, model ID, model type and available providers, matching the fields ofNoSuchProviderError.anthropic-language-model.ts. Mistral reads the first choice and assembles tool-call argument fragments, followingmistral-chat-language-model.ts. Cohere and Mistral detect bare image media types; the Bedrock public converter rejects unsupported tool-content file types. These changes are part of the source split.Upstream constraints expressed only through TypeScript types, including JSONSchema7, dotted IDs and kinds, NonNullable, URL, Date and number domains, do not themselves enforce runtime validation upstream. Rust retains
Value,Stringandu32representations where applicable.Vendor option schemas live in each package: the shared OpenAI-style option parser takes its field schema from the caller, and OpenAI, Azure, Groq and DeepSeek own theirs in
options.rs(Azure passes the OpenAI schema). Anthropic spells its namespace and the skill type value once inoptions.rs. The files model exposes no specification version; the two migrated files tests keep only the provider-name assertion. This is whatscripts/check_provider_boundaries.shrequires.Tests
Migrate the sixteen upstream-ported embedding, image, speech, transcription, files and video test files to the factory API; these test upstream behavior through the new factory API. Restore the DeepSeek strict-option cases instead of replacing them with implementation-specific assertions. Delete the hand-written tests introduced in
anthropic/options.rsand provider-utilsfetch.rs. Existing cassette replay suites remain and their caller setup follows the new factories; recorded cassette files are unchanged. Existing tests in mixed files are adjusted rather than all being removed: this branch does not claim that every remaining hand-written test has been deleted or that every upstream case has been ported.Not in this pull request
Optionvalues serialized as null; generated Node fields can remain required and nullable.aimux_providers::providerused by FFI, Node and Python await the maintainer's decision. The new built-in assembly does not settle whether those entries should remain public.ModelMessagetool-result shape and remaining call-layer tool-result/error behavior await the maintainer's decision; factory migration does not resolve that public contract.evaluationModel/customProviderare not ported here. Their scope awaits the maintainer's decision.rfc-0036/vendor-alignment; those later changes are outside this source branch.specificationVersionremains deliberately omitted under the project's public-surface decision and boundary check. Search/discovery and built-in assembly remain aimux extensions rather than upstream parity claims.fixtures/aisdksamples (recordings of the published AI SDK packages over a mocked fetch) are unchanged here; the replay tests that read them belong toprovider-factory(feat(providers)!: AI SDK-shaped provider factories, request layer and replay tests #214).Stack refresh (2026-10-07)
Head
94942c40followsrfc-0036/upstream-samplesat6b8b8432. The stack includesmasterat0b365b39and the updated #203 (3e2d9fc7), #204 (b897cb21) and #213 (7c0933b1). Updated parents were merged into their children to preserve the existing public merge history; the PR base and Draft state are unchanged.The Decision/Jev additions from master now use the factory-era Provider interface, call-level retries and caller-supplied replay registry. Provider recordings contain identity only; Decision capabilities are recorded on InputRecord for offline replay. The native Jev constructor remains an aimux extension. The Jev recording envelope is migrated to schema 3 without changing its recorded HTTP request/response bodies. Removed obsolete DecisionModel config_snapshot/specification_version hooks. The SSE regression uses the new OpenAI factory API.
Verification
wire-format415e37e1passescargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings, and the provider boundary script.cargo test --workspaceat finalwire-format: 2,819 passed, 0 failed, 6 ignored, including doctests. The intermediate factory-source integration also passed 2,434 tests before the final obsolete Decision hook removal. These are integration results, not a claim that the full suite was rerun at every PR head.build:typed, and web production build passed at the wire-format layer.Not verified
No GitHub check runs are attached to this Draft stack head at the time of this update. Go, Java, Kotlin, Swift and Flutter bindings were not compiled locally in this refresh; Node
npm testand Pythonpytestwere not run. Live vendor calls and unported upstream cases remain outside this validation.🤖 Generated with Claude Code
https://claude.ai/code/session_01WGwanvo9WLU9HWD7sRR8TS