Skip to content

fix(openai): merge custom-provider system prompts#2382

Open
pandego wants to merge 1 commit intodocker:mainfrom
pandego:fix/2327-merge-system-messages
Open

fix(openai): merge custom-provider system prompts#2382
pandego wants to merge 1 commit intodocker:mainfrom
pandego:fix/2327-merge-system-messages

Conversation

@pandego
Copy link
Copy Markdown
Contributor

@pandego pandego commented Apr 11, 2026

Summary

  • merge consecutive system and user messages for custom openai_chatcompletions providers
  • align custom OpenAI-compatible providers with the existing DMR prompt-normalization behavior
  • add regression coverage so custom providers collapse multiple system prompts while the native OpenAI path stays unchanged

Testing

  • docker run --rm -v "$PWD":/src -w /src golang:1.26 sh -lc '/usr/local/go/bin/gofmt -w pkg/model/provider/openai/client.go pkg/model/provider/openai/client_test.go && /usr/local/go/bin/go test ./pkg/model/provider/openai ./pkg/model/provider/oaistream -run "TestConvertMessages_MergesConsecutiveSystemMessagesForCustomProviders|TestConvertMessages_PreservesConsecutiveSystemMessagesForOpenAIProvider|TestConvertMessages|TestMergeConsecutiveMessages" -count=1'

Closes #2327

Signed-off-by: pandego <7780875+pandego@users.noreply.github.com>
@pandego pandego requested a review from a team as a code owner April 11, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Jinja Exception: System message must be at the beginning with custom provider, docker model runner and qwen 3.5 family models

1 participant