How starom00n/tharmya works
TharmYa AI is a Thai OTC-medicine guidance assistant. A user enters symptoms through the elder-friendly web UI; safety checks can short-circuit emergencies or unsuitable requests, while passed requests combine patient details with relevant drug information before a configurable LLM streams a reply. The repository also documents a standalone validation and regression-reporting capability. The validation branch is included as a product capability; tests and delivery tooling are not. Some internal call details are unsampled, so those links rely on README workflow documentation.
Main entry points: app.py Chat handler · rag_engine.py RAG retrieval · validation.py Validation runner · prompt_engine.py Safety pre-check
Components 16
Web experience
- Gradio UI
app.py - Chat handler
app.py - Streamed guidance
app.py
Guidance workflow
- Safety pre-check
prompt_engine.py - Patient context
prompt_engine.py - Prompt assembly
prompt_engine.py - LLM provider
app.py
Drug knowledge
- RAG retrieval
rag_engine.py - TF-IDF index
rag_engine.py - Interaction checker
rag_engine.py - OTC drug database
thai_otc_drugs.json
Validation
- Validation runner
validation.py - Safety and accuracy evaluation
validation.py - Regression reports
validation.py
Other components
- Person
- AI services
Connections 18
- Person → Gradio UI: enters symptoms
README.md - Gradio UI → Chat handler: submits chat
README.md - Chat handler → Safety pre-check: checks request
README.md - Chat handler → Patient context: builds context
README.md - Chat handler → RAG retrieval: retrieves drugs
app.py - RAG retrieval → TF-IDF index: searches index
rag_engine.py - TF-IDF index → OTC drug database: indexes records
rag_engine.py - RAG retrieval → Interaction checker: checks interactions
rag_engine.py - RAG retrieval → OTC drug database: loads records
rag_engine.py - Chat handler → Prompt assembly: builds prompt
README.md - Chat handler → LLM provider: streams request
README.md - LLM provider → AI services: calls provider
README.md - LLM provider → Streamed guidance: yields tokens
app.py - Streamed guidance → Gradio UI: renders reply
README.md - Validation runner → Safety pre-check: checks cases
validation.py - Validation runner → RAG retrieval: retrieves context
validation.py - Validation runner → Safety and accuracy evaluation: evaluates replies
README.md - Safety and accuracy evaluation → Regression reports: records regression
README.md