ux-research-agent-slackbot / docs /implementation_plan.md
debug-log
Claude Opus 4.6
feat: Insight Repository โ€” GitLab ์ดˆ๊ธฐํ™” + HF ์ž๋™ ๋ฐฐํฌ
501bc8c
|
Raw History Blame Contribute Delete
2.39 kB
# Search Quality & Context Improvement Plan
## Goal
Improve the Slackbot's ability to:
1. **Find relevant documents** even with inexact keywords (typos, spacing).
2. **Maintain context** across multi-turn conversations (follow-up questions).
## User Review Required
- **Fuzzy Matching Dependency**: Will add `thefuzz` (and `python-Levenshtein` for speed) to `requirements.txt`.
- **Context Logic**: We will modify the `keyword_extraction_prompt` significantly to explicitly ask for "Context" or "Inherited Keywords".
## Proposed Changes
### 1. Improve Search Quality (Fuzzy Search)
**Files**: `requirements.txt`, `search_engine.py`
- **Install `thefuzz`**: Use Levenshtein distance for metadata matching instead of strict `if keyword in text`.
- **Exact Match Boost**: Give higher priority or explicit inclusion to exact ID/Title matches if the user mentions them.
- **Code Change**:
- Update `filter_internal_data` and `filter_baymard_data`.
- Use `fuzz.partial_ratio` or `fuzz.token_set_ratio` to check match score. Threshold > 70-80.
### 2. Enhance Context Awareness
**Files**: `search_engine.py`
- **Prompt Engineering**: Update `keyword_extraction_prompt`.
- New Instuction: "If the User Query is a follow-up (e.g., 'tell me more about that', 'what about the first one'), EXTRACT keywords from the *previous Assistant response* in Chat History."
- Explicitly ask for `primary_topic` from history.
- **Search Logic Update**:
- If the extracted keywords imply a *specific* item (e.g., "RES-001" or a specific title found in history), force a direct ID lookup or high-priority search for that item.
### 3. Verification Plan
- **Test Case 1 (Search)**: Query "์—˜๋ฆฌํŠธ๋ฉค๋ฒ„์‹ญ" (no space) or "์—˜๋ฆฌํŠธ ๋งด๋ฒ„์‹ญ" (typo) -> Should find "์—˜๋ฆฌํŠธ ๋ฉค๋ฒ„์‹ญ...".
- **Test Case 2 (Context)**:
- User: "Search for Membership"
- Bot: "Here is [Elite Membership Survey]..."
- User: "Tell me more about the low satisfaction group"
- **Result**: Bot should know "Elite Membership Survey" is the context and answer using its content.
## Detailed Tasks
1. [ ] Update `requirements.txt` with `thefuzz`.
2. [ ] Modify `search_engine.py`:
- Import `thefuzz`.
- Refactor `filter_...` functions to use fuzzy matching.
- Update `keyword_extraction_prompt` to handle history better.
3. [ ] Deploy & Verify.