In the first part of this series, we built a basic AI-powered database agent. Now, it’s time to make a minimal viable product out of it. We’ll refine our scripts, add support for MySQL, incorporate OpenAI, and wrap everything in a user-friendly interface with Docker for easy deployment. Get ready to transform your data interactions into a seamless, intuitive experience.

Hello OSADA

I created OSADA—Open Source AI Database Agent—an experimental open source tool with a chat-like user interface that can convert text to SQL, query data from MySQL or PostgreSQL, and respond to human-language queries. 

TL;DR demo

What’s inside

There are three main components in the tool:

  1. Langchain – An open source python library that offers developers a comprehensive set of resources to develop applications that run on Large Language Models (LLMs). 
  2. Large Language Models themselves – Users can choose between Gemini and OpenAI models.
  3. Chainlit – An open source async Python framework that allows developers to build scalable Conversational AI or agentic applications.

The script itself is less than 100 lines of code and pretty rudimentary, but good enough for a demo.

How to use

There is a docker container for quick experimentation. The only caveat is that currently, it requires the user to set various environment variables. 

It looks like this:

This starts a container and exposes the UI on port 8000. 

Read more in the usage guide.

What’s next

The tool is currently in the experimental phase and was created solely for demonstration purposes. It has several obvious improvements.

Interactive UI

Right now, various environment variables must be specified; otherwise, the script crashes. To make it more interactive, the Ask User feature of Chainlit could be used. That way, users can provide database and LLM credentials through the application itself.

Multiple databases

Users can now query only a single database. We can make it possible to make smart queries across the fleet of database servers and perform correlation of results. 

Other

There are obvious improvements like making docker image smaller, adding authentication to the UI, and supporting more large language models (including self-hosted ones).

Conclusion

OSADA is an experimental tool that proves the concept that database agents can provide immense value. Users can now query databases with no SQL knowledge and zero understanding of how data is structured. Large Language Models will do the heavy lifting and do their best to fetch the answer.

Try OSADA right now, and let me know what you think. Check out the GitHub repository.

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments