Skip to content

Repository files navigation

AI Pilot Training Chatbot

A comprehensive AI-powered chatbot for pilot training, built with OpenAI GPT-4 and a comprehensive FAA knowledge base.

Features

  • Comprehensive Knowledge Base: 1,931 documents from official FAA sources including:

    • FAA Regulations (FARs)
    • Airplane Flying Handbook
    • Instrument Flying Handbook
    • Aviation Instructor's Handbook
    • Aeronautical Information Manual (AIM)
    • Private Pilot ACS
    • Instrument Rating ACS
    • Commercial Pilot ACS
    • Flight Instructor ACS
    • Advisory Circulars
  • AI-Powered Responses: Uses OpenAI GPT-4 to provide accurate, contextual answers

  • Source Citations: All responses include references to official FAA materials

  • Professional Interface: Clean, pilot-focused chat interface

  • Feedback System: Rate responses to improve the system

Architecture

  • Backend: Flask API with OpenAI integration and SQLite vector database
  • Frontend: React.js with modern UI components
  • Knowledge Processing: Advanced text chunking with tiktoken for optimal retrieval

Setup Instructions

Prerequisites

  • Python 3.8+
  • Node.js 14+
  • OpenAI API Key

Backend Setup

  1. Navigate to the backend directory:

    cd backend
  2. Create and activate virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install flask flask-cors openai numpy requests beautifulsoup4 PyPDF2 tiktoken python-dotenv
  4. Set your OpenAI API key:

    # Edit .env file and add your API key:
    OPENAI_API_KEY=sk-your-actual-key-here
  5. Build the knowledge base (optional - pre-built version included):

    python pilot_training_scraper.py
  6. Start the backend server:

    python pilot_backend.py
  7. Load the knowledge base:

    curl -X POST http://localhost:5001/api/ingest \
         -H 'Content-Type: application/json' \
         -d '{"file_path": "pilot_training_knowledge_base.json"}'

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Start the development server:

    npm start
  4. Open your browser to: http://localhost:3000

Usage

Once both servers are running, you can:

  1. Ask questions about pilot training topics
  2. Get detailed explanations with FAA source citations
  3. Explore regulations, procedures, and ACS requirements
  4. Receive accurate, up-to-date aviation information

Example Questions

  • "What are the weather minimums for VFR flight?"
  • "How do I log cross-country time?"
  • "What are the private pilot certificate requirements?"
  • "Explain the four forces of flight"
  • "What's required for a biennial flight review?"

API Endpoints

  • GET /health - Health check
  • POST /api/chat - Main chat endpoint
  • POST /api/ingest - Load knowledge base
  • POST /api/feedback - Submit feedback
  • GET /api/stats - System statistics

Cost Information

  • Estimated monthly cost: $5-15 for moderate use
  • Embedding model: text-embedding-3-small ($0.02 per 1M tokens)
  • LLM model: gpt-4o-mini ($0.15 per 1M input, $0.60 per 1M output)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Disclaimer

This chatbot is for educational purposes only. Always consult official FAA publications and your CFI for authoritative guidance on aviation matters.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages