diff --git a/go/plugins/googleai/googleai_test.go b/go/plugins/googleai/googleai_test.go index 57df79c4c9..9b68654751 100644 --- a/go/plugins/googleai/googleai_test.go +++ b/go/plugins/googleai/googleai_test.go @@ -141,7 +141,7 @@ func TestLive(t *testing.T) { out := "" parts := 0 g := googleai.Model(generativeModel) - _, err = ai.Generate(ctx, g, req, func(ctx context.Context, c *ai.GenerateResponseChunk) error { + final, err := ai.Generate(ctx, g, req, func(ctx context.Context, c *ai.GenerateResponseChunk) error { parts++ out += c.Content[0].Text return nil @@ -149,6 +149,13 @@ func TestLive(t *testing.T) { if err != nil { t.Fatal(err) } + out2 := "" + for _, p := range final.Candidates[0].Message.Content { + out2 += p.Text + } + if out != out2 { + t.Errorf("streaming and final should contain the same text.\nstreaming:%s\nfinal:%s", out, out2) + } const want = "Golden" if !strings.Contains(out, want) { t.Errorf("got %q, expecting it to contain %q", out, want)