Skip to content

Final prompt uses different query text on stream vs non-stream paths #3

Description

@flxhrdyn

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions