Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

fix(chat): exclude ChatTemplateKwargs for OpenAI API

JAESOL SHINddf5ae4e659b
diff --git a/internal/models/chat/remote_api.go b/internal/models/chat/remote_api.go
index b4881e80d..1833dc02c 100644
--- a/internal/models/chat/remote_api.go
+++ b/internal/models/chat/remote_api.go
@@ -204,8 +204,13 @@ func (c *RemoteAPIChat) buildChatCompletionRequest(messages []Message,
}
}
- req.ChatTemplateKwargs = map[string]interface{}{
- "enable_thinking": thinking,
+ // ChatTemplateKwargs is only supported by custom backends like vLLM.
+ // Official APIs (OpenAI, Aliyun, Zhipu, etc.) do not support this parameter
+ // and will return 400 Bad Request if it's included.
+ if c.provider == provider.ProviderGeneric {
+ req.ChatTemplateKwargs = map[string]interface{}{
+ "enable_thinking": thinking,
+ }
}
// Log LLM request for debugging