prepend image tags (#2789)

instead of appending image tags, prepend them - this generally produces better results
This commit is contained in:
Michael Yang 2024-02-29 11:30:14 -08:00 committed by GitHub
parent fa2f2b3563
commit 0e19476b56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 18 deletions

View file

@ -155,7 +155,7 @@ func TestChatPrompt(t *testing.T) {
{Role: "user", Content: "Hello", Images: []api.ImageData{[]byte("base64")}},
},
window: 1024,
want: "You are a Wizard. Hello [img-0]",
want: "You are a Wizard. [img-0] Hello",
},
{
name: "images truncated",
@ -165,7 +165,7 @@ func TestChatPrompt(t *testing.T) {
{Role: "user", Content: "Hello", Images: []api.ImageData{[]byte("img1"), []byte("img2")}},
},
window: 1024,
want: "You are a Wizard. Hello [img-1]",
want: "You are a Wizard. [img-0] [img-1] Hello",
},
{
name: "empty list",
@ -198,7 +198,7 @@ func TestChatPrompt(t *testing.T) {
}
if got != tc.want {
t.Errorf("got = %v, want %v", got, tc.want)
t.Errorf("got: %q, want: %q", got, tc.want)
}
})
}