mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-05 01:29:40 +00:00
Read the reported token usage in one place
This commit is contained in:
7 files changed
+23
-31
No files matched your search
@@ -30,10 +30,7 @@ public readonly record struct ResponseStreamLine(string Id, string Object, uint
|
||||
public ChatCompletionUsage? Usage { get; init; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ContainsUsage() => this.GetUsage().IsKnown;
|
||||
|
||||
/// <inheritdoc />
|
||||
public TokenUsage GetUsage() => this.Usage is null ? TokenUsage.UNKNOWN : TokenUsage.OfReported(this.Usage.PromptTokens, this.Usage.CompletionTokens);
|
||||
public TokenUsage GetUsage() => this.Usage?.ToTokenUsage() ?? TokenUsage.UNKNOWN;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ContainsSources() => this != default && this.SearchResults.Count > 0;
|
||||
|
||||
Reference in new issue
Block a user