Bard
Reverse engineered Google bard cli implemented in golang
Getting started
Prerequisites
- Go: any one of the three latest major releases (we test it with these).
Getting Bard-go
With Go module support, simply add the following import
import "github.com/ganeshk312/bard-go/bard"
to your code, and then go [build|run|test]
will automatically fetch the necessary dependencies.
Otherwise, run the following Go command to install the bard-go
package:
$ go get -u github.com/ganeshk312/bard-go/bard
Authentication
Go to https://bard.google.com/
- F12 for console
- Copy the values
- Session: Go to Application → Cookies →
__Secure-1PSID
. Copy the value of that cookie.
- Provide this token to the NewChatbot api
Developer Documentation
The NewChatbot api returns a bard client of type Chatbot.
Ask function takes message as a string and provides the bard Response object. Bard session retained for the Chatbot client as the functionalities supported by Google bard.
Currently, Bard returns three drafts for each prompt, of type Choice in the Response object
Sample Usage:
chatbot, _ = bard.NewChatbot(sessionID)
response, err := chatbot.Ask(message)