-
Notifications
You must be signed in to change notification settings - Fork 642
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
Gemini docs : The multi-turn conversations example needs a slight modification #250
Comments
@ImadSaddik Sorry that you ran into that, but I'm glad that you managed to find the solution - and thanks for calling it out! We have now added |
Awesome 😎 |
Whenever I add setRole its actually returning error and build() is not getting detected and if I write This way then addText is not detected |
@MohammedAbidNafi That's because these methods don't return a builder. You'll have to use them exactly as the snippet above: Content.Builder userMessageBuilder = new Content.Builder();
userMessageBuilder.setRole("user");
userMessageBuilder.addText("How many paws are in my house?");
Content userMessage = userMessageBuilder.build(); Java support has not been prioritized in this SDK, unfortunately, so we ended up with these uncovenient APIs :/ |
The following code was taken from the Quickstart tutorial, that shows how to use Gemini in Android. In the multi-turn conversations example, I faced a problem when running the provided code snippet.
When using the code as is, I get an Exception and to solve the problem. We should specify the user role when creating the userMessage.
So instead of this :
It should be replaced by :
The text was updated successfully, but these errors were encountered: