Skip to main content
Let’s build a simple app that helps users to create SQL queries with natural language.

Preview of the final result

Prerequisites

This example has extra dependencies. You can install them with:

Imports

app.py

Define a prompt template and LLM settings

app.py

Add the Assistant Logic

Here, we decorate the main function with the @on_message decorator to tell Chainlit to run the main function each time a user sends a message. Then, we wrap our text to sql logic in a Step.
app.py

Try it out

You can ask questions like Compute the number of customers who watched more than 50 minutes of video this month.