Repository navigation
refactor: share tool name mapping and strip file extension - #382
Merged
eric8810 merged 9 commits intoOct 28, 2026
Merged
Conversation
…ension RFC-0046 R1 (§4.5 item 4): both follow @ai-sdk/provider-utils 5.0.55. create_tool_name_mapping maps the caller's names of provider tools to the provider's wire names and back, from a table of provider tool ids; strip_file_extension drops everything from the first dot. Their upstream tests are ported under src/tests/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…e_mapping The anthropic::tool_name_mapping module is removed. The language model builds the shared ToolNameMapping from upstream's providerToolNames table, the toolset names with get_anthropic_toolset_names and the dynamic code execution flag with has_dynamic_filtering_web_tool_without_code_execution, and passes the toolset names to the prompt converter as upstream's convertToAnthropicPrompt takes them. The converter tests build the mapping and toolset names as the upstream tests do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…create_tool_name_mapping OpenAI Responses replaces its name HashMap with the shared mapping plus webSearchToolName, as openai-responses-language-model.ts does; Google's code execution tool name comes from the mapping with the google.code_execution entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
sanitizeDocumentName uses provider-utils stripFileExtension, which cuts at the first dot; the Rust copy cut at the last, so report.v2.pdf was sent as reportv2. The new test fails on master. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…changes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
cunninghamcard-bit
marked this pull request as ready for review
October 27, 2026 21:55
30 of 57 tasks
eric8810
approved these changes
Oct 27, 2026
eric8810
left a comment
Contributor
There was a problem hiding this comment.
tool name mapping 与上游 createToolNameMapping 一致;strip_file_extension 用第一个点,Bedrock 多点的行为变化与 upstream sanitizeDocumentName 对齐并有回归测试。Approve。
…-name-mapping-and-strip-file-extension # Conflicts: # CHANGELOG.md # aimux-provider-utils/src/lib.rs # aimux-provider-utils/src/tests/mod.rs
…-name-mapping-and-strip-file-extension # Conflicts: # aimux-provider-utils/src/tests/mod.rs
…-name-mapping-and-strip-file-extension
Contributor
Author
eric8810
approved these changes
Oct 28, 2026
eric8810
left a comment
Contributor
There was a problem hiding this comment.
Rebase 仅合并 master,tests/mod.rs 为无重复 union,mapping/strip 逻辑与批准时逐字节一致,16/16 CI 通过。Re-approve。
This was referenced Oct 28, 2026
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.
RFC-0046 R1 的第 4 个小 PR(清单见 #328):把
createToolNameMapping和stripFileExtension放进aimux-provider-utils。Anthropic、OpenAI Responses、Google 用前者,Bedrock 用后者。Before:
ToolNameMapping是 Anthropic 的公开模块,里面还塞了 Anthropic 专有的 toolset 名和“代码执行标为 dynamic”的判断。OpenAI Responses 自己维护一张HashMap,Google 自己找google.code_execution的名字。Bedrock 的去扩展名从最后一个点切,report.v2.pdf会发成reportv2。After:三家都按上游
providerToolNames表调用同一个create_tool_name_mapping;Anthropic 的 toolset 名和 dynamic 判断拆成上游同名的两个函数;Bedrock 从第一个点切,report.v2.pdf发成report,与上游一致。一、体系现状(概览)
上游:
aimux(master b0450d4):
二、本 PR 改动(细节)
测试:
src/tests/create_tool_name_mapping.rssrc/tests/strip_file_extension.rstests/convert_to_chat_messages.rstests/tool_name_mapping.rs工作区测试总数 4380 → 4379(provider-utils 的 10 个另计)。
改动规模:
公开 API 与行为
aimux_providers::anthropic::tool_name_mapping删除,ToolNameMapping改为aimux_provider_utils::ToolNameMapping,由create_tool_name_mapping构造;mark_code_execution_dynamic不再公开。stripFileExtension一致)。检查
cargo fmt --check、scripts/check_provider_boundaries.sh、cargo +1.99 clippy(providers 与 provider-utils,-D warnings)、cargo check --workspace、cargo doc、全部测试均通过。Generated by Claude Code