Search Results for

    Show / Hide Table of Contents

    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.

    Implements
    IEvent
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Glitch9.AIDevKit
    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
    Type Name Description
    string conversationId
    Usage currentUsage
    Usage totalUsage

    Properties

    | Edit this page View Source

    ConversationId

    Gets the ID of the conversation.

    Declaration
    public string ConversationId { get; }
    Property Value
    Type Description
    string
    | Edit this page View Source

    CurrentUsage

    Gets the usage metrics for the current operation.

    Declaration
    public Usage CurrentUsage { get; }
    Property Value
    Type Description
    Usage
    | 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
    Type Description
    bool
    | Edit this page View Source

    TotalUsage

    Gets the total usage metrics for the entire conversation.

    Declaration
    public Usage TotalUsage { get; }
    Property Value
    Type Description
    Usage
    | 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
    Type Description
    Usage

    Methods

    | Edit this page View Source

    FromPartial(UsageEvent, string, Usage)

    Declaration
    public static UsageEvent FromPartial(UsageEvent partialEvent, string conversationId, Usage totalUsage)
    Parameters
    Type Name Description
    UsageEvent partialEvent
    string conversationId
    Usage totalUsage
    Returns
    Type Description
    UsageEvent

    Implements

    IEvent

    Extension Methods

    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetHashCodeOrDefault<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation