kpmuks2709/cobol-rag-lineage
0
COBOL RAG Lineage Q&A System
A RAG (Retrieval-Augmented Generation) system for querying COBOL codebase using natural language.
Setup
1. Install Dependencies
pip install -r requirements.txt2. Set OpenAI API Key
export OPENAI_API_KEY='your-api-key-here'Or on Windows:
set OPENAI_API_KEY=your-api-key-here3. Initialize the System (First Time Only)
python RAG_lineage_POC_v2.pyThis will:
- Generate descriptions for all COBOL files
- Create embeddings and FAISS index
- Save metadata
Note: This step may take several minutes depending on the number of COBOL files.
Running the Application
Quick Start (Recommended)
On Mac/Linux:
./run.shOn Windows:
run.batOr manually:
python app.pyAccess Options
- Local Access:
http://localhost:7860(only on your machine)
- Public Shareable Link: The app automatically creates a public link when you run it. You'll see output like:
Running on local URL: http://127.0.0.1:7860
Running on public URL: https://xxxxx.gradio.liveShare the public URL with others to give them access. The link is active as long as your server is running.
Usage
- Initialize System (if not already done):
- Go to "Initialize System" tab
- Click "Initialize RAG System" button
- Wait for completion
- Query COBOL Code:
- Go to "Query COBOL Code" tab
- Enter your question
- Click "Submit Query"
- View the response
Example Queries
- "What are the input and output variables in transaction processing programs?"
- "Which files handle user authentication?"
- "Show me files that process account data"
- "What are the main functions in the COBOL codebase?"
Project Structure
Lineage_RAG_POC_V2/
├── app.py # Gradio web interface
├── RAG_lineage_POC_v2.py # Main RAG logic
├── requirements.txt # Python dependencies
├── cobol_files/ # COBOL source files
├── faiss_cobol_v2.index # FAISS vector index (generated)
├── cobol_metadata_v2.json # Metadata (generated)
└── Cobol_code_desc_v2.csv # Descriptions (generated)Troubleshooting
- Import Error: Make sure all dependencies are installed:
pip install -r requirements.txt - FAISS Index Not Found: Run initialization first:
python RAG_lineage_POC_v2.py - API Key Error: Ensure
OPENAI_API_KEYenvironment variable is set - Port Already in Use: Change the port in
app.py:server_port=7861
