CollectingReasoningModelDiagnosticSink
Models & Types · AiDotNet.Agentic.Models.Connectors
An in-memory IReasoningModelDiagnosticSink that keeps the most recent adjustments.
Implements: IReasoningModelDiagnosticSink
For Beginners
Hand one of these to a reasoning-aware chat client and it collects the notices about
settings that had to be changed. Afterwards, GetSummary tells you each distinct change and how
many times it happened — usually one line saying “temperature was dropped, 400 times”, which is exactly what you
want to know.
How It Works
A long evolution run makes the same handful of adjustments on every single request, so an unbounded list would grow without adding information. This sink keeps a bounded ring of the most recent records for reading back in order, and separately keeps one representative record and a count for each distinct adjustment, so a run of a million calls still summarises to a few lines. Both views are safe to read while requests are in flight.
Use it in tests to assert exactly which settings a profile removed, and in short production runs to print a
summary at the end. For a long-lived service, forward to the host’s own logging instead by implementing
IReasoningModelDiagnosticSink directly.
Constructors
| Constructor | Summary |
|---|---|
CollectingReasoningModelDiagnosticSink(int capacity) |
Initializes a collecting sink. |
Properties
| Property | Summary |
|---|---|
long TotalReported { get; } |
Gets how many adjustments have been reported since construction. |
Methods
| Method | Summary |
|---|---|
IReadOnlyDictionary<string, ReasoningModelDiagnosticSummary> GetSummary() |
Gets one representative record per distinct adjustment, with how often it occurred. |
IReadOnlyList<ReasoningModelDiagnostic> GetRecent() |
Gets the most recent adjustments, oldest first. |
void Clear() |
Discards every retained record and resets the counts. |
void Report(ReasoningModelDiagnostic diagnostic) |
Fields
| Field | Summary |
|---|---|
int DefaultCapacity |
The number of recent records retained when no capacity is supplied. |