Skip to content

[Feature] 统一工具调用标签格式以降低模型幻觉 / Unify Tool Call Tag Format to Reduce Model Hallucination #99

@SunYanbox

Description

@SunYanbox

当前提示词中定义的大模型调用工具的 XML 标签格式为 <func_call> 内嵌套 <func_name>,再跟随 <param>。计划将其改为 <func_call name="..."> 内直接包含 <param> 标签,统一标签格式,降低模型幻觉风险。
Currently, the XML tag format for LLM tool calls is defined as <func_call> wrapping <func_name>, followed by <param>. The plan is to change it to <func_call name="..."> directly containing <param> tags, unifying the tag format to reduce model hallucination risks.

旧格式示例 / Old format example:

<func_call>
    <func_name>get_weather</func_name>
    <param name="city">Beijing</param>
</func_call>

新格式示例 / New format example:

<func_call name="get_weather">
    <param name="city">Beijing</param>
</func_call>

该变更尚未开始实施。
This change has not yet been implemented.

主要理由:将函数名从独立标签移入属性,能减少标签嵌套冗余与歧义,使格式更接近常见 JSON 或属性式函数调用模式,从而降低模型生成错误闭合或额外占位内容的风险。
Main rationale: Moving the function name from a separate tag into an attribute reduces nesting redundancy and ambiguity, making the format closer to common JSON or attribute-based function calling patterns, thereby lowering the risk of the model generating incorrect closures or extra placeholder content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions