Press ESC to close

Introducing SQL Task Type Classifier API: Smarter Text-to-SQL Systems Start Here

Ever built a text-to-SQL system only to realize you have no idea whether the generated query is going to read data or accidentally delete your entire production database?

Today, I'm excited to announce the launch of the SQL Task Type Classifier API – a machine learning-powered service that helps text-to-SQL developers understand what their users are actually trying to do before sending the prompt to your LLM.

The Problem Every Text-to-SQL Developer Faces

Let's say you're building a text-to-SQL system that only allows users to read data from your database. Smart move – you create a database user with read-only permissions. Protected at the database layer, right?

But here's what's actually happening: A user types "delete all inactive accounts." Your application sends that prompt to GPT-5 or Claude to generate SQL. That might be 1000+ tokens. The LLM returns a perfectly valid DELETE statement. Your database rejects it because of read-only permissions. Great!

Except you just burned $0.03 on an LLM call that should never have happened in the first place.

Now multiply that by hundreds of users making invalid requests throughout the day. "Update customer email addresses." "Drop the old orders table." "Insert a new user record." Your text-to-SQL system dutifully sends every single write operation to your expensive LLM API, generates SQL, and only then realizes at the database layer that it shouldn't execute.

You're protecting your database, but you're bleeding money on unnecessary LLM calls.

This is the problem: Without classification upfront, you can't filter out invalid operations before they hit your LLM. Every prompt – valid or not, safe or dangerous – costs you tokens.

What Makes This API Different

The SQL Task Type Classifier API doesn't just tell you if a query is SELECT or DELETE. It understands the intent behind natural language prompts and classifies them into meaningful categories:

sql_classifier_poster_landscape

Data Retrieval
Queries that fetch information without modifications. Think "show me all users who signed up last month" or "get the top 10 selling products."

Data Manipulation
Operations that modify existing data. "Update customer email addresses" or "delete expired sessions" fall here.

Data Definition
Structural changes to your database. "Create a new orders table" or "add an index to the users table."

Analytics and Reporting
Complex queries involving aggregations, joins, and statistical operations. "Calculate average revenue per customer by region."

But here's the real game-changer: every classification comes with an operation type – `read` or `write`. This single piece of metadata can transform how you architect your text-to-SQL system.

How It Works Under the Hood

The API leverages sentence transformers for semantic understanding. Unlike keyword matching or regex patterns, it actually comprehends what users mean, not just what they say.

Here's what happens when you send a prompt:

sql-classifier-one-1

1. Text embedding using pre-trained sentence transformers
2. Classification through a trained ML model
3. Confidence scoring to help you handle edge cases
4. Operation type determination based on predicted task

The entire pipeline runs in milliseconds. We're talking 200-300ms response times even under load.

Getting Started

Using the API is dead simple. No SDKs to install, no complex authentication flows. Just HTTP and JSON.

Making Your First Request

curl -X POST https://api.aurarios.cloud/v1/sql/predict \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "retrieve all users from the database"
  }'

Understanding the Response

{
  "predicted_class": "data retrieval",
  "confidence_score": 0.95,
  "operation": "read"
}

That confidence score? Use it. If it's below 0.8, maybe flag the query for manual review. If it's above 0.9, you're golden – execute with confidence.

Try It Yourself

Ready to make your text-to-SQL system smarter?

API Endpoint: https://api.aurarios.cloud/v1/sql/predict

Interactive Documentation: Check out the Swagger UI at https://api.aurarios.cloud/docs to test queries right in your browser.

Example Prompts to Try:
- "show me all customers from New York"
- "delete inactive accounts older than 6 months"
- "create an index on the email column"
- “calculate total revenue by product category”

Watch how the API classifies each one differently based on intent, not just keywords.

Final Thoughts

Every text-to-SQL system needs to answer two fundamental questions: Is this actually a database task? And if so, is it safe to execute? We have solved the second one, the first one? Maybe next release?

With the SQL Task Type Classifier API, you get those answers in milliseconds. Protect your database, save on LLM costs, and build smarter text-to-SQL systems.

No more treating every prompt the same. No more burning tokens on invalid requests. No more hoping nothing breaks.

Just classify first, execute smart.

Support: samnangpheng.com