Playground
Agent Server where you can deploy PremSQL agents in the most customized forms.
Welcome to the first release of PremSQL playground. You can think of Playground as a similar environment like chatGPT UI for specialized for RAGs on databases. There are different personas of usage of the PremSQL playground. Before diving in, ensure you have a basic understanding of the following premsql components:
Generators Tutorial
A step-by-step guide on how to use Text-to-SQL generators to create SQL queries from user input and specified database sources.
Executors Tutorial
Learn how to connect to databases and execute SQL queries generated by models. This tutorial covers execution, troubleshooting, and best practices.
For Analysts and general users
If you are not interested in customizing PremSQL much, and just here want to use LLM powered data analysis, then just use our CLI to start the app and either connect your database manually or connect to bunch of CSVs files inside a folder or import it from kaggle. Here is how you launch the server:
And here is how you start the agent server using PremAI. Paste this code and run it inside another terminal:
And now run: python server.py
. Here is a quick demo on How your analysis experience would look like.
If you want to do the above in fully local setting using Ollama, check out our introduction page.
For Developers
Here we discuss in more details on how Agent Server is being designed. Agent Server is a wrapper around FastAPI server. As we discussed in the Agents that it supports two forms of outputs: ExitWorkerOutput
and AgentOutput
. When using AgentServer it by default uses AgentOutput
. Here is a breif architecture of AgentServer.
As you can see from the above architecture, you can create independent sessions using the starter script. You can do different levels of customization on this. For instance:
- You can use different generators and different models
- You can add your own DB executor
- Last but not the least, you can add a new worker or make your own agent using combination of our pre-existing worker implementations and your own logics.
Creating your own Worker or Agent
You can use existing PremSQL components (like generators, executors and workers from existing BaseLine worker) to create your own worker or your own agent. The one thing that you need to adhere with is, PremSQL currently only supports main three types of routes viz: /query
(for Text to SQL), /plot
(for plotting dataframes) and /analyse
(for analysing dataframes and question answering). Each of the worker (in the Baseline as well) is inherited from a baseclass. And each of them follows a strict output pydantic model so that we can maintain a reliable structured output generation. Once you complete your implementation of your own agent / worker you can use with AgentServer to test it out.
When using AgnentServer, you can also the internal Backend API (written on django) to see information around different sessions and do basic crud operations as shown here:
This will enable you to use PremSQL agents using CuRL, Python requests and also Javascript Axios.
Limitations
Currently, there are some limitations in PremSQL playground. Mostly it comes with some bugs around port forwarding and some DB releated issues. Reach us out in GitHub issues so that we can fix them.