File: backend/app/rag_pipeline.py:323 vs backend/app/rag_pipeline.py:509
The non-streaming path builds the final answer prompt with question=original_question, but the streaming path (rag_pipeline_stream_async) uses question=standalone_query (the rewritten query) instead.
QUERY_REWRITE_PROMPT has no language-preservation instruction, so the LLM can rewrite the question into a different language or reword it, while RAG_PROMPT explicitly instructs to use the same language as the question.
Failure scenario: In /query/stream, an Indonesian question gets rewritten to English, and the answer comes back in the wrong language or loses conversational framing. Does not happen on /query.
See docs/rag-audit-findings.md (item 3).
File:
backend/app/rag_pipeline.py:323vsbackend/app/rag_pipeline.py:509The non-streaming path builds the final answer prompt with
question=original_question, but the streaming path (rag_pipeline_stream_async) usesquestion=standalone_query(the rewritten query) instead.QUERY_REWRITE_PROMPThas no language-preservation instruction, so the LLM can rewrite the question into a different language or reword it, whileRAG_PROMPTexplicitly instructs to use the same language as the question.Failure scenario: In
/query/stream, an Indonesian question gets rewritten to English, and the answer comes back in the wrong language or loses conversational framing. Does not happen on/query.See
docs/rag-audit-findings.md(item 3).