Repository navigation
Conversation
…yout One Rust file per @ai-sdk/huggingface source file (RFC-0046 §4.2): huggingface.rs becomes huggingface/mod.rs (index.ts, module list only) with the factory in provider.rs and the error handler in error.rs; responses.rs splits into responses/ with responses_language_model.rs, convert_to_responses_messages.rs, responses_prepare_tools.rs, convert_responses_usage.rs and map_responses_finish_reason.rs, and options.rs becomes responses/responses_language_model_options.rs. tests/huggingface_responses_test.rs joins src/huggingface/tests/responses/responses_language_model.rs by describe block, its wiremock helpers in tests/responses/support.rs (RFC-0046 §5). Move only: the test count and the test paths and names are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
This was referenced Oct 20, 2026
The test branch now stacks on the fix PRs #305-#307, which add two aimux-own tests at the end of tests/huggingface_responses_test.rs. That file is already merged into src/huggingface/tests/responses/responses_language_model.rs, so the two tests land there at the same places. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
Merged
5 tasks done
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
This was referenced Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
cunninghamcard-bit
marked this pull request as ready for review
October 24, 2026 11:25
eric8810
approved these changes
Oct 25, 2026
eric8810
left a comment
Contributor
There was a problem hiding this comment.
Hugging Face layout refactor:42/42 production functions 与 57/57 tests 归一化后一致,公开 re-export 保留。Approve。
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ace-tests' into refactor/move-the-hugging-face-files-to-the-upstream-layout Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
eric8810
changed the base branch from
test/port-the-upstream-hugging-face-tests
to
master
October 27, 2026 14:10
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
把 Hugging Face 的源文件按
@ai-sdk/huggingface@2.0.62一个文件对一个文件拆开(RFC-0046 §4.2),老的tests/huggingface_responses_test.rs并进厂商测试目录src/huggingface/tests/(RFC-0046 §5 的新布局)。只搬不改:函数体不变,测试数量、模块路径和函数名前后一致。叠在测试 PR #303 上。已经测试分支
36b3e4ec合上 masterb69137eb,冲突按 master 的改动搬到新位置解决(老测试程序里一处错误模式改成结构体变体,搬到src/huggingface/tests/responses/responses_language_model.rs);测试数前后仍相等(Hugging Face 57 个,测试分支 lib 22 个加老测试程序 35 个,名字多重集相同)。一、体系现状(概览,测试 PR #303 头
7f0f7328)上游同一条路:
createHuggingFace(huggingface-provider.ts)→HuggingFaceResponsesLanguageModel.doGenerate(responses/huggingface-responses-language-model.ts)→convertToHuggingFaceResponsesMessages、prepareResponsesTools、convertHuggingFaceResponsesUsage、mapHuggingFaceResponsesFinishReason各在自己的文件。aimux 把 5 个上游文件放在一个 1,219 行的responses.rs里,工厂和index.ts在huggingface.rs。测试:#303 的新用例在
src/huggingface/tests/,老的 wiremock 用例还在tests/huggingface_responses_test.rs(一个独立测试程序,35 个用例,含修复 PR #305–#307 加的 2 个)。二、本 PR 改动(细节)
huggingface.rs模块文档、导出huggingface/mod.rs(只有模块声明和pub use)index.tshuggingface.rs设置、工厂、默认实例huggingface/provider.rshuggingface-provider.ts(HuggingFaceConfig由这里组装)responses.rs错误处理器huggingface/error.rshuggingface-error.tsresponses.rs模型、流、请求体、响应解析responses/responses_language_model.rsresponses/huggingface-responses-language-model.tsresponses.rs消息转换、媒体类型responses/convert_to_responses_messages.rsconvert-to-huggingface-responses-messages.tsresponses.rs工具准备responses/responses_prepare_tools.rshuggingface-responses-prepare-tools.tsresponses.rs用量、finish reasonresponses/convert_responses_usage.rs、responses/map_responses_finish_reason.rsoptions.rsresponses/responses_language_model_options.rshuggingface-responses-language-model-options.tshuggingface::responses::{HuggingFaceResponsesModel, build_request_body_with_warnings, convert_to_huggingface_responses_messages, prepare_responses_tools, RequestBodyResult}由responses/mod.rs再导出。pub(super)(convert_usage、map_finish_reason、huggingface_failed_response_handler),模型里super::options::改成引用responses_language_model_options as options,函数体不动。tests/huggingface_responses_test.rs按 describe 并进src/huggingface/tests/responses/responses_language_model.rs,它的 wiremock 帮手放到同目录support.rs(pub(super));aimux_providers::改成crate::。修复 PR 新加的 2 个用例跟着并进同一文件的原位置。layout.toml的rust字段改到新路径;check_provider_boundaries.sh规则 8 允许*_language_model_options.rs写命名空间键,去掉已不存在的huggingface.rs。验证
cargo test -p aimux-providers --lib加原--test huggingface_responses_test:前后都是 192 个测试,模块路径(去掉文件前缀后)和函数名完全相同;Hugging Face 的 58 个全过。cargo +1.99 clippy -p aimux-providers --lib --tests -- -D warnings、cargo doc -D warnings、cargo fmt --check、scripts/check_provider_boundaries.sh通过。Type of change
Checklist
共享进程状态:测试原来各自是单独的测试程序,现在并进 lib 的同一个测试程序。本家的测试不改环境变量,不用全局计数器和固定临时路径,搬进来不受别家影响(RFC-0046 §5)。
https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
Generated by Claude Code