--- title: CGT-LLM-Beta RAG Chatbot emoji: 🧬 colorFrom: blue colorTo: purple sdk: gradio sdk_version: 4.44.1 app_file: app.py pinned: false license: mit --- # CGT-LLM-Beta: Genetic Counseling RAG Chatbot A Retrieval-Augmented Generation (RAG) chatbot for genetic counseling and cascade genetic testing questions. ## Features - **Evidence-based answers** from medical literature - **Multiple education levels**: Middle School, High School, College, and Doctoral - **Source document citations** with full chunk text - **Similarity scoring** for transparency - **Flesch-Kincaid readability scores** for all answers - **Multiple LLM models** to choose from - **100+ example questions** for testing ## How to Use 1. **Select a model** from the dropdown (default: Llama-3.2-3B-Instruct) 2. **Choose your education level** for personalized answers 3. **Enter your question** or select from example questions 4. **View the answer** with readability score, sources, and similarity scores ## Education Levels - **Middle School**: Simplified version for ages 12-14 - **High School**: Simplified version for ages 15-18 - **College**: Professional version for undergraduate level - **Doctoral**: Advanced version for medical professionals ## Models Available - Llama-3.2-3B-Instruct - Mistral-7B-Instruct-v0.2 - Llama-4-Scout-17B-16E-Instruct - MediPhi-Instruct - MediPhi - Phi-4-reasoning ## Setup Instructions ### Required: Add HF_TOKEN Secret This Space uses the Hugging Face Inference API to generate answers. You **must** add your Hugging Face token as a secret: 1. **Get your Hugging Face token:** - Go to: https://huggingface.co/settings/tokens - Create a new token with "Read" permissions - Copy the token 2. **Add token to Space:** - Go to your Space settings: https://huggingface.co/spaces/alrahrooh/cgt-llm-chatbot-v2/settings - Click on "Variables and secrets" tab - Add a new secret: - **Name:** `HF_TOKEN` - **Value:** Your Hugging Face token - Click "Add secret" - Restart the Space (it will restart automatically) 3. **Verify it's working:** - Check the Space logs - you should see "Using Hugging Face Inference API" - Try asking a question in the interface **Note:** Some models (like Llama) are gated and require you to: - Request access at the model's page on Hugging Face - Accept the model's license - Use a token that has access to the model ## Important Notes ⚠️ **This chatbot provides informational answers based on medical literature. It is not a substitute for professional medical advice, diagnosis, or treatment. Always consult with qualified healthcare providers for medical decisions.** ## Technical Details - **Vector Database**: ChromaDB with sentence-transformers embeddings - **RAG System**: Retrieval-Augmented Generation with semantic search - **Source Attribution**: Full document tracking with chunk-level citations