Table of Contents

Property ContextWindow

Namespace
LMKit.Retrieval
Assembly
LM-Kit.NET.dll

ContextWindow

Gets or sets the number of neighboring partitions to include around each matched partition for contextual continuity.

public int ContextWindow { get; set; }

Property Value

int

A non-negative integer. Default is 0 (disabled).

Examples

using var chat = new PdfChat(chatModel, embeddingModel);

// Include 2 neighboring partitions around each match for more context
chat.ContextWindow = 2;

Remarks

When set to a positive value, each partition in the final retrieval results is expanded to include the specified number of preceding and following partitions from the same section. This provides the language model with surrounding text for better answer grounding.

See Also
Share