Skip to content

GenAiConventions

Namespace: Vercel.AI.OpenTelemetry

public static class GenAiConventions

GenAI semantic-convention names shared by spans and the UI message protocol.

Inheritance: object

View source

public static string FormatFinishReason(FinishReason finishReason)

Protocol finish reason used by UI message finish chunks and gen_ai.response.finish_reasons.

Parameters

Name Type Description
finishReason FinishReason Normalized finish reason.

Returns: string

View source

public static string MapOperationName(string operationId)

Maps an AI SDK operation id such as ai.generateText to gen_ai.operation.name. An unrecognized id is returned unchanged, which keeps generateText and streamText.

Parameters

Name Type Description
operationId string Operation id passed to telemetry.

Returns: string

View source

public static string MapProviderName(string provider)

Maps a provider id such as openai.chat to the GenAI well-known provider name. An unrecognized id is returned unchanged.

Parameters

Name Type Description
provider string Provider id from the model.

Returns: string

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product