Replaced cref tags with plain names in the token count docs

This commit is contained in:
Thorsten Sommer 2026-09-23 17:53:51 +02:00
parent ae10bb4809
commit 39c93f6812
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
6 changed files with 22 additions and 12 deletions

View File

@ -63,13 +63,18 @@ public sealed class ContentText : IContent
/// exists. Null for every answer written before this was recorded, and at every provider which
/// reports nothing.
///
/// Two plain numbers rather than a <see cref="TokenUsage"/>: that type only ever comes out of
/// its own factory, which is what keeps an impossible usage from existing, and a stored field
/// has to be readable back by the serializer.
/// Two plain numbers rather than a TokenUsage: that type only ever comes out of its own
/// factory, which is what keeps an impossible usage from existing, and a stored field has to be
/// readable back by the serializer.
/// </remarks>
public int? ReportedPromptTokens { get; set; }
/// <inheritdoc cref="ReportedPromptTokens"/>
/// <summary>
/// What the provider said the answer itself cost, where it said anything.
/// </summary>
/// <remarks>
/// Stored, kept, and dropped together with ReportedPromptTokens, for the reasons given there.
/// </remarks>
public int? ReportedCompletionTokens { get; set; }
/// <summary>

View File

@ -61,15 +61,20 @@ public sealed record ConversationParts
/// Which of the texts above are the message being written right now.
/// </summary>
/// <remarks>
/// A marker, not a further part: everything named here also stands in <see cref="GrowingTexts"/>,
/// and counting the parts counts each of them exactly once. It exists because the two halves of
/// A marker, not a further part: everything named here also stands in GrowingTexts, and
/// counting the parts counts each of them exactly once. It exists because the two halves of
/// the number answer different questions. What the conversation has cost so far can be had
/// exactly, from the provider which charged for it; what is about to be added to it can only be
/// estimated. Told as one number, nobody can see which half they are looking at.
/// </remarks>
public IReadOnlyList<string> DraftTexts { get; init; } = [];
/// <inheritdoc cref="DraftTexts"/>
/// <summary>
/// Which of the documents above are attached to the message being written right now.
/// </summary>
/// <remarks>
/// A marker in the same way as DraftTexts: everything named here also stands in Documents.
/// </remarks>
public IReadOnlyList<FileAttachment> DraftDocuments { get; init; } = [];
/// <summary>

View File

@ -46,13 +46,13 @@ public readonly record struct ConversationTokens
public bool IsEstimate { get; init; }
/// <summary>
/// How much of <see cref="Tokens"/> is the message being written right now.
/// How much of Tokens is the message being written right now.
/// </summary>
/// <remarks>
/// Kept apart from the rest for the same reason the statements above are kept apart: what the
/// conversation has already cost is something a provider can be asked about, while a sentence
/// nobody has sent yet can only be estimated. What the conversation costs without it is this
/// subtracted from <see cref="Tokens"/>.
/// subtracted from Tokens.
/// </remarks>
public int DraftTokens { get; init; }

View File

@ -30,6 +30,6 @@ public interface IResponseStreamLine : IAnnotationStreamLine
/// <summary>
/// Gets what the provider said the request cost.
/// </summary>
/// <returns>The usage, or <see cref="TokenUsage.UNKNOWN"/> when the line carries none.</returns>
/// <returns>The usage, or TokenUsage.UNKNOWN when the line carries none.</returns>
public TokenUsage GetUsage() => TokenUsage.UNKNOWN;
}

View File

@ -7,7 +7,7 @@ namespace AIStudio.Provider.OpenAI;
/// <remarks>
/// Every number is optional because this is somebody else's JSON: the block arrives only when the
/// request asked for it, and the providers which follow the shape loosely leave fields out. Reading
/// it is one thing, believing it another -- <see cref="TokenUsage.OfReported"/> decides that.
/// it is one thing, believing it another -- TokenUsage.OfReported decides that.
/// </remarks>
public sealed record ChatCompletionUsage
{

View File

@ -73,7 +73,7 @@ public readonly record struct TokenUsage
/// </remarks>
/// <param name="promptTokens">What the request carried, as the provider stated it.</param>
/// <param name="completionTokens">What the answer cost, as the provider stated it.</param>
/// <returns>The usage, or <see cref="UNKNOWN"/>.</returns>
/// <returns>The usage, or UNKNOWN.</returns>
public static TokenUsage OfReported(int? promptTokens, int? completionTokens) =>
promptTokens is > 0
? Of(promptTokens.Value, completionTokens is > 0 ? completionTokens.Value : 0)