OpenTelemetryAiTelemetry
Namespace: Vercel.AI.OpenTelemetry
public sealed class OpenTelemetryAiTelemetry : IAiTelemetryIAiTelemetry that records spans on ActivitySource.
Inheritance: object
Implements: IAiTelemetry
Fields
Section titled “Fields”ActivitySource
Section titled “ActivitySource”public static readonly ActivitySource ActivitySourceSource used by String).
Value: ActivitySource
SourceName
Section titled “SourceName”public const string SourceName = "Vercel.AI"Activity source name. Add this source to a TracerProvider.
Value: string
Methods
Section titled “Methods”Begin(string, string)
Section titled “Begin(string, string)”public IDisposable Begin(string operation, string modelId)Starts a span. Dispose it when the call finishes.
Parameters
| Name | Type | Description |
|---|---|---|
operation |
string | |
modelId |
string |
Returns: IDisposable
OnFinish(IDisposable, FinishReason)
Section titled “OnFinish(IDisposable, FinishReason)”public void OnFinish(IDisposable span, FinishReason finishReason)Records the final finish reason on the span opened by String).
Parameters
| Name | Type | Description |
|---|---|---|
span |
IDisposable | |
finishReason |
FinishReason |
OnUsage(IDisposable, AudioUsage?)
Section titled “OnUsage(IDisposable, AudioUsage?)”public void OnUsage(IDisposable span, AudioUsage? usage)Records speech or transcription usage on the span opened by String).
Parameters
| Name | Type | Description |
|---|---|---|
span |
IDisposable | |
usage |
AudioUsage |
OnUsage(IDisposable, LanguageModelUsage)
Section titled “OnUsage(IDisposable, LanguageModelUsage)”public void OnUsage(IDisposable span, LanguageModelUsage usage)Records token usage on the span opened by String).
Parameters
| Name | Type | Description |
|---|---|---|
span |
IDisposable | |
usage |
LanguageModelUsage |
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product