Post

【技术备忘录】LLM Function Call踩坑记录

LLM的Function Call真的是坑到家了,尤其是上下文编排,这里特开一坑以作记录备查以防以后再踩同样的坑。

【技术备忘录】LLM Function Call踩坑记录

LLM Function Call概念

上下文编排

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
new_msg = [
            {
                "role": "assistant",
                "content": content,
                "tool_calls": [
                    {
                        "id": id,
                        "type": "function",
                        "function": {
                            "name": function_call,
                            "arguments": json.dumps(argument_list),
                        },
                    }
                ],
            },
        ]

参考资料

  1. OpenAI Documents - Function Call
  2. vLLM Documents - Tool Calling
  3. OpenRouter Documents - Tool Calling
  4. Qwen Documents - Function Call
  5. DeepSeek Documents - Function Call
  6. Qwen3-Coder function call test trajectories
This post is licensed under CC BY 4.0 by the author.