mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-06 05:09:40 +00:00
Replaced cref tags with plain names in the token count docs
This commit is contained in:
6 files changed
+22
-12
No files matched your search
@@ -63,13 +63,18 @@ public sealed class ContentText : IContent
|
|||||||
/// exists. Null for every answer written before this was recorded, and at every provider which
|
/// exists. Null for every answer written before this was recorded, and at every provider which
|
||||||
/// reports nothing.
|
/// reports nothing.
|
||||||
///
|
///
|
||||||
/// Two plain numbers rather than a <see cref="TokenUsage"/>: that type only ever comes out of
|
/// Two plain numbers rather than a TokenUsage: that type only ever comes out of its own
|
||||||
/// its own factory, which is what keeps an impossible usage from existing, and a stored field
|
/// factory, which is what keeps an impossible usage from existing, and a stored field has to be
|
||||||
/// has to be readable back by the serializer.
|
/// readable back by the serializer.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int? ReportedPromptTokens { get; set; }
|
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; }
|
public int? ReportedCompletionTokens { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -61,15 +61,20 @@ public sealed record ConversationParts
|
|||||||
/// Which of the texts above are the message being written right now.
|
/// Which of the texts above are the message being written right now.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// A marker, not a further part: everything named here also stands in <see cref="GrowingTexts"/>,
|
/// A marker, not a further part: everything named here also stands in GrowingTexts, and
|
||||||
/// and counting the parts counts each of them exactly once. It exists because the two halves of
|
/// 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
|
/// 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
|
/// 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.
|
/// estimated. Told as one number, nobody can see which half they are looking at.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public IReadOnlyList<string> DraftTexts { get; init; } = [];
|
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; } = [];
|
public IReadOnlyList<FileAttachment> DraftDocuments { get; init; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -46,13 +46,13 @@ public readonly record struct ConversationTokens
|
|||||||
public bool IsEstimate { get; init; }
|
public bool IsEstimate { get; init; }
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Kept apart from the rest for the same reason the statements above are kept apart: what the
|
/// 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
|
/// 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
|
/// 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>
|
/// </remarks>
|
||||||
public int DraftTokens { get; init; }
|
public int DraftTokens { get; init; }
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,6 @@ public interface IResponseStreamLine : IAnnotationStreamLine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets what the provider said the request cost.
|
/// Gets what the provider said the request cost.
|
||||||
/// </summary>
|
/// </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;
|
public TokenUsage GetUsage() => TokenUsage.UNKNOWN;
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace AIStudio.Provider.OpenAI;
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Every number is optional because this is somebody else's JSON: the block arrives only when the
|
/// 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
|
/// 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>
|
/// </remarks>
|
||||||
public sealed record ChatCompletionUsage
|
public sealed record ChatCompletionUsage
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public readonly record struct TokenUsage
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="promptTokens">What the request carried, as the provider stated it.</param>
|
/// <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>
|
/// <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) =>
|
public static TokenUsage OfReported(int? promptTokens, int? completionTokens) =>
|
||||||
promptTokens is > 0
|
promptTokens is > 0
|
||||||
? Of(promptTokens.Value, completionTokens is > 0 ? completionTokens.Value : 0)
|
? Of(promptTokens.Value, completionTokens is > 0 ? completionTokens.Value : 0)
|
||||||
|
|||||||
Reference in new issue
Block a user