mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-15 12:13:48 +00:00
Added the exact token count for the OpenAI Responses API
This commit is contained in:
10 files changed
+363
-12
No files matched your search
@@ -10,4 +10,15 @@ namespace AIStudio.Provider.OpenAI;
|
||||
/// </remarks>
|
||||
/// <param name="Type">The type of the stream event.</param>
|
||||
/// <param name="Response">The response as a non-streamed call would have returned it.</param>
|
||||
public sealed record ResponsesCompletedStreamLine(string Type, ResponsesResponse? Response);
|
||||
public sealed record ResponsesCompletedStreamLine(string Type, ResponsesResponse? Response)
|
||||
{
|
||||
/// <summary>
|
||||
/// States what the request of this call carried, as far as it can be believed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The one way from the wire to a usage, shared by the plain text path and the tool calling
|
||||
/// path, so that what counts as believable is decided in a single place.
|
||||
/// </remarks>
|
||||
/// <returns>The usage, or TokenUsage.UNKNOWN when the line states nothing usable.</returns>
|
||||
public TokenUsage GetUsage() => this.Response?.GetUsage() ?? TokenUsage.UNKNOWN;
|
||||
}
|
||||
Reference in new issue
Block a user