5 ms·
Learnings from codeQA – A chat-with-codebase application using top-K RAG
- dejavucoder 2y agoBlog post noting down my learnings and references used to make my side project - codeQA. codeQA is a question-answering system for codebases that uses semantic code search with embeddings. It indexes codebases by chunking them into methods and classes using abstract syntax trees (AST), generating LLM-based comments for the chunks, and embedding them. The system then uses techniques like hypothetical document embeddings (HyDE), BM25 keyword search, and cross-encoder based reranking to improve the retrieval of relevant code snippets in response to natural language queries about the codebase. I use tree-sitter (Part 1) for extracting the abstract syntax tree and building the codebase index. Elaborate discussion on cross-encoder vs bi-encoder I use LanceDB for vectorDB, cohere rank v3 for re-ranking and various LLMs to generate LLM comments, summary and chat.