Struct UsageEvent
Event containing the usage metrics for the current operation and total conversation usage.
Can be used to update the UI after each message is sent/received.
Assembly: Glitch9.AIDevKit.dll
Syntax
public readonly struct UsageEvent : IEvent
Constructors
|
Edit this page
View Source
UsageEvent(Usage)
Declaration
public UsageEvent(Usage usage)
Parameters
| Type |
Name |
Description |
| Usage |
usage |
|
|
Edit this page
View Source
UsageEvent(Usage, Usage)
Declaration
public UsageEvent(Usage currentUsage, Usage totalUsage)
Parameters
| Type |
Name |
Description |
| Usage |
currentUsage |
|
| Usage |
totalUsage |
|
|
Edit this page
View Source
UsageEvent(string, Usage, Usage)
Declaration
public UsageEvent(string conversationId, Usage currentUsage, Usage totalUsage)
Parameters
Properties
|
Edit this page
View Source
ConversationId
Gets the ID of the conversation.
Declaration
public string ConversationId { get; }
Property Value
|
Edit this page
View Source
CurrentUsage
Gets the usage metrics for the current operation.
Declaration
public Usage CurrentUsage { get; }
Property Value
|
Edit this page
View Source
IsPartial
Indicates whether the usage data is partial (i.e., only current usage is available)
or complete (both current and total usage are available).
Declaration
public bool IsPartial { get; }
Property Value
|
Edit this page
View Source
TotalUsage
Gets the total usage metrics for the entire conversation.
Declaration
public Usage TotalUsage { get; }
Property Value
|
Edit this page
View Source
Value
Gets the current usage metrics for the most recent operation (e.g. token usage for the last message).
This is always available and can be used for real-time updates during streaming.
Declaration
public Usage Value { get; }
Property Value
Methods
|
Edit this page
View Source
FromPartial(UsageEvent, string, Usage)
Declaration
public static UsageEvent FromPartial(UsageEvent partialEvent, string conversationId, Usage totalUsage)
Parameters
Returns
Implements
Extension Methods