Skip to main content

LLM-based SQL Generation

From version 0.7.0 onwards, Parseable supports LLM-based SQL generation, leveraging the power of OpenAI's language models (LLMs). With this feature, you can use natural language to generate SQL queries for analyzing your logs effortlessly.

Getting Started

To get started with LLM-based SQL generation, follow these simple steps:

  • Add the P_OPENAI_API_KEY environment variable in your server.
  • Set the variable's value to your OpenAI API token.
  • You can obtain your OpenAI API token from this link.

That's it! Once the P_OPENAI_API_KEY variable is set, Parseable will automatically detect it and provide you with a input text field in the UI where you can enter natural language queries to generate SQL.

Data Mapping to Ensure Valid SQL

To generate SQL that matches your table structure accurately, Parseable includes your table schema in the query sent to the LLM. This schema includes just th column names and their data types. This ensures that the SQL generated is valid and aligns with your table definition. No other data is shared to the LLM used.

Things to Note

  • The LLM only generates the SQL. It doesn't run the query untill you manually hit the Run button.
  • You have the option to tweak the SQL generated further to your liking before finally running it.

Future Enhancements

Parseable has exciting plans for the future. In addition to supporting OpenAI, we aim to integrate with other popular LLMs, including open-source and self-hostable LLMs like LLaMa. Stay tuned for more updates!