Interacting with PostgreSQL in natural language thanks to AI

We’re still accomplishing remarkable feats with AI. A testament to this is an open-source project, currently in the experimental stage, utilizing a multi-agent AI system. This system allows users to pose questions to a PostgreSQL database using natural language.

Fueled by a combination of OpenAI, AutoGen, Postgres, Guidance, Aider, Poetry, and Python, this project stands among the first of its kind capable of leveraging LLMs (Large Language Models) to make decisions with reduced or less explicit instructions.

To familiarize yourself with this tool, grandiosely named “Multi-Agent Postgres Data Analytics,” the creator has produced a series of instructional videos available in a playlist.

To get started, you can position yourself on a branch of the project corresponding to a specific video by following these steps:

  1. Clone the repository:
   git clone
  1. View all branches corresponding to videos in the playlist:
   git branch -a
  1. Choose a branch and switch to it:
   git checkout <branch_name>
  1. Install dependencies:
   poetry install
  1. Copy the sample environment file:
   cp .env.sample .env
  1. Edit the .env file with your PostgreSQL URL and OpenAI key.

Once set up, you can run a prompt on your database like this:

poetry run start --prompt "<ask the AI agent a question>"

Start with simple questions to gauge the system’s response and gradually increase complexity.

Building systems that mimic human decision-making is the goal, but it’s important to note that the realm of AI multi-agent systems has its challenges. Clearly defining the roles and functions of your agents is an art, and costs can escalate, especially during the testing phase. Despite the complexities, the potential rewards make it a worthwhile endeavor. Dive in and explore, and you won’t be disappointed.

5/5 - (3 votes)

See also  Securely Transfer Files Between Computers with Magic Wormhole
Mohamed SAKHRI

I am Mohamed SAKHRI, the creator and editor-in-chief of Tech To Geek, where I've demonstrated my passion for technology through extensive blogging. My expertise spans various operating systems, including Windows, Linux, macOS, and Android, with a focus on providing practical and valuable guides. Additionally, I delve into WordPress-related subjects. You can find more about me on my Linkedin!, Twitter!, Reddit

Leave a Comment