googlebard
[!WARNING]\ Google is trying to stop these 3rd party APIs, so
bard-ai
may not work for some of you. Try following the steps on the FAQ. However, if that still does not work, it may be time to migrate to thepalm-api
package, for the official PaLM v2 API.
Compared to alternative Bard API googlebard
:
[^1]:
Run with hyperfine --runs 3
between bard-ai
v2.0 and googlebard
.
Equivalent code was used in the runs:
**`bard-ai`**:
```javascript
import Bard from "bard-ai";
let bot = new Bard(COOKIE);
console.log(await bot.ask("Hello world!"));
console.log(await bot.ask("What is 1+1?"));
console.log(await bot.ask("What about 2+2?"));
console.log(await bot.ask("Goodbye."));
```
**`googlebard`**:
```javascript
import { Bard } from "googlebard";
let bot = new Bard(`__Secure-1PSID=${COOKIE}`);
console.log(await bot.ask("Hello world!"));
console.log(await bot.ask("What is 1+1?"));
console.log(await bot.ask("What about 2+2?"));
console.log(await bot.ask("Goodbye."));
```
**Result**:
```bash
Benchmark 1: node bard-ai.js
Time (mean ± σ): 18.346 s ± 0.768 s [User: 0.307 s, System: 0.067 s]
Range (min … max): 17.531 s … 19.057 s 3 runs
Benchmark 2: node googlebard.js
Time (mean ± σ): 37.179 s ± 3.714 s [User: 1.416 s, System: 0.191 s]
Range (min … max): 34.230 s … 41.349 s 3 runs
Summary
'node bard-ai.js' ran
2.03 ± 0.22 times faster than 'node googlebard.js'
```
Copy the cookie labled __Secure-1PSID
on bard.google.com, and use it in the code here:
import Bard from "bard-ai";
let myBard = new Bard(COOKIE);
console.log(await myBard.ask("Hello, world!"));
Continue to explore full features, including Google Lens integration, with the docs.
A special shoutout to these amazing indviduals:
@acheong08 Original Python Bard API |
@ThatXliner Maintainer |
@Aldhanekaa Typescript and Feature Developer, Maintainer |
@RFS-ADRENO TypeScript Developer, Maintainer |
However, we thank every person that helps in the development process of this library, no matter that be in code, ideas, or anything else.