Skip to content

ayusuf9/Agentic-API-Endpoint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Analysis API

A FastAPI application that provides AI-powered natural language querying of database tables, built with FastAPI, asyncpg, and pydantic-ai.

Features

  • Natural language querying of database tables
  • CSV data import
  • Multi-agent AI system for query understanding and data analysis
  • RESTful API with OpenAPI documentation

Setup

  1. Clone the repository
git clone <repository-url>
cd <project-directory>
  1. Install dependencies
pip install -r requirements.txt
  1. Set up environment variables

Create a .env file based on .env.example with your configuration:

cp .env.example .env
# Edit .env with your settings
  1. Set up the database
python scripts/setup_db.py
  1. Run the application

Development mode:

uvicorn app.main:app --reload

Production mode:

gunicorn app.main:app -k uvicorn.workers.UvicornWorker -w 4

API Usage

After starting the server, visit:

Core Endpoints

  • GET /api/v1/tables: List all available tables
  • GET /api/v1/tables/{table_name}: Get detailed table information
  • POST /api/v1/query: Analyze a natural language query
  • POST /api/v1/import/csv: Import data from CSV file

CSV Import Tool

You can import CSV files directly from the command line:

python scripts/import_csv_cli.py path/to/your/file.csv --table optional_table_name

Development

The project follows a modular structure:

  • app/: Main application package
    • main.py: FastAPI application entry point
    • config.py: Configuration settings
    • database.py: Database connection handling
    • models/: Pydantic schemas
    • api/: API routes and dependencies
    • agents/: AI agents for various tasks
    • services/: Business logic
    • utils/: Utilities and helpers

About

Agentic API Endpoint

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages