|
| 1 | +# Fix Model Name Issue |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +StillMe is mentioning the incorrect embedding model name (`all-MiniLM-L6-v2`) instead of the correct one (`paraphrase-multilingual-MiniLM-L12-v2`). |
| 6 | + |
| 7 | +## Root Causes |
| 8 | + |
| 9 | +1. **Cached Responses**: LLM response cache contains old responses with incorrect model name |
| 10 | +2. **Foundational Knowledge**: Foundational knowledge in RAG database may have old model name |
| 11 | + |
| 12 | +## Solution |
| 13 | + |
| 14 | +### Step 1: Update Foundational Knowledge |
| 15 | + |
| 16 | +Run the script to update foundational knowledge in RAG database: |
| 17 | + |
| 18 | +```bash |
| 19 | +python scripts/update_foundational_knowledge_model_name.py |
| 20 | +``` |
| 21 | + |
| 22 | +This script will: |
| 23 | +- Search for foundational knowledge documents with old model name |
| 24 | +- Replace `all-MiniLM-L6-v2` with `paraphrase-multilingual-MiniLM-L12-v2` |
| 25 | +- Update documents in ChromaDB |
| 26 | + |
| 27 | +### Step 2: Clear LLM Cache |
| 28 | + |
| 29 | +Clear the LLM response cache to force regeneration: |
| 30 | + |
| 31 | +```bash |
| 32 | +python scripts/clear_llm_cache.py |
| 33 | +``` |
| 34 | + |
| 35 | +Or via API (if available): |
| 36 | + |
| 37 | +```bash |
| 38 | +curl -X POST http://localhost:8000/api/cache/clear |
| 39 | +``` |
| 40 | + |
| 41 | +### Step 3: Verify |
| 42 | + |
| 43 | +Test StillMe response to verify correct model name: |
| 44 | + |
| 45 | +1. Ask StillMe: "Bạn đang sử dụng mô hình embedding nào?" |
| 46 | +2. Response should mention: `paraphrase-multilingual-MiniLM-L12-v2` |
| 47 | +3. Should NOT mention: `all-MiniLM-L6-v2` |
| 48 | + |
| 49 | +## Prevention |
| 50 | + |
| 51 | +To prevent this issue in the future: |
| 52 | + |
| 53 | +1. **Single Source of Truth**: Use `stillme_core/rag/model_info.py` for model information |
| 54 | +2. **Update Foundational Knowledge**: When model changes, update foundational knowledge script |
| 55 | +3. **Clear Cache**: After updating foundational knowledge, clear cache to force regeneration |
| 56 | + |
| 57 | +## Related Files |
| 58 | + |
| 59 | +- `stillme_core/rag/model_info.py` - Single source of truth for model information |
| 60 | +- `scripts/add_foundational_knowledge.py` - Foundational knowledge template |
| 61 | +- `backend/identity/prompt_builder.py` - Prompt instructions with model name |
| 62 | + |
0 commit comments