Skip to content

Commit 7bfafe3

Browse files
committed
fix: use system role for OpenAI Compatible provider when streaming is 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
1 parent 6c2aa63 commit 7bfafe3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/api/providers/__tests__/openai.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ describe("OpenAiHandler", () => {
494494
{
495495
model: azureOptions.openAiModelId,
496496
messages: [
497-
{ role: "user", content: systemPrompt },
497+
{ role: "system", content: systemPrompt },
498498
{ role: "user", content: "Hello!" },
499499
],
500500
},

src/api/providers/openai.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ export class OpenAiHandler extends BaseProvider implements SingleCompletionHandl
219219
}
220220
} else {
221221
// o1 for instance doesnt support streaming, non-1 temp, or system prompt
222-
const systemMessage: OpenAI.Chat.ChatCompletionUserMessageParam = {
223-
role: "user",
222+
const systemMessage: OpenAI.Chat.ChatCompletionSystemMessageParam = {
223+
role: "system",
224224
content: systemPrompt,
225225
}
226226

0 commit comments

Comments
 (0)