-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add ChatTemplateKwargs to ChatCompletionRequest #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #980 +/- ##
===========================================
- Coverage 98.46% 85.93% -12.53%
===========================================
Files 24 43 +19
Lines 1364 2268 +904
===========================================
+ Hits 1343 1949 +606
- Misses 15 300 +285
- Partials 6 19 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for a new parameter "chat_template_kwargs" to the ChatCompletionRequest structure to allow for non-standard parameters in chat completions.
- Added the ChatTemplateKwargs field to ChatCompletionRequest to support extra configuration parameters (e.g., think mode for Qwen3).
chat.go
Outdated
@@ -275,6 +275,8 @@ type ChatCompletionRequest struct { | |||
Metadata map[string]string `json:"metadata,omitempty"` | |||
// Configuration for a predicted output. | |||
Prediction *Prediction `json:"prediction,omitempty"` | |||
// ExtraBody provides a way to add non-standard parameters to the request body. such as think mode for qwen3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider updating this comment to reference 'ChatTemplateKwargs' to match the field name and improve grammar by capitalizing 'such' to 'Such' to enhance clarity.
// ExtraBody provides a way to add non-standard parameters to the request body. such as think mode for qwen3 | |
// ChatTemplateKwargs provides a way to add non-standard parameters to the request body. Such as think mode for qwen3. |
Copilot uses AI. Check for mistakes.
chat.go
Outdated
@@ -275,6 +275,8 @@ type ChatCompletionRequest struct { | |||
Metadata map[string]string `json:"metadata,omitempty"` | |||
// Configuration for a predicted output. | |||
Prediction *Prediction `json:"prediction,omitempty"` | |||
// ExtraBody provides a way to add non-standard parameters to the request body. such as think mode for qwen3 | |||
ChatTemplateKwargs map[string]interface{} `json:"chat_template_kwargs,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChatTemplateKwargs map[string]interface{} `json:"chat_template_kwargs,omitempty"` | |
ChatTemplateKwargs map[string]any `json:"chat_template_kwargs,omitempty"` |
@sashabaranov |
@justa-cai @torrischen there are still a few pending comments and I'd also add that we should explicitly name the variable so it would be obvious that the parameter is not related to OpenAI first-party API. I'd be happy to merge after all this is fixed 🫶 |
#ChatTemplateKwargs |
@sashabaranov help meger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for update!
Describe the change
add chat_template_kwargs param support
Provide OpenAI documentation link
vllm qwen3 thinking modes