Enum TextExtraction.OverflowResolutionStrategy
- Namespace
- LMKit.Extraction
- Assembly
- LM-Kit.NET.dll
Specifies how the extraction handles content whose prompt plus anticipated completion tokens exceed the context window a single inference pass can hold.
[Obfuscation(Exclude = true)]
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum TextExtraction.OverflowResolutionStrategy
Fields
Reject = 0Refuse content that does not fit a single inference pass, raising NotEnoughContextSizeException with the required token count and the available context size. This is the default.
Segment = 1Split the content into overlapping context-sized windows, run one extraction pass per window in sequence, and fold the per-window answers into a single result: list fields hold the union of every window's items with duplicates removed, and single-value fields hold the first window that reported a value.
Examples
Example: opt in to windowed extraction for large content
using LMKit.Extraction;
using LMKit.Model;
LM model = LM.LoadFromModelID("lmkit-tasks:4b-preview");
var extraction = new TextExtraction(model)
{
OverflowStrategy = TextExtraction.OverflowResolutionStrategy.Segment
};
extraction.SetContent(veryLongDocument);
// One object, folded from every window: list fields hold the union of what each
// window found, and single-value fields hold the first window that reported one.
var result = await extraction.ParseAsync();
Console.WriteLine(result.Json);
Remarks
The default is Reject: oversize content raises NotEnoughContextSizeException rather than silently degrading the result. Extraction fills a caller-defined schema, so a partial answer is indistinguishable from a complete one once it is returned; refusing is the honest default.
Segment is the opt-in for callers who accept the cost: the content is split into overlapping windows that each fit the context, one pass runs per window, and the per-window answers are folded back into the single object the schema describes. It trades one inference pass per window for the ability to process content of any size.
Windows run one after another, never concurrently, so a large document cannot crowd out the rest of the workload.