File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ func TestMessagesPrepareBasic(t *testing.T) {
1212 if got == "" {
1313 t .Fatal ("expected non-empty prompt" )
1414 }
15- if got != "Hello" {
15+ if got != "<|User|> Hello" {
1616 t .Fatalf ("unexpected prompt: %q" , got )
1717 }
1818}
@@ -55,7 +55,7 @@ func TestMessagesPrepareArrayTextVariants(t *testing.T) {
5555 },
5656 }
5757 got := MessagesPrepare (messages )
58- if got != "line1\n line2" {
58+ if got != "<|User|> line1\n line2" {
5959 t .Fatalf ("unexpected content from text variants: %q" , got )
6060 }
6161}
Original file line number Diff line number Diff line change @@ -162,13 +162,16 @@ func TestMessagesPrepareMergesConsecutiveSameRole(t *testing.T) {
162162 {"role" : "user" , "content" : "World" },
163163 }
164164 got := MessagesPrepare (messages )
165+ if ! strings .HasPrefix (got , "<|User|>" ) {
166+ t .Fatalf ("expected user marker at the start, got %q" , got )
167+ }
165168 if ! strings .Contains (got , "Hello" ) || ! strings .Contains (got , "World" ) {
166169 t .Fatalf ("expected both messages, got %q" , got )
167170 }
168- // Should be merged without <|User|> between them
171+ // Should be merged into a single user turn with one marker at the start.
169172 count := strings .Count (got , "<|User|>" )
170- if count != 0 {
171- t .Fatalf ("expected no User marker for first message pair, got %d occurrences" , count )
173+ if count != 1 {
174+ t .Fatalf ("expected one User marker for the merged pair, got %d occurrences" , count )
172175 }
173176}
174177
You can’t perform that action at this time.
0 commit comments