Briefly describe what you are trying to do
When trying to integrate gptel with the iFlow API, the "Unknown tool called by model:nil" error occurs when the model returns tool calls (such as web_search). This
issue is caused by the iFlow API fragmenting tool call information during streaming responses.
Detailed Problem Description
The iFlow API fragments tool call information during streaming responses, specifically manifested as:
- The first chunk may only contain the tool name but no arguments (e.g., {"name": "web_search"})
- Subsequent chunks may have an empty name but contain argument fragments (e.g., {"arguments": "{"query": "current news 2024"}"})
- This causes gptel to encounter tool calls with nil names during parsing, resulting in the "Unknown tool called by model:nil" error
Although the gptel-iflow-debug.el file already implements a tool call accumulation mechanism, there are defects in processing tool calls after accumulation is
complete, failing to properly merge previously accumulated data.
log.txt
Additional context
Emacs version: 30.2
Operating system: macOS 26.1