Skip to content

fix(go/plugins/googlegenai): Tool calls with streaming #2980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions go/plugins/googlegenai/gemini.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func generate(

// merge all streamed responses
var resp *genai.GenerateContentResponse
var chunks []string
var chunks []*genai.Part
for chunk, err := range iter {
// abort stream if error found in the iterator items
if err != nil {
Expand All @@ -434,7 +434,7 @@ func generate(
return nil, err
}
// stream only supports text
chunks = append(chunks, c.Content.Parts[i].Text)
chunks = append(chunks, c.Content.Parts[i])
}
// keep the last chunk for usage metadata
resp = chunk
Expand All @@ -445,7 +445,7 @@ func generate(
merged := []*genai.Candidate{
{
Content: &genai.Content{
Parts: []*genai.Part{genai.NewPartFromText(strings.Join(chunks, ""))},
Parts: chunks,
},
},
}
Expand Down
Loading