Repository navigation
hive/openai-server: only system words that lead a request are the system prompt - #106
Merged
Merged
Conversation
…tem prompt; later ones are a note in their turn
…ge where it was said
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every system or developer message anywhere in a conversation was folded into one system prompt. A client that appends a system item mid-conversation (wryme's bookkeeping prod, since wryme#78) changed the system prompt on every prod, and claude-cli re-sends the whole
<system>block whenever it changes: the model got every prod so far stacked into one turn, growing each time, and the prompt cache missed.Now system words go both ways intact:
conversation.ts):Reader.toldkeeps only the system words that lead a request as the system prompt. Later ones are a text petal in the turn they came in,<system>\n…\n</system>(noted), said once where they were said. Leading means before any other item of this request, so aprevious_response_idcontinuation that opens with a developer message still sets the system prompt.nurse.ts):saidsplits such a note (noteOf) back out as a{role: "system"}message in place, both for the asked turn and for the graft (messagesOf). An OpenAI-compatible model sees the system message where the client put it, not as user text.Tests:
conversation.test.ts: a late system item is a note in its turn; several land once each in their own turnsnurse.test.ts: a chat with a late system message reads in and says back out to the model unchangedFull suite: 83 pass, 0 fail (22 live skipped).