A Python tool to query API documentation and technical cheat sheets using Retrieval-Augmented Generation (RAG). Ingests Markdown docs, builds a semantic vector store (FAISS), and answers natural language questions with relevant code snippets or explanations.
rag-coding-helper/
├── main.py                # CLI entry point
├── requirements.txt       # Python dependencies
├── README.md              # Project documentation
├── LICENSE                # MIT License
├── .gitignore             # Git ignore rules
├── data/                  # Markdown docs (API, cheatsheets)
│   ├── pandas.md
│   ├── requests.md
│   ├── ...
├── rag/                   # Core RAG logic
│   ├── helper.py
│   ├── retriever.py
│   ├── llm.py
│   └── __init__.py
├── app/                   # (Optional) App entrypoints
│   └── main.py
├── tests/                 # Unit tests
│   └── test_llm.py
- Ingests Markdown documentation and cheat sheets
- Builds a FAISS vector store for fast semantic search
- Supports HuggingFace, OpenAI, or mock embeddings (offline)
- Natural language question answering with code snippet retrieval
- Extensible: add your own docs to data/
- Clone the repository
git clone https://github.com/yourusername/rag-coding-helper.git cd rag-coding-helper
- Create a virtual environment
python3 -m venv .venv source .venv/bin/activate
- Install dependencies
pip install -r requirements.txt 
- (Optional) Set OpenAI API key
- For OpenAI embeddings, set your API key:
export OPENAI_API_KEY=your-key-here
 
- For OpenAI embeddings, set your API key:
Run the CLI and ask a question:
python main.pySample session:
Building vectorstore...
Vectorstore ready. You can now ask questions!
Ask a question (or type 'exit' to quit): How do I create a DataFrame in pandas?
Answer:
df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
print(df)
Ask a question (or type 'exit' to quit): exit
Goodbye!
- Mock Embeddings (default):
- Works offline, no API keys needed.
- Set use_mock=True(default in code).
 
- HuggingFace Embeddings:
- Install sentence-transformers.
- Set USE_HUGGINGFACE = Trueinrag/retriever.py.
 
- Install 
- OpenAI Embeddings:
- Set USE_HUGGINGFACE = Falseinrag/retriever.py.
- Set your OPENAI_API_KEYenvironment variable.
 
- Set 
- Fork the repo and create a feature branch
- Write clear, well-documented code
- Add or update tests in tests/
- Submit a pull request with a clear description
This project is licensed under the MIT License © 2025 ShinyPhoenix000.