Simple client to get Google Bard
's answer from your prompt
Just import the library to your project with one of these options:
- Step 1. Add the JitPack repository to your build file
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
- Step 2. Add the dependency
<dependency>
<groupId>com.github.ndanhkhoi</groupId>
<artifactId>GoogleBardClient</artifactId>
<version>v2023.12.15</version>
</dependency>
- Step 1. Add the JitPack repository to your build file
repositories {
maven { url 'https://jitpack.io' }
}
- Step 2. Add the dependency
dependencies {
implementation 'com.github.ndanhkhoi:GoogleBardClient:v2023.12.15'
}
IIt's too easy with few lines of code:
public class BardClientApp {
public static void main(String[] args) {
String secure1psid = "Your __Secure-1PSID Cookie";
String secure1psidts = "Your __Secure-1PSIDTS Cookie";
GoogleBardClient client = GoogleBardClientProvider.newnewInstance(secure1psid, secure1psidts);
Result result = client.chat("Hello");
if (result != null) {
System.out.println(result.getContent());
result.getImages().forEach(e -> System.out.println("Image link: " + e));
}
}
}
- Login to your account in https://bard.google.com/
- Get value of the cookie named
__Secure-1PSID
- Get value of the cookie named
__Secure-1PSIDTS
public class BardClientApp {
// your code
public void exampleForResetConversation() {
client.resetConversation();
}
}
public class BardClientApp {
// your code
public void exampleForAskAboutImage() {
// your code to load image to byte array
client.askAboutImage(bytes, filename, "what is in the image?", "en");
}
}
- acheong08/Bard: Reverse engineering of Google's Bard chatbot API
MIT License
Copyright (c) 2023 Nguyễn Đức Anh Khôi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.