CoolFace
Apppublic

arthikrangan/text-to-sql-agent-api

sourceHugging Faceupdated 1y agoView on Hugging Face
0likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Text-to-SQL Agent API

A FastAPI backend service that converts natural language queries into SQL and provides intelligent data insights using LangGraph agents.

Overview

This API service enables natural language querying of SQL databases through an AI-powered agent that:

  • Converts text queries to SQL statements
  • Executes queries safely on SQLite databases
  • Provides intelligent data analysis and insights
  • Offers conversational interface for data exploration

Built with FastAPI, LangGraph, and SQLAlchemy for high-performance data querying.

Quick Start

Prerequisites

  • Python 3.8+
  • OpenAI API key

Installation

  1. 1.Clone and setup:
bash
git clone https://github.com/arthikrangan/text-to-sql-agent-api.git
cd text-to-sql-agent-api
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
  1. 1.Install dependencies:
bash
pip install -r requirements.txt
  1. 1.Configure environment:
bash
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY
  1. 1.Run the server:
bash
uvicorn app.main:app --reload

Docker

bash
# Build and run
docker build -t text-to-sql-api .
docker run -p 8000:8000 --env-file .env text-to-sql-api