Preview
By Pisuth

What is BabyAGI?

BabyAGI is an AI agent designed to make complex tasks more manageable and controllable made by Yohei Nakajima, and it’s worth mentioning that AGI stands for Artificial General Intelligence, which is a term used to describe AI designed for general-purpose use.

BabyAGI uses OpenAI models and a Vector Database to create, prioritize, and execute tasks based on previous task results and user objectives. It was originally created as a Python script.

AI-Agents

When we input a question or prompt into ChatGPT, we typically receive a single answer from a specific knowledge base in response, which may not be the final answer we are looking for.

However, with a virtual agent, we can access multiple knowledge bases and receive a final solution that assist us in achieving our goals without having to ask a series of questions.

Running BabyAGI with Javascript

In this article, we’ll explore how to use BabyAGI without Python, as it may not be the most suitable option for building complex applications on top of BabyAGI.

A developer has recently released a Javascript version of BabyAGI, with the help of the Chroma team — one of the most popular vector databases in the market. First you need to download the whole repository from:

git clone https://github.com/yoheinakajima/babyagi

Next you will need to download Chroma database into the folder.

cd babyagi/node  
git clone https://github.com/chroma-core/chroma

You need to create a .env file by clone from .env.example file.

cp .env.example .env

Then, open a file and paste your API key from the OpenAI account into it.

OPENAI_API_KEY=sk-...

Make sure that Docker Compose has been installed on your machine before proceeding to the next step.

npm install  
npm run start

Now, you will need to wait a few seconds until the database is ready. Once it is, you can see the BabyAGI command prompt as the screenshot below.

You can use the following objective and initial task to try it out.

  • Objective: Write a node.js script to show current time in London, Tokyo, New York simultaneously
  • Initial task: check time difference from those cities

By default, the script will run as an infinite loop, so you should keep monitoring it until you have gained enough knowledge to fulfill your objective and then close the terminal.

Summary

The concept of an AI agent is not limited to binding with a single AI model. Instead, it opens up the opportunity to use multiple models simultaneously and allows for accessing data from external sources as well as integrating with real-world objects.