GenAiConventions
Namespace: Vercel.AI.OpenTelemetry
public static class GenAiConventionsGenAI semantic-convention names shared by spans and the UI message protocol.
Inheritance: object
Methods
Section titled “Methods”FormatFinishReason(FinishReason)
Section titled “FormatFinishReason(FinishReason)”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
MapOperationName(string)
Section titled “MapOperationName(string)”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
MapProviderName(string)
Section titled “MapProviderName(string)”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
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product