From 7ead0449f25ee5d17cf1828d405e49756587395c Mon Sep 17 00:00:00 2001 From: Timothy Carambat Date: Fri, 24 Apr 2026 15:40:05 -0700 Subject: [PATCH] Fix deepseek v4 reasoning inject thoughts (#5527) * Fix deepseek v4 injectReasoning error resolves #5509 * comment --- server/utils/agents/aibitat/providers/deepseek.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/utils/agents/aibitat/providers/deepseek.js b/server/utils/agents/aibitat/providers/deepseek.js index d25ae5f7a..e824b6cd5 100644 --- a/server/utils/agents/aibitat/providers/deepseek.js +++ b/server/utils/agents/aibitat/providers/deepseek.js @@ -54,8 +54,20 @@ class DeepSeekProvider extends InheritMultiple([Provider, UnTooled]) { return rest; } + /** + * Check if the model is a thinking model + * because we need to inject reasoning content into the messages + * or else the DeepSeek API will return an error for specific models. + * There is no official way to predetect if a model will require this + * so we have to hardcode the list of thinking models. + * @returns {boolean} + */ get #isThinkingModel() { - return this.model === "deepseek-reasoner"; + return [ + "deepseek-reasoner", + "deepseek-v4-flash", + "deepseek-v4-pro", + ].includes(this.model); } get #tooledOptions() {