toolcall-gateway :让不支持function call的模型支持function call

2026-04-11 10:501阅读0评论SEO问题
  • 内容介绍
  • 文章标签
  • 相关推荐
问题描述:

分享一个从我的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 C --> B B --> P["Tagged Prompt\n严格标签协议"] P --> M["纯文本大模型\n不支持 native function calling"] M --> X["非流式文本\n<think> / <tool_calls> / <final_answer>"] M --> Y["流式 chunk"] subgraph T2["text2tool"] D["parse_tagged_output\nparse_to_openai_assistant_turn"] E["TaggedStreamParser"] end X --> D Y --> E C --> D C --> E D --> R["OpenAI-style 输出\ncontent / tool_calls / finish_reason"] E --> R R --> O S["models.py\nOpenAI DTOs"] -.共享模型.-> B S -.共享模型.-> D Z["errors.py\nTaggedOutputError / ToolChoiceError"] -.错误边界.-> D Z -.错误边界.-> E 网友解答:


--【壹】--:

贴了要审核,需要的自己github搜索下就好了


--【贰】--:

跟这些比有什么优势吗?

「开源自荐」[AnyToolCall] 去tmd原生工具调用 | 基于提示词注入的工具调用中间件 - 开发调优 - LINUX DO

Toolify——为任意LLM API添加完善的Function Calling支持 - 开发调优 - LINUX DO


--【叁】--:

好厉害啊,试过grok2api的API吗? 不知道能不能给它添加工具调用能力


--【肆】--:

caiwu还是太强了 之前的web2api 也很好用


--【伍】--:

github开源链接可以自荐分享出来的佬

问题描述:

分享一个从我的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 C --> B B --> P["Tagged Prompt\n严格标签协议"] P --> M["纯文本大模型\n不支持 native function calling"] M --> X["非流式文本\n<think> / <tool_calls> / <final_answer>"] M --> Y["流式 chunk"] subgraph T2["text2tool"] D["parse_tagged_output\nparse_to_openai_assistant_turn"] E["TaggedStreamParser"] end X --> D Y --> E C --> D C --> E D --> R["OpenAI-style 输出\ncontent / tool_calls / finish_reason"] E --> R R --> O S["models.py\nOpenAI DTOs"] -.共享模型.-> B S -.共享模型.-> D Z["errors.py\nTaggedOutputError / ToolChoiceError"] -.错误边界.-> D Z -.错误边界.-> E 网友解答:


--【壹】--:

贴了要审核,需要的自己github搜索下就好了


--【贰】--:

跟这些比有什么优势吗?

「开源自荐」[AnyToolCall] 去tmd原生工具调用 | 基于提示词注入的工具调用中间件 - 开发调优 - LINUX DO

Toolify——为任意LLM API添加完善的Function Calling支持 - 开发调优 - LINUX DO


--【叁】--:

好厉害啊,试过grok2api的API吗? 不知道能不能给它添加工具调用能力


--【肆】--:

caiwu还是太强了 之前的web2api 也很好用


--【伍】--:

github开源链接可以自荐分享出来的佬