Repository navigation
Conversation
…d like the AI SDK A server close before the input audio ended now fails the Gemini Live transcription stream (Google and Vertex) with `InvalidResponseData`: "<label> Live transcription WebSocket closed unexpectedly before finishing (code <code>, reason: <reason>).", the text of the `onClose` handler in @ai-sdk/google 4.0.87 (google-transcription-model.ts:577) and @ai-sdk/google-vertex 5.0.100 (google-vertex-gemini-transcription-model.ts:600). It used to pass on the socket's "websocket closed by peer (code ...)" error. `aimux_provider_utils::ws::peer_close` reads the close frame back from that error, so the format stays in ws.rs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
`VertexImageModel` reports `supports_file_inputs: Some(true)` and `supports_mask_inputs: Some(false)` for the ids in `googleVertexImageModelsWithFileInputSupport` (@ai-sdk/google-vertex 5.0.100, google-vertex-image-model.ts:29-62) and `None` for the rest. It used the trait default, `None`, for every id. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Ports the tests of @ai-sdk/google-vertex 5.0.100 (RFC-0045) into aimux-providers/src/vertex/tests/, one Rust file per upstream test file, one mod per describe level and an `/// upstream:` marker on every test: 199 tests for 199 of the 251 upstream cases. 5 more are covered by old tests, marked in the next commit. The other 47 are in aimux-providers/layout.toml (`[vertex]`): 14 sub-feature (#275) and 17 ts-only exclusions, and the 16 cases of the Cloud Text-to-Speech model, whose source file is `missing` (#275). Upstream fixtures are copied unchanged into fixtures/, `toMatchSnapshot` values become snapshots/*.json. fixtures/aimux-test-rsa-key.pem is a test key: aimux signs the service-account JWT itself where upstream mocks Web Crypto. `GoogleAuth.options` is widened to `pub(super)` so the provider tests can read the options the credential resolver was built with. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Old tests in tests/vertex_location_validation_test.rs that assert every expectation of an upstream case move, unchanged, into mod trees named after its describe chain and carry its `/// upstream:` marker (5). Tests that cover a case only in part get a `/// partial:` note pointing at the full port (the `/// TS:` lines they had are replaced). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Split vertex/ into one file per @ai-sdk/google-vertex source file (provider_base.rs, auth_google_auth_library.rs, embedding_model.rs and its options, image_model.rs, transcription_model.rs, video_model.rs, gemini_transcription/, anthropic/, maas/, xai/) and merge the five old vertex test programs into src/vertex/tests/. vertex::image is no longer a public module; the root re-exports are unchanged. The 243 tests are unchanged; three older partner tests that read GOOGLE_VERTEX_LOCATION are now #[serial], since they share a binary with the test that sets it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
RFC-0046 §4.5 item 2: the vendor move PR lists the old public sub-module paths and the replacement entry under Unreleased > Breaking. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…i-sdk ws.rs and google/transcription.rs resolve to the same tree as the Google fix PR #362 after its master merge: master's ws_error takes the error source, and closed_before_finishing builds InvalidResponseData with AiMuxError::invalid_response_data. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
…est/port-the-upstream-google-vertex-tests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…eam-google-vertex-tests # Conflicts: # aimux-providers/tests/google_vertex_image_test.rs
eric's review of #352: four old tests check part of an upstream case without saying so. They now carry `partial:` notes naming the cases and their full ports: should_generate_video (vertex_video_test.rs), and in vertex_upstream_e2e_test.rs the MaaS and xAI sub-provider tests and partner_headers_win_over_per_call_headers. The other unmarked old tests have no upstream test case: the region option check, executable credentials, the partner project and user-agent rules, and the Gemini behaviours that @ai-sdk/google tests rather than @ai-sdk/google-vertex. They stay aimux-own. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…eam-google-vertex-tests
The partial: markers the test branch added to vertex_upstream_e2e_test.rs and vertex_video_test.rs go on the same cases in src/vertex/tests/provider.rs and src/vertex/tests/video_model.rs, where the move put them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
Generated by Claude Code |
Master now carries the Google Vertex test port (#352, squashed). The merge uses the test branch head 7f719f0 as its base, so only master's own changes since then come in; nothing conflicted. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
|
#352 已 squash 合入 master,本 PR 的 base 已改为 master。
Generated by Claude Code |
…he-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…he-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
eric8810
left a comment
There was a problem hiding this comment.
Rebase is content-preserving: only master/parent merges and CHANGELOG/layout conflict resolution; tests and CI unchanged. Re-approving current head.
…oogle-vertex-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master/parent merges and CHANGELOG/layout conflict resolution; CI 16/16. Re-approving current head.
…oogle-vertex-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master/parent merges and conflict resolution; CI 16/16. Re-approving current head.
…oogle-vertex-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master/parent merges and conflict resolution; CI 16/16. Re-approving current head.
…oogle-vertex-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master merges and conflict resolution; CI 16/16. Re-approving current head.
Summary
把
src/vertex/按@ai-sdk/google-vertex@5.0.98一个文件对一个文件重排(RFC-0046 §4.2),老的五个 vertex 测试程序并进厂商测试目录src/vertex/tests/(RFC-0046 §5)。函数体只改了路径和可见性;根上的再导出不变,vertex::image不再是公开模块。测试数量、模块路径(去掉文件前缀)和函数名前后一致;三个读环境区域的老用例加了#[serial](见“共享进程状态”)。叠在测试 PR #352 上。实施进度在 #328 跟踪。已经测试分支
49266ef3合上 masterb69137eb,冲突按 master 的改动搬到新位置解决(mod.rs的改动落到provider_base.rs,embedding 的改动落到embedding_model.rs、embedding_model_options.rs,两个合作 provider 的文档落到maas/、xai/,老测试程序里的错误模式改成结构体变体);测试数前后仍相等(243 个:测试分支 lib 199 个加老测试程序 44 个,名字多重集相同)。一、体系现状(概览,测试 PR #352 头
872d7214)上游同一条路:
createVertex(google-vertex-provider.ts)包createVertexBase(google-vertex-provider-base.ts),后者建 Gemini 模型(复用@ai-sdk/google)和GoogleVertexEmbeddingModel、-ImageModel、-VideoModel、-TranscriptionModel、GoogleVertexGeminiTranscriptionModel(gemini-transcription/),凭证在 google-vertex-auth-google-auth-library.ts;anthropic/、maas/、xai/三个子包各有 provider、-node、edge/和index.ts。aimux 把 provider 放在mod.rs,把 MaaS 和 xAI 放在一个partner_provider.rs,Anthropic 的模型配置单独在anthropic_model.rs。测试:#352 的新用例在
src/vertex/tests/(199 个),老用例还在五个独立测试程序tests/{google_vertex_image_test, vertex_location_validation_test, vertex_transcription_test, vertex_upstream_e2e_test, vertex_video_test}.rs(9 + 8 + 5 + 19 + 3 = 44 个)。二、本 PR 改动(细节)
vertex/mod.rs的模块文档、mod和pub usevertex/mod.rs(只有模块声明、pub use和三个pub(crate) use)index.tsvertex/mod.rs的其余部分(常量、设置、check_location、Publisher、ProjectLocation(Source)、GeminiEndpoint、Resolver、create_google_vertex、google_vertex、VertexProvider和它的Provider/ProviderDiscovery实现,:64–611)和VertexModel别名vertex/provider_base.rsgoogle-vertex-provider-base.ts;google-vertex-provider.ts、-config.ts、-options.ts、edge/google-vertex-provider-edge.ts、edge/index.ts在 aimux 没有单独的代码,layout.toml指到这个文件vertex/auth.rs整个文件vertex/auth_google_auth_library.rsgoogle-vertex-auth-google-auth-library.ts;aimux 只有一条凭证路径,没有自成一段的 edge 代码,edge/google-vertex-auth-edge.ts也指到这里vertex/auth_certificate.rs、auth_external.rsvertex/embedding.rs:1–254vertex/embedding_model.rsgoogle-vertex-embedding-model.tsvertex/embedding.rs:256–327(VertexEmbeddingProviderOptions、parse_vertex_provider_options)vertex/embedding_model_options.rsgoogle-vertex-embedding-model-options.tsvertex/image.rs(原来pub mod image)vertex/image_model.rs(私有模块)google-vertex-image-model.ts;-image-model-options.ts、-image-settings.ts指到这里vertex/transcription.rsvertex/transcription_model.rsgoogle-vertex-transcription-model.ts;-options.ts指到这里vertex/video.rsvertex/video_model.rsgoogle-vertex-video-model.ts;-options.ts、-video-settings.ts指到这里vertex/gemini_transcription.rsvertex/gemini_transcription/gemini_transcription_model.rs(mod.rs只做导出)gemini-transcription/google-vertex-gemini-transcription-model.ts;-options.ts指到这里vertex/anthropic_provider.rs+anthropic_model.rsvertex/anthropic/anthropic_provider.rs(mod.rs只做导出)anthropic/google-vertex-anthropic-provider.ts;-options.ts、-provider-node.ts、edge/*指到这里,anthropic/index.ts指anthropic/mod.rsvertex/partner_provider.rs:186–244(maas_request_body、create_google_vertex_maas、google_vertex_maas)vertex/maas/maas_provider.rsmaas/google-vertex-maas-provider.ts;-options.ts、-provider-node.ts、edge/*指到这里,maas/index.ts指maas/mod.rsvertex/partner_provider.rs:246–369(xai_usage、xai_request_body、create_google_vertex_xai、google_vertex_xai、VertexXaiProvider)vertex/xai/xai_provider.rsxai/google-vertex-xai-provider.ts;同上,xai/index.ts指xai/mod.rsvertex/partner_provider.rs:36–184(设置和两个别名、PartnerBaseUrl、PartnerHeaders、partner_parts)vertex/partner_provider.rs,文档第一行写明是maas/和xai/共用的 aimux 代码image、transcription、video、gemini_transcription的选项是在do_generate/do_start里就地读的,没有单独的选项类型或解析函数,所以没有建*_options.rs,上游的 options 文件在layout.toml里指到模型文件。只有 embedding 有自己的选项结构和解析函数,拆成embedding_model_options.rs。Anthropic、MaaS、xAI 的 options 文件上游只有模型 id 类型,aimux 没有对应,同样指到 provider 文件。vertex::image原来是公开模块,现在是私有的image_model(RFC-0046 §4.5);VertexImageModel仍从vertex和 crate 根导出,其余公开项和lib.rs的再导出都不动。旧路径和替代入口写进了 CHANGELOG(见下面 CHANGELOG 一节)。mod.rs里、子模块直接能用的项现在在兄弟文件里,改为pub(super):location_host、PROJECT_ENV_VAR、LOCATION_ENV_VAR,Resolver的auth、use_access_token_env字段和express_key、headers方法,VertexProvider的resolver、fetch、transform_request_body字段和project_location方法;partner_parts,embedding 的选项结构、字段和解析函数也是pub(super)。anthropic/config.rs用到的Resolver、Publisher和default_providers.rs用到的API_KEY_ENV_VAR由vertex/mod.rs以pub(crate) use导出,路径不变。子目录里的文件用crate::vertex::provider_base::…、crate::vertex::auth_google_auth_library::…引用;Anthropic 两个文件合并后,super::anthropic_model::model(变成同文件的model(。partner_provider.rs里指向create_google_vertex_maas/_xai的文档链接加了super::路径。函数体不变。tests/image_model.rs(9 个)、tests/transcription_model.rs(5 个)、tests/video_model.rs(3 个)、tests/provider.rs(端到端的 19 个,放在 “Older ports” 一节)和tests/location_validation.rs(8 个;老的name_location_validation模块里的 4 个并进 test: port the upstream Google Vertex tests #352 的同名模块)。每节前面一行注释写明原来的文件,原文件头的说明改成普通注释。和 test: port the upstream Google Vertex tests #352 同名的default_body、options改名wiremock_default_body、wiremock_options;aimux_providers::改成crate::vertex::/crate::,mock_fetch改用crate::test_support::mock_fetch。test: port the upstream Google Vertex tests #352 里crate::vertex::auth::GoogleAuth的 import 和两处文档里的src/vertex/auth.rs改到新路径,location_validation.rs文件头说 “老文件” 的那句改成指本文件末尾。layout.toml的[vertex]43 个rust字段改到新路径(另有 5 处reason里的vertex/auth.rs);scripts/check_provider_boundaries.sh的anthropic_family把vertex/anthropic_model.rs换成vertex/anthropic目录,合并后的anthropic_provider.rs也过规则 6。共享进程状态:老测试原来各是单独的测试程序,现在和 #352 的用例同在 lib 的一个测试程序里。vertex 测试动的环境变量有
GOOGLE_VERTEX_LOCATION、GOOGLE_VERTEX_API_KEY、GOOGLE_VERTEX_ACCESS_TOKEN、GOOGLE_APPLICATION_CREDENTIALS(含小写)、CLOUDSDK_CONFIG、GCE_METADATA_HOST、GCE_METADATA_IP,都用EnvVar设置并在#[serial]用例里;只有老的validates_the_environment_location把GOOGLE_VERTEX_LOCATION设成非空。老端到端里有三个用例不传 location、读环境里的GOOGLE_VERTEX_LOCATION(maas_sub_provider_builds_on_openai_compatible、partner_headers_win_over_per_call_headers、partner_user_agent_header_replaces_the_whole_user_agent),原来和那个用例不在同一个程序里,合并后可能同时跑,所以给这三个加了#[serial],函数体不变(在设了GOOGLE_VERTEX_LOCATION=user@internal/#的环境里跑 vertex 测试,这三个是唯一失败的,加了以后都过)。executable_credential_without_the_opt_in_fails_and_spawns_nothing和partner_sub_providers_require_a_project断言GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES、GOOGLE_VERTEX_ACCESS_TOKEN、GOOGLE_VERTEX_PROJECT没设,crate 里没有用例把它们设成非空。计数器(counting_provider、mock_auth_token)都是每个用例自己的AtomicUsize;唯一的临时路径是temp_dir()/aimux-vertex-executable-marker-<pid>,只有一个用例用。CHANGELOG
CHANGELOG Unreleased 的 Breaking 加了一条,列出本家变了的公开子模块路径和替代入口(RFC-0046 §4.5 第 2 条)。
验证
cargo test -p aimux-providers --lib vertex::加原来五个--test:前后都是 243 个测试(199 + 44),完整测试路径(老程序名换成对应的vertex::tests::<文件>)的多重集完全相同,函数名多重集也相同;243 个全过。整个 lib 测试程序连跑 5 次,383 个全过。cargo +1.99 clippy -p aimux-providers --lib --tests -- -D warnings、cargo +1.99 check -p aimux-providers --lib --tests --all-features、RUSTDOCFLAGS="-D warnings" cargo +1.99 doc -p aimux-providers --no-deps、cargo fmt --all -- --check、scripts/check_provider_boundaries.sh、cargo +1.99 check --workspace --tests通过。Type of change
Checklist
Generated by Claude Code