Usage
Just import the library to your project with one of these options:
Using Maven Central Repository:
- 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.08.10</version>
</dependency>
Using Gradle:
- 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.08.10'
}
How to use
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 = new GoogleBardClient(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)); } } }
How to get Cookies
- 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
How to reset conversation
public class BardClientApp { // your code public void exampleForResetConversation() { client.resetConversation(); } }
Dependencies
Thanks to these libraries: