bard-go

command module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 6 Imported by: 0

README

Bard

Reverse engineered Google bard cli implemented in golang Go Reference

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)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL