ask
Method
Make sure you read through the Authentication page first, if you haven't already.
The most basic method under the Bard
class that allows you to query Google Bard.
Example
import Bard from "bard-ai";
let myBard = new Bard(COOKIE);
console.log(await myBard.ask("Hello, world!"));
Parameters
Parameter | Type | Description |
---|---|---|
message | string | The message you are querying Bard with. Required. |
config | object | Some advanced options you can pass in. |
Usage
The most simple usage simply involves passing your message into Bard.ask
. The response of askAI
by default is a string in Markdown format, and it includes images, codeblocks, and other Markdown accessories.
Config
Pass in a configuration JSON, like this:
myBard.ask("Hello, world!", {
format: Bard.JSON,
image: "./image.png",
ids: { ...ids },
});
Config Option | Type | Description |
---|---|---|
format | Bard.MD or Bard.JSON | Return markdown or JSON, respectively |
image | string | Buffer | Give Bard an image to process with Google Lens. See Google Lens |
ids | object | Continue a Chat with a one-time query. See exporting/importing chats. |