-
Notifications
You must be signed in to change notification settings - Fork 99
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
GenerateContentResponse.text may not return all the response info #99
Comments
When I looked at the implementations in the other languages this was the behavior I saw. Looking back through the design docs I think the intention may have been to throw if there are multiple candidates, but I don't recall if that was the behavior I saw in the other implementations. |
I have been printing the responses I'm getting back for a local tool I'm running, and (anecdotally) haven't seen more than one candidate. |
You can also enforce a single candidate by setting the I think the main thing we can do is expand the docs to mention this. |
We now concatenate parts #160 We don't concatenate candidates, and it wouldn't make sense to. I think we can add a |
Closes #99 Call out that candidates may be ignored in the doc for `GenerateContentResponse.text`. Add a `text` getter on `Candidate`. This is the same logic that was in the response text getter, applied to an individual candidate. Refactor the response text implementation to use the candidate field.
Closes #99 Call out that candidates may be ignored in the doc for `GenerateContentResponse.text`. Add a `text` getter on `Candidate`. This is the same logic that was in the response text getter, applied to an individual candidate. Refactor the response text implementation to use the candidate field.
It looks like
GenerateContentResponse.text
just returns the text from the firstCandidate
in the candidates list, and from that candidate, the firstTextPart
in the parts list. I don't know about the guarantees wrt what the server returns, but it would probably be good to concatenate the returned candidates and parts (or, not offer a simplified API?).The text was updated successfully, but these errors were encountered: