A powerful AI package (built using typescript) for interacting with the Google Bard API, without needing to set your own cookie!
npm install bardie-ts
BardieTSbash
npm i bardie-ts
`
#### pnpm -
`bash
pnpm add bardie-ts
`
#### yarn -
`bash
yarn add bardie-ts
`
💡 Examples Of Use
$3
#### Typescript Usage -
To use BardieTS in typescript, create a file named index.ts in your project's root directory and make sure you have ts-node (or equivalent) installed.
Once you have an index.ts file with the contents below, execute ts-node index.ts in your terminal.
`typescript
import BardieTS from "bardie-ts";
const bard = new BardieTS();
const options = {
ask: "Keep it simple... What is Google Bard?"
};
async function askQuestion() {
try {
const result = await bard.question(options);
console.log(result.content);
} catch (error: any) {
console.error("Error:", error.message);
}
};
askQuestion();
`
#### Javascript Usage -
To use BardieTS in javascript, create a file named index.js in your project's root directory. You should already have node installed.
Once you have an index.js file with the contents below, execute node index.js in your terminal.
`javascript
const BardieTS = require("bardie-ts");
const bard = new BardieTS();
async function askQuestion() {
const result = await bard.question({
ask: "Keep it simple... What is Google Bard?"
});
console.log(result.content);
}
askQuestion();
`
#### Response:
> "In a nutshell, I'm Google's AI helper you can chat with.
I can answer your questions, generate creative text formats, and help you with various tasks in a simple and informative way.
Think of me as a friendly AI companion ready to assist you anytime!"
$3
#### Typescript Usage -
`typescript
import BardieTS from "bardie-ts";
const bard = new BardieTS();
const options = {
ask: "Keep it simple... What is this image?",
image: "https://i.imgur.com/OgoPlnf.png"
};
async function askQuestionWithImage() {
try {
const result = await bard.question(options);
console.log(result.content);
} catch (error: any) {
console.error("Error:", error.message);
}
};
askQuestionWithImage();
`
#### Javascript Usage -
`javascript
const BardieTS = require("bardie-ts");
const bard = new BardieTS();
async function askQuestionWithImage() {
const result = await bard.question({
ask: "Keep it simple... What is this image?",
image: "https://i.imgur.com/OgoPlnf.png"
});
console.log(result.content);
}
askQuestionWithImage();
``