EmbeddingUsageRecorded

org.llm4s.trace.TraceEvent.EmbeddingUsageRecorded
See theEmbeddingUsageRecorded companion object
final case class EmbeddingUsageRecorded extends TraceEvent

Tracks embedding token usage for cost analysis. An org.llm4s.llmconnect.EmbeddingClient emits one per call, which a backend that follows the OpenTelemetry GenAI conventions reports as the call's embeddings <model> span (#2275).

Value parameters

duration

how long the call took; the event's timestamp is its end

inputCount

Number of texts embedded in this operation

model

Embedding model name (e.g., "text-embedding-3-small")

operation

Type of operation: "indexing", "query", "evaluation"

provider

the canonical id of the provider called (openai, voyage, ...), when known

usage

Token usage statistics from embedding operation

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait TraceEvent
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def eventType: String
def toJson: Value
def withDuration(duration: FiniteDuration): EmbeddingUsageRecorded
def withDuration(duration: Option[FiniteDuration]): EmbeddingUsageRecorded
def withInputCount(inputCount: Int): EmbeddingUsageRecorded
def withModel(model: String): EmbeddingUsageRecorded
def withOperation(operation: String): EmbeddingUsageRecorded
def withTimestamp(timestamp: Instant): EmbeddingUsageRecorded

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def span: Option[TraceSpan]

Where this event sits in a trace, when its emitter places it in one (design 4.58): the span it is, that span's parent and when it started; the event's timestamp is its end. None for an event traced on its own. Only TraceEvent.CustomEvent, TraceEvent.TokenUsageRecorded, TraceEvent.ErrorOccurred and TraceEvent.AgentRunEnded carry one.

Where this event sits in a trace, when its emitter places it in one (design 4.58): the span it is, that span's parent and when it started; the event's timestamp is its end. None for an event traced on its own. Only TraceEvent.CustomEvent, TraceEvent.TokenUsageRecorded, TraceEvent.ErrorOccurred and TraceEvent.AgentRunEnded carry one.

Attributes

Inherited from:
TraceEvent