fix(chat): exclude ChatTemplateKwargs for OpenAI API
ChatTemplateKwargs parameter is only supported by custom backends like vLLM. OpenAI API does not support this parameter and returns 400 Bad Request error. This change conditionally includes ChatTemplateKwargs only when the provider is ProviderGeneric (custom deployment). Fixes connection test failure for OpenAI models with error: "Unrecognized request argument supplied: chat_template_kwargs"main
parent
002f1c40fa
commit
ddf5ae4e65
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue