Skip to content

fix(ollama): normalize stray system messages to satisfy strict templates - #85

Merged
MegalithOfficial merged 2 commits into
LettuceAI:mainfrom
Husky110:main
Aug 7, 2026
Merged

fix(ollama): normalize stray system messages to satisfy strict templates#85
MegalithOfficial merged 2 commits into
LettuceAI:mainfrom
Husky110:main

Conversation

@Husky110

@Husky110 Husky110 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Qwen-style Ollama chat templates enforce a single system message pinned to position 0 and raise 'System message must be at the beginning.', surfaced as an opaque 400 'Unable to generate parser for this template'. Lettuce injects depth-positioned system entries mid-conversation, which tripped this guard.

Fold the leading system run into one opening block and demote any later system message to user, preserving content and position.

Husky110 and others added 2 commits August 5, 2026 20:38
Qwen-style Ollama chat templates enforce a single system message pinned
to position 0 and raise 'System message must be at the beginning.',
surfaced as an opaque 400 'Unable to generate parser for this template'.
Lettuce injects depth-positioned system entries mid-conversation, which
tripped this guard.

Fold the leading system run into one opening block and demote any later
system message to user, preserving content and position.
Coalesce demoted mid-conversation system entries with adjacent user turns instead of emitting consecutive user messages. This keeps strict Ollama templates valid while retaining injected prompt content in conversation order.
@MegalithOfficial
MegalithOfficial merged commit a6c99cb into LettuceAI:main Aug 7, 2026
5 checks passed
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.

2 participants