﻿# LibreChat file queries: inspect the selected passages before changing the model

Inspect LibreChat file_search queries and selected passages before changing the answer model, and distinguish retrieval selection from citation-display controls.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-librechat-generated-file-query/
Language: en

## Start with a known missing fact

A user knows that a deployment exception appears in a policy attachment, but the agent gives only the general rule. Identify the exact clause and file before changing the answering model. The failure may occur in indexing, query generation, passage selection, or explanation. Each stage needs a different observation and a different corrective action.

## Inspect the generated file query

The [Chat with Files guide](https://www.librechat.ai/docs/features/rag_api) says the model writes a search query when calling `file_search`. Preserve that query with the question. If it omits the product suffix or qualifying condition, a relevant page can be missed even though the file is available. Compare the literal information need with what retrieval actually requested.

## Understand passage selection

The current guide describes selecting 5 close chunks per attached file and keeping 10 overall. Treat these as documented behavior to check against the installed version, rather than a permanent guarantee for every deployment. Several documents can compete for the final passage set, so attaching another similar policy can change which exception reaches the model.

For a clause crossing a section boundary, inspect the returned text itself. Increasing the requested answer length cannot recover an exception that retrieval never supplied. Conversely, if the complete condition was present, investigate how the model interpreted it instead of immediately rebuilding the index.

## Separate indexing from citations

The [RAG configuration guide](https://www.librechat.ai/docs/configuration/rag_api) describes the independent indexing and retrieval service. The [agent reference](https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/agents) separately defines `maxCitations`, `maxCitationsPerFile`, and `minRelevanceScore`. These response-source controls should not be treated as interchangeable with the retrieval candidate pool. Record the effective settings before explaining a source's absence.

## Run a staged comparison

Use a direct question about the known clause, then the original broader question. Keep files and settings fixed. Check whether the generated query, selected passages, and final explanation differ. This local diagnostic distinguishes finding the evidence from using it correctly, without claiming a provider benchmark or a universal best model.

The existing guides to [structural chunk boundaries](/journal/rag-chunking-structure-token-boundaries/) and [retrieval judgments](/journal/beir-qrels-unjudged-retrieval-evaluation/) help organize the comparison. Preserve a short record of the missing clause and the first stage where it disappears, making the eventual fix reviewable and targeted.
