How tuanduy35399/chat_service_nckh works
Mai Vang Chat Service is a Vietnamese plant-disease assistant: users submit a question (optionally with conversation history or image-detection results), the API prepares the request, and retrieval-augmented generation returns an answer. The main knowledge workflow loads Markdown files, chunks and embeds them into a persistent Chroma store; chat retrieves context and calls Google Gemini. A separate indexing script in rag_indexing describes another Markdown-to-Chroma approach, but its excerpt contains an undefined splitter, so its runtime status is uncertain. Links below are limited to documented or excerpted relationships.
Main entry points: rag.py RAG answering · ingest.py Text chunking · chunking.py Alternate indexer · main.py Image enrichment
Components 15
Chat service
- Chat API
google_model/main.py - Image enrichment
google_model/main.py
Knowledge retrieval
- RAG answering
google_model/rag.py - Top-3 retriever
google_model/rag.py - Chroma store
google_model/vector_db
Knowledge indexing
- Markdown knowledge
data - Document loading
google_model/ingest.py - Text chunking
google_model/ingest.py - Google embeddings
google_model/ingest.py - Alternate indexer
rag_indexing/chunking.py - Sentence embeddings
rag_indexing/chunking.py - Chroma collection
rag_indexing/chunking.py
Other components
- User
- YOLO detections
- Gemini chat model
Connections 15
- User → Chat API: submits question
google_model/main.py - User → Image enrichment: provides request
google_model/main.py - YOLO detections → Image enrichment: supplies results
google_model/main.py - Image enrichment → RAG answering: calls ask
google_model/main.py - Chat API → RAG answering: calls ask
google_model/main.py - RAG answering → Top-3 retriever: invokes retrieval
google_model/rag.py - Top-3 retriever → Chroma store: retrieves documents
google_model/rag.py - RAG answering → Gemini chat model: invokes model
google_model/rag.py - Markdown knowledge → Document loading: loads files
google_model/ingest.py - Document loading → Text chunking: splits documents
google_model/ingest.py - Text chunking → Google embeddings: embeds chunks
google_model/ingest.py - Text chunking → Chroma store: indexes chunks
google_model/ingest.py - Markdown knowledge → Alternate indexer: reads Markdown
rag_indexing/chunking.py - Alternate indexer → Sentence embeddings: encodes chunks
rag_indexing/chunking.py - Alternate indexer → Chroma collection: adds chunks
rag_indexing/chunking.py