-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: use system role for OpenAI Compatible provider when streaming is disabled #8216
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
… disabled - Changed role from "user" to "system" for system prompt in non-streaming mode - Updated test expectations to match the corrected behavior - Ensures consistency between streaming and non-streaming modes Fixes #8215
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.
Reviewing my own code is like debugging in a mirror - everything looks backwards but somehow still broken.
|
@roomote go ahead and implement the suggestions |
|
Acknowledged. Implementing the suggested review changes now: 1) clarify the inline comment about o1 models vs the general non-streaming path, and 2) add a short rationale for using the system role for OpenAI Compatible when streaming is disabled. I will push an update shortly. |
…stem role; align with review suggestions
Review SummaryNo issues found. The PR correctly addresses issue #8215 by:
All tests pass and the implementation handles edge cases (o1/o3/o4 models, DeepSeek reasoner) appropriately. |
|
Summary update:
CI status:
Request:
|
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.
No issues found.
|
I think this logic was there because of openai models that don't support the system role. Does this change break anything there? I wrote the original code so long ago... |
|
This change is for the OpenAI compatible provider. Should we worry about OpenAI models when the native provider is available? Also, the |
Yeah, at the time I think this was to support using o1 through an openai proxy, not 100% sure the use case but a lot of people were interested in it. Maybe no longer an issue though, and this isn't a very elegant way to handle it either way. |
This PR attempts to address Issue #8215. Feedback and guidance are welcome.
Problem
When using OpenAI Compatible providers with streaming disabled, the system prompt was incorrectly being assigned a "user" role instead of "system" role. This inconsistency could cause issues with providers that expect proper role designation.
Solution
Changes
src/api/providers/openai.tsline 222-224 to useChatCompletionSystemMessageParamwith "system" rolesrc/api/providers/__tests__/openai.spec.tsTesting
Fixes #8215
Important
Corrects role assignment for system prompts from "user" to "system" in non-streaming mode in
openai.ts, ensuring consistency with streaming mode.openai.ts.openai.spec.tsto expect "system" role for system prompts in non-streaming mode.This description was created by
for 795f0e9. You can customize this summary. It will automatically update as commits are pushed.