UsageAccounting

org.llm4s.agent.graph.middleware.UsageAccounting
@Experimental

What counts the model calls a hook, an admission stage or a guardrail makes itself, so that they are in the thread's usage: a hook's ModelContext, and an admission stage's AdmissionContext (#2854). A guardrail that calls a model is given one (Guardrail.validateIn(value, context)) and calls through accounted, whichever stage runs it.

Attributes

Source
ModelContext.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def accounted(client: LLMClient): LLMClient

client, with the usage of every completion through it counted in the thread's usage.

client, with the usage of every completion through it counted in the thread's usage.

Attributes

Source
ModelContext.scala
def recordUsage(model: ModelName, usage: TokenUsage, estimatedCost: Option[BigDecimal]): Unit

Records usage that arrived without a client call, as one request to model.

Records usage that arrived without a client call, as one request to model.

Attributes

Source
ModelContext.scala