Skip to content

Sync /query path does not guard against empty retrieval #5

Description

@flxhrdyn

File: backend/app/rag_pipeline.py, _run_rag_pipeline_with_query (contrast with the guard at line 493 in the streaming path)

The synchronous /query path never checks whether retrieved_docs/reranked_docs is empty before formatting the prompt and calling the LLM. format_docs([]) yields an empty context string, and the prompt is still sent to the LLM, which may hallucinate an answer instead of returning the "not found" message the streaming endpoint explicitly returns for the same condition.

Failure scenario: The same question via /query vs /query/stream behaves inconsistently when nothing relevant is retrieved.

See docs/rag-audit-findings.md (item 5).

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