Skip to main content

File Preview in the Model’s Context Window

As much text of the document as possible is sent to the model as a preview. For small files, this can be the entire document. In chats and Agents with up to 20 total documents, direct files are previewed in context. With more than 20 documents, an Agent retrieves documents through document search instead, while spreadsheets remain attached. Image files are passed to the model as visual content instead of text, so it can analyze them directly. For files in Knowledge bases and synced agent folders, the model can use an embedding search. During upload, the file is first split into smaller sections (chunks). Each section is then converted into an embedding, a numerical representation that captures the meaning of the content. When a question is asked, the system finds the sections whose content best matches the question. This doesn’t search for specific words, but for sections with similar meaning.
Example: If the embedding search is looking for “bread,” it will also find sections about “baguette,” even if the word “bread” doesn’t appear.
Only these relevant parts are sent to the model in context. This enables working with very large documents that exceed the model’s context window.

Our Parameters

Embedding Dimension

The vector dimension is 1536.

Chunk Size

Documents are split into sections of 2,000 characters.

Retrieval Parameter (k-value)

Up to 50 chunks are retrieved per query.

FAQ

Small direct attachments are included in the model context in full whenever possible. Agents preview direct files when they have up to 20 total documents. With more than 20 documents, the Agent uses document search instead, except for spreadsheets.
Langdock uses semantic search for files in Knowledge bases, synced agent folders, and direct Agent documents when the Agent has more than 20 documents in total. The content is split into searchable chunks, and the most relevant chunks are retrieved for the user’s question. This helps with large document sets, but it also means the model may not see every document or every sentence for every answer.
The answer depends on what was retrieved for the specific query. Content can be missed if the question is broad, the relevant wording differs from the user’s phrasing, the file was not processed, permissions block access, or too many sources compete for retrieval. Narrower questions and clearer references to files, topics, or sections usually improve results.
Retrieved knowledge is added to the model’s context for the current request. More knowledge sources, larger retrieved chunks, long chat history, agent instructions, and tool results all compete for the same context window.