MCPcopy Index your code
hub / github.com/docker/docker-agent / TestBuildSession_AcceptsImageParts

Function TestBuildSession_AcceptsImageParts

pkg/chatserver/server_test.go:418–438  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

416}
417
418func TestBuildSession_AcceptsImageParts(t *testing.T) {
419 t.Parallel()
420 sess := buildSession([]ChatCompletionMessage{{
421 Role: "user",
422 Parts: []ContentPart{
423 {Type: "text", Text: "What is this?"},
424 {Type: "image_url", ImageURL: &ContentImageURL{URL: "https://example.com/x.png"}},
425 },
426 }})
427 require.NotNil(t, sess)
428
429 all := sess.GetAllMessages()
430 require.Len(t, all, 1)
431 last := all[0].Message
432 assert.Equal(t, chat.MessageRoleUser, last.Role)
433 require.Len(t, last.MultiContent, 2)
434 assert.Equal(t, chat.MessagePartTypeText, last.MultiContent[0].Type)
435 assert.Equal(t, chat.MessagePartTypeImageURL, last.MultiContent[1].Type)
436 require.NotNil(t, last.MultiContent[1].ImageURL)
437 assert.Equal(t, "https://example.com/x.png", last.MultiContent[1].ImageURL.URL)
438}
439
440func TestStopSequences_UnmarshalJSON(t *testing.T) {
441 t.Parallel()

Callers

nothing calls this directly

Calls 3

buildSessionFunction · 0.85
GetAllMessagesMethod · 0.80
LenMethod · 0.65

Tested by

no test coverage detected