How minhcspro/chatbot-for-tax-and-law-llm works
Project type and purpose
• From the file tree and README, this is a collection of Jupyter notebooks that implement a Retrieval-Augmented Generation (RAG) pipeline for tax and law documents.
• Key steps: • scrape_thue_baohiem.ipynb – scrape insurance/tax regulations • llama_indexing.ipynb – build a vector index over scraped text • test_llama_index.ipynb – query the index + LLM to answer questions
File structure
• No traditional “src/” or “frontend/” folders: everything lives in notebooks.
• Each notebook corresponds to a logical stage in the data pipeline: ingestion, indexing, query/testing.
• Configuration (e.g. API keys, model settings) will be embedded in notebooks or environment variables.
README insights
• README only contains an image reference, which likely depicts the high-level RAG flow.
a. Main components
1. Web Scraper: scrapes tax/law documents (scrape_thue_baohiem.ipynb)
2. Data Store: raw HTML/text storage (could be local files or a simple DB)
3. Preprocessing & Embedding: text cleaning, chunking, embedding via LLM API (llama_indexing.ipynb)
4. Vector Index: stores embeddings (e.g., FAISS, Weaviate, Chroma)
5. Retrieval API: given a user query, retrieve top-k relevant chunks
6. LLM Engine: prompts the language model with retrieved context to generate answers
7. Client Interface / Tester: Jupyter notebook or simple CLI that submits queries (test_llama_index.ipynb)
b. Relationships and interactions
• Scraper → Data Store (writes raw text)
• Data Store → Preprocessor → Embedding → Vector Index (build phase)
• Client Interface → Retrieval API → Vector Index (reads) → LLM Engine → Client Interface (response)
c. Architectural patterns & design principles
• Pipeline stages: clear separation of ingestion, processing, indexing, and serving
• Modular: each notebook/ component can be replaced or extended (e.g., swap in a different vector DB)
• RAG pattern: decouple retrieval (vector similarity) from generation (LLM), ensuring only relevant context is sent to the model
d. Key technologies & libraries
• Python & Jupyter for orchestration
• Requests/BeautifulSoup (or similar) in the scraper
• LangChain or llama-index for embeddings & index abstraction
• FAISS/Chroma/Weaviate for vector index
• OpenAI / Anthropic / local LLM for embeddings & generation