Performance: Question reformulation with history
MEDIUM IMPACT
This concept affects the speed and responsiveness of conversational AI by managing how previous user inputs are reused and reformulated for new queries.
def reformulate_question(history, new_question, max_history=3): recent_context = ' '.join(history[-max_history:]) return f"{recent_context} {new_question}"
def reformulate_question(history, new_question): full_context = '' for turn in history: full_context += turn + ' ' full_context += new_question return full_context
| Pattern | Context Size | Processing Time | Memory Use | Verdict |
|---|---|---|---|---|
| Full history concatenation | Large (all turns) | High (linear growth) | High (linear growth) | [X] Bad |
| Limited recent history | Small (last 3 turns) | Low (constant) | Low (constant) | [OK] Good |