@caiwu 在 toolcall-gateway :让不支持function call的模型支持function call 中发帖
分享一个从我的web2api项目抽离出来的python库(已发布pypi):toolcall-gateway
作用:让不支持function call的模型支持function call
原理:
flowchart LR
O["你的 SDK / 网关 / HTTP 层"] --> A["OpenAI-style 输入\nmessages + tools + tool_choice"]
H["历史工具语义\nassistant tool_calls + tool results"] --> A
subgraph T1["tool2text"]
B["build_prompt / build_tagged_prompt"]
C["normalize_tool_choice\nselect_tools_for_choice"]
end
A --> B...