Basics
Bard Chat

Chat Object

Make sure you read through the Authentication page first, if you haven't already.

A Class under the overarching Bard object, used for continued conversations with Bard.

Example

import Bard from "bard-ai";
 
await Bard.init(COOKIE_KEY);
 
let myConversation = new Bard.Chat();
console.log(await myConversation.ask("How are you?"));
console.log(await myConversation.ask("What's the last thing I said?"));

Arguments

ParameterTypeDescription
idsobjectUsed for importing a previous conversation. If left blank, creates a new conversation.

Usage

Create a new conversation with the following code:

let myConversation = new Bard.Chat();

Bard.Chat.ask()

Asks something to the current Bard.Chat() instance.

Example

import Bard from "bard-ai";
 
await Bard.init(COOKIE_KEY);
 
let myConversation = new Bard.Chat();
console.log(await myConversation.ask("What is 1+1?"));
console.log(await myConversation.ask("What is 1 more than that?"));

Usage

Call Bard.Chat.ask() asynchronously on the same instance of Bard.Chat, and it will remember what was previously said. This is similar to continuing on a "Chat" in ChatGPT.

The Bard.Chat.ask() method has the exact same syntax as Bard.askAI() (in fact, they call the same function under the hood). This means that it also supports the useJSON flag. Check the documentation for Bard.askAI() for more information.

Bard.Chat.export()

Exports the current conversation. Go to Importing/Exporting Chats to learn more.