A workspace that holds notes about several projects can hand the chat model a passage about the wrong project along with the right one. AnythingLLM sets how strictly that document search matches for each workspace, and a higher Document similarity threshold on its Vector Database settings keeps unrelated passages out of the reply and its Sources list.
Every passage the search returns carries a match score, and the default Low threshold accepts anything from 25% upward until the Max Context Snippets limit of four is reached. A passage about something else entirely can clear that bar with a weak score, and a small model may then repeat its facts as the answer. Medium and High raise the bar to 50% and 75%, while a bar set above the intended document's own score removes the right passage too.
The threshold belongs to a single workspace and takes effect for all of its users from the next message, with no re-embedding. Testing it needs a workspace that already answers from embedded documents through a working chat model, such as an Ollama model on an AnythingLLM Docker installation, and a question that only one of those documents should answer.
Steps to tune RAG settings in AnythingLLM:
- Open the settings of Project Notes with the gear icon beside its name in the sidebar.
Project Notes is the example workspace. Its embedded documents cedar-lantern-dispatch.txt and harbor-orchid-maintenance.txt describe two unrelated projects.
- Switch to the Chat Settings tab.

- Select Chat under Chat mode.
Chat mode runs the document search for every message, so each reply reflects the current retrieval settings. In the default Agent mode, a model with native tool calling decides for itself whether to search, and its reply can skip the documents entirely. A workspace already in Query mode can stay there, because Query runs the same search. The selection saves when clicked and applies to every user of the workspace.
- Start a new thread with + New Thread beneath the workspace name.
Earlier replies in a thread can feed the passages they cited back into the model's context, so a new thread limits the test answer to what the current search returns.
- Ask a question that only one of the workspace's documents can answer.
What is the approved label and the weekday for Cedar Lantern?
- Open the Sources list beneath the reply.

- Click the unrelated harbor-orchid-maintenance.txt entry in the Sources panel.
The reply about Cedar Lantern lists the Harbor Orchid maintenance note as a second source, although none of its text answers the question.
- Check the % match score beneath the passage.
The Harbor Orchid passage scores 27% match, just above the 25% minimum of the default Low threshold. The Medium level requires 50%, so a passage like this one stops reaching the model.
- Close the passage with the X in its upper-right corner.

- Open the workspace settings again with the gear icon beside Project Notes.

- Switch to the Vector Database tab.

- Select Medium (similarity score ≥ .50) under Document similarity threshold.
The threshold saves as soon as it is selected and applies from the next message for every user of the workspace. Do not click Reset Vector Database, which deletes the workspace's embeddings rather than changing how they are searched.
Max Context Snippets caps how many passages reach the model per message, and a number above the default four helps answers spread across many parts of a long document at the cost of context room. Search Preference is offered only with the built-in LanceDB vector database, where Accuracy Optimized re-ranks the search results with a second model that downloads on first use and adds ranking time to every reply. Pin to workspace, beside an embedded file in the workspace's document list, skips the search for that file and sends its whole text with every prompt, which suits only short documents that fit within the chat model's context window.
- Start another new thread with + New Thread beneath the workspace name.

- Ask the same question in the new thread.

- Open the Sources list beneath the new reply.

- Confirm that the Sources panel lists only cedar-lantern-dispatch.txt for a reply that gives the amber triangle label and Tuesday.
The wording of the reply can vary, but the unrelated passage no longer reaches the model. When the intended document disappears from the list as well, its passages also scored below 50%, and the threshold belongs back at Low.