Skip to main content

Metrics

Namespace: Wisej.AI

Assembly: Wisej.AI

Represents a collection of metrics related to token usage and call counts.

public class Metrics

This class is used to track and manipulate metrics such as input tokens, output tokens, and the number of calls.

Constructors

Metrics()

Initializes a new instance of the Metrics class.

Properties

CallCount

Int32: Gets the number of calls.

InputTokens

Int32: Gets the number of input tokens.

OutputTokens

Int32: Gets the number of output tokens.

Methods

Add(inputTokens, outputTokens, callCount)

Adds the specified number of input tokens, output tokens, and call count to the current metrics.

ParameterTypeDescription
inputTokensInt32The number of input tokens to add.
outputTokensInt32The number of output tokens to add.
callCount Int32The number of calls to add. Default is 1.

Returns: Metrics. The updated Metrics instance.

Add(usage)

Adds the metrics from another Metrics instance to the current metrics.

ParameterTypeDescription
usageMetricsThe Metrics instance whose values are to be added.

Returns: Metrics. The updated Metrics instance.

This method updates the current metrics by adding the values from another Metrics instance.

Reset()

Resets the input tokens, output tokens, and call count to 0.

Returns: Metrics. The updated Metrics instance.

Subtract(usage)

Subtracts the metrics from another Metrics instance from the current metrics.

ParameterTypeDescription
usageMetricsThe Metrics instance whose values are to be subtracted.

Returns: Metrics. The updated Metrics instance.

This method updates the current metrics by subtracting the values from another Metrics instance.