Table of Contents

Method Format

Namespace
Qavren.Edge.Rag
Assembly
Qavren.Edge.Rag.dll

Format(IReadOnlyList<RagSource>, RagOptions)

Numbers, clamps, orders and renders the block. Pure - the tier-1 golden-string target.

public static string Format(IReadOnlyList<RagSource> sources, RagOptions options)

Parameters

sources IReadOnlyList<RagSource>
options RagOptions

Returns

string

Remarks

The pipeline is Rank(IReadOnlyList<RagSource>), then a per-source clamp to RagOptions.MaxCharsPerSource with a visible TruncationSuffix, then Ordinal 1..n, then a drop from the tail until the rendered block fits RagOptions.MaxContextTokens as measured by RagOptions.TokenCounter (null uses a chars/4 estimate). Survivors keep the numbers they were given, so dropping the third of three leaves 1 and 2.

A source with no Title omits the Title: line; one with no Uri omits the Source: line; the --- separator is always present. An empty sources list renders the empty string rather than a heading with nothing under it - the caller short-circuits that turn.

Exceptions

EdgeRagException

RagContextBudgetTooSmall (7204) when the budget cannot hold even one clamped source.