|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Commands |
| 6 | + |
| 7 | +### Development Environment Setup |
| 8 | +```bash |
| 9 | +# Initialize all components with dev dependencies |
| 10 | +make init-dev |
| 11 | + |
| 12 | +# Initialize individual components |
| 13 | +cd backend && make init-dev |
| 14 | +cd frontend && make init-dev |
| 15 | +cd evaluation && make init-dev |
| 16 | +``` |
| 17 | + |
| 18 | +### Code Quality |
| 19 | +```bash |
| 20 | +# Format all code |
| 21 | +make format |
| 22 | + |
| 23 | +# Run all checks (linting, type checking, pre-commit) |
| 24 | +make check |
| 25 | + |
| 26 | +# Individual component checks |
| 27 | +cd backend && make check # mypy + ruff |
| 28 | +cd frontend && make check # mypy + ruff |
| 29 | +cd evaluation && make check # mypy + ruff |
| 30 | +``` |
| 31 | + |
| 32 | +### Backend Development |
| 33 | +```bash |
| 34 | +# Run the FastAPI server |
| 35 | +cd backend && python main.py |
| 36 | + |
| 37 | +# Run terminal chatbot |
| 38 | +cd backend && python chatbot.py |
| 39 | + |
| 40 | +# Build documentation dataset |
| 41 | +cd backend && python build_docs.py |
| 42 | +``` |
| 43 | + |
| 44 | +### Frontend Development |
| 45 | +```bash |
| 46 | +# Run Streamlit app |
| 47 | +cd frontend && streamlit run streamlit_app.py |
| 48 | +``` |
| 49 | + |
| 50 | +### Evaluation |
| 51 | +```bash |
| 52 | +# Run LLM evaluation tests |
| 53 | +cd evaluation && make llm-tests |
| 54 | +``` |
| 55 | + |
| 56 | +### Docker |
| 57 | +```bash |
| 58 | +# Start all services |
| 59 | +make docker-up |
| 60 | + |
| 61 | +# Stop all services |
| 62 | +make docker-down |
| 63 | +``` |
| 64 | + |
| 65 | +## Architecture |
| 66 | + |
| 67 | +This is a RAG-based conversational assistant for OpenROAD with three main components: |
| 68 | + |
| 69 | +### Backend (`backend/`) |
| 70 | +- **FastAPI server** with chat endpoints |
| 71 | +- **LangGraph-based routing** - Routes queries to specialized retrievers based on query classification |
| 72 | +- **Multiple retriever tools** for different content types: |
| 73 | + - General OR/ORFS information |
| 74 | + - OR tools and commands |
| 75 | + - Installation docs |
| 76 | + - Error messages |
| 77 | + - OpenSTA docs |
| 78 | + - Yosys docs |
| 79 | + - Klayout docs |
| 80 | +- **FAISS vector databases** for document retrieval |
| 81 | +- **Hybrid retrieval** combining semantic search, MMR, and BM25 |
| 82 | +- **Cross-encoder reranking** for improved relevance |
| 83 | + |
| 84 | +### Frontend (`frontend/`) |
| 85 | +- **Streamlit-based chat interface** |
| 86 | +- **User feedback collection** via Google Sheets API |
| 87 | +- **MongoDB integration** for data persistence |
| 88 | + |
| 89 | +### Evaluation (`evaluation/`) |
| 90 | +- **Automated LLM evaluation** using various metrics |
| 91 | +- **Human evaluation interface** for research |
| 92 | +- **Performance benchmarking** tools |
| 93 | + |
| 94 | +## Key Files |
| 95 | + |
| 96 | +- `backend/src/agents/retriever_graph.py` - Main LangGraph routing logic |
| 97 | +- `backend/src/chains/` - Individual retriever implementations |
| 98 | +- `backend/build_docs.py` - Documentation dataset builder |
| 99 | +- `backend/src/vectorstores/faiss.py` - Vector database implementation |
| 100 | +- `frontend/streamlit_app.py` - Main Streamlit interface |
| 101 | +- `evaluation/auto_evaluation/eval_main.py` - Automated evaluation runner |
| 102 | + |
| 103 | +## Development Guidelines |
| 104 | + |
| 105 | +- Use **Python 3.12** with virtual environments |
| 106 | +- Follow **ruff** formatting and linting standards |
| 107 | +- Run **mypy** for type checking |
| 108 | +- Use **pre-commit hooks** for code quality |
| 109 | +- Components are designed to be **independently deployable** |
| 110 | + |
| 111 | +## Dataset |
| 112 | + |
| 113 | +The RAG dataset is hosted on HuggingFace and contains: |
| 114 | +- OpenROAD documentation |
| 115 | +- OpenROAD-flow-scripts documentation |
| 116 | +- OpenSTA documentation |
| 117 | +- Yosys documentation |
| 118 | +- Klayout documentation |
| 119 | +- GitHub discussions and issues |
| 120 | + |
| 121 | +Download with: |
| 122 | +```bash |
| 123 | +huggingface-cli download The-OpenROAD-Project/ORAssistant_RAG_Dataset --repo-type dataset --local-dir data/ |
| 124 | +``` |
0 commit comments