deepchat icon indicating copy to clipboard operation
deepchat copied to clipboard

[BUG] 调用工具失败了

Open lifeibo382005-oss opened this issue 8 months ago • 10 comments

System details / 系统信息

macOS 26.3.1 DeepChat v1.0.0-beta.4

What's wrong? / 出了什么问题?

配置gemini 的api,调用工具报错: The tool call with ID gemini-tool-1774096844808 and name exec failed because the remaining context window is too small to continue this turn.

lifeibo382005-oss avatar Mar 21 '26 12:03 lifeibo382005-oss

单个toolcall返回过大内容后导致剩余上下文不足的问题 可以试着调整下上下文和输出token的数值来降低这类情况,也可以修改一下compact 的阈值来减少上下文 暂时可能不会特地去适配此类情况

zerob13 avatar Mar 21 '26 15:03 zerob13

我觉得应该是bug,返回的内容不大,而且上下文很小。

lifeibo382005-oss avatar Mar 22 '26 01:03 lifeibo382005-oss

我觉得应该是bug,返回的内容不大,而且上下文很小。

请提供调用日志和上下文配置

zerob13 avatar Mar 23 '26 06:03 zerob13

I’ve encountered this issue as well. When using public APIs like DeepSeek, tools can be called normally, but when using an OpenAI-compatible API set up with Ollama (0.18.x), a context window insufficient error occurs, even when starting a new session and the model has sufficient context (256K).

Qfield avatar Mar 27 '26 15:03 Qfield

I’ve encountered this issue as well. When using public APIs like DeepSeek, tools can be called normally, but when using an OpenAI-compatible API set up with Ollama (0.18.x), a context window insufficient error occurs, even when starting a new session and the model has sufficient context (256K).

Since providers like Ollama can run many unexpected models, and some model IDs are not standardized, this may prevent correct configuration matching. In such cases, context management can easily break down.

There could be multiple causes for this issue. To accurately diagnose it, I would greatly need the session context at that time, including temperature settings, model configuration, and invocation logs. Thank you very much.

Image Image

zerob13 avatar Mar 28 '26 04:03 zerob13

Image

Qfield avatar Mar 28 '26 14:03 Qfield

Image

The maxTokens setting is too large, which effectively allocates almost the entire context window to the output. As a result, even a small input can cause the request to fail. You can refer to how some third-party providers configure this type of model—see the screenshot here for example.

Image

zerob13 avatar Mar 29 '26 05:03 zerob13

When configuring a custom model, you can search on https://models.anya2a.com/ to obtain recommended settings. Using these configurations will significantly reduce the likelihood of issues.

zerob13 avatar Mar 29 '26 05:03 zerob13

The maxTokens setting is too large, which effectively allocates almost the entire context window to the output. As a result, even a small input can cause the request to fail. You can refer to how some third-party providers configure this type of model—see the screenshot here for example.

My issue is resolved. Thanks for pointing that out.

Qfield avatar Mar 29 '26 12:03 Qfield

The maxTokens setting is too large, which effectively allocates almost the entire context window to the output. As a result, even a small input can cause the request to fail. You can refer to how some third-party providers configure this type of model—see the screenshot here for example.

My issue is resolved. Thanks for pointing that out.

Glad it helped! Enjoy using DeepChat 🚀

zerob13 avatar Mar 29 '26 13:03 zerob13