Module: OpenTelemetry::SemConv::Incubating::GEN_AI

Defined in:
lib/opentelemetry/semconv/incubating/gen_ai/metrics.rb,
lib/opentelemetry/semconv/incubating/gen_ai/attributes.rb

Metrics Names collapse

GEN_AI_CLIENT_OPERATION_DURATION =
Note:

Stability Level: development

GenAI operation duration

'gen_ai.client.operation.duration'
GEN_AI_CLIENT_TOKEN_USAGE =
Note:

Stability Level: development

Measures number of input and output tokens used

'gen_ai.client.token.usage'
GEN_AI_SERVER_REQUEST_DURATION =
Note:

Stability Level: development

Generative AI server request duration such as time-to-last byte or last output token

'gen_ai.server.request.duration'
GEN_AI_SERVER_TIME_PER_OUTPUT_TOKEN =
Note:

Stability Level: development

Time per output token generated after the first token for successful responses

'gen_ai.server.time_per_output_token'
GEN_AI_SERVER_TIME_TO_FIRST_TOKEN =
Note:

Stability Level: development

Time to generate first token for successful responses

'gen_ai.server.time_to_first_token'

Attribute Names collapse

GEN_AI_AGENT_DESCRIPTION =
Note:

Stability Level: development

Free-form description of the GenAI agent provided by the application.

Examples:

Sample Values

Helps with math problems
Generates fiction stories
'gen_ai.agent.description'
GEN_AI_AGENT_ID =
Note:

Stability Level: development

The unique identifier of the GenAI agent.

Examples:

Sample Values

asst_5j66UpCpwteGg4YSxUnt7lPY
'gen_ai.agent.id'
GEN_AI_AGENT_NAME =
Note:

Stability Level: development

Human-readable name of the GenAI agent provided by the application.

Examples:

Sample Values

Math Tutor
Fiction Writer
'gen_ai.agent.name'
GEN_AI_COMPLETION =
Deprecated.

“Removed, no replacement at this time.”, “reason”: “obsoleted”

Note:

Stability Level: development

Deprecated, use Event API to report completions contents.

Examples:

Sample Values

[{'role': 'assistant', 'content': 'The capital of France is Paris.'}]
'gen_ai.completion'
GEN_AI_CONVERSATION_ID =
Note:

Stability Level: development

The unique identifier for a conversation (session, thread), used to store and correlate messages within this conversation.

Examples:

Sample Values

conv_5j66UpCpwteGg4YSxUnt7lPY
'gen_ai.conversation.id'
GEN_AI_DATA_SOURCE_ID =
Note:

Stability Level: development

The data source identifier.

Data sources are used by AI agents and RAG applications to store grounding data. A data source may be an external database, object store, document collection, website, or any other storage system used by the GenAI agent or application. The gen_ai.data_source.id SHOULD match the identifier used by the GenAI system rather than a name specific to the external storage, such as a database or object store. Semantic conventions referencing gen_ai.data_source.id MAY also leverage additional attributes, such as db.*, to further identify and describe the data source.

Examples:

Sample Values

H7STPQYOND
'gen_ai.data_source.id'
GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT =
Deprecated.

“Replaced by gen_ai.output.type.”, “reason”: “renamed”, “renamed_to”: “gen_ai.output.type”

Note:

Stability Level: development

Deprecated, use gen_ai.output.type.

'gen_ai.openai.request.response_format'
GEN_AI_OPENAI_REQUEST_SEED =
Deprecated.

“Replaced by gen_ai.request.seed.”, “reason”: “renamed”, “renamed_to”: “gen_ai.request.seed”

Note:

Stability Level: development

Deprecated, use gen_ai.request.seed.

Examples:

Sample Values

100
'gen_ai.openai.request.seed'
GEN_AI_OPENAI_REQUEST_SERVICE_TIER =
Note:

Stability Level: development

The service tier requested. May be a specific tier, default, or auto.

Examples:

Sample Values

auto
default
'gen_ai.openai.request.service_tier'
GEN_AI_OPENAI_RESPONSE_SERVICE_TIER =
Note:

Stability Level: development

The service tier used for the response.

Examples:

Sample Values

scale
default
'gen_ai.openai.response.service_tier'
GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT =
Note:

Stability Level: development

A fingerprint to track any eventual change in the Generative AI environment.

Examples:

Sample Values

fp_44709d6fcb
'gen_ai.openai.response.system_fingerprint'
GEN_AI_OPERATION_NAME =
Note:

Stability Level: development

The name of the operation being performed.

If one of the predefined values applies, but specific system uses a different name it’s RECOMMENDED to document it in the semantic conventions for specific GenAI system and use system-specific name in the instrumentation. If a different name is not documented, instrumentation libraries SHOULD use applicable predefined value.

'gen_ai.operation.name'
GEN_AI_OUTPUT_TYPE =
Note:

Stability Level: development

Represents the content type requested by the client.

This attribute SHOULD be used when the client requests output of a specific type. The model may return zero or more outputs of this type. This attribute specifies the output modality and not the actual output format. For example, if an image is requested, the actual output could be a URL pointing to an image file. Additional output format details may be recorded in the future in the gen_ai.output.{type}.* attributes.

'gen_ai.output.type'
GEN_AI_PROMPT =
Deprecated.

“Removed, no replacement at this time.”, “reason”: “obsoleted”

Note:

Stability Level: development

Deprecated, use Event API to report prompt contents.

Examples:

Sample Values

[{'role': 'user', 'content': 'What is the capital of France?'}]
'gen_ai.prompt'
GEN_AI_REQUEST_CHOICE_COUNT =
Note:

Stability Level: development

The target number of candidate completions to return.

Examples:

Sample Values

3
'gen_ai.request.choice.count'
GEN_AI_REQUEST_ENCODING_FORMATS =
Note:

Stability Level: development

The encoding formats requested in an embeddings operation, if specified.

In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.

Examples:

Sample Values

["base64"]
["float", "binary"]
'gen_ai.request.encoding_formats'
GEN_AI_REQUEST_FREQUENCY_PENALTY =
Note:

Stability Level: development

The frequency penalty setting for the GenAI request.

Examples:

Sample Values

0.1
'gen_ai.request.frequency_penalty'
GEN_AI_REQUEST_MAX_TOKENS =
Note:

Stability Level: development

The maximum number of tokens the model generates for a request.

Examples:

Sample Values

100
'gen_ai.request.max_tokens'
GEN_AI_REQUEST_MODEL =
Note:

Stability Level: development

The name of the GenAI model a request is being made to.

Examples:

Sample Values

gpt-4
'gen_ai.request.model'
GEN_AI_REQUEST_PRESENCE_PENALTY =
Note:

Stability Level: development

The presence penalty setting for the GenAI request.

Examples:

Sample Values

0.1
'gen_ai.request.presence_penalty'
GEN_AI_REQUEST_SEED =
Note:

Stability Level: development

Requests with same seed value more likely to return same result.

Examples:

Sample Values

100
'gen_ai.request.seed'
GEN_AI_REQUEST_STOP_SEQUENCES =
Note:

Stability Level: development

List of sequences that the model will use to stop generating further tokens.

Examples:

Sample Values

["forest", "lived"]
'gen_ai.request.stop_sequences'
GEN_AI_REQUEST_TEMPERATURE =
Note:

Stability Level: development

The temperature setting for the GenAI request.

Examples:

Sample Values

0.0
'gen_ai.request.temperature'
GEN_AI_REQUEST_TOP_K =
Note:

Stability Level: development

The top_k sampling setting for the GenAI request.

Examples:

Sample Values

1.0
'gen_ai.request.top_k'
GEN_AI_REQUEST_TOP_P =
Note:

Stability Level: development

The top_p sampling setting for the GenAI request.

Examples:

Sample Values

1.0
'gen_ai.request.top_p'
GEN_AI_RESPONSE_FINISH_REASONS =
Note:

Stability Level: development

Array of reasons the model stopped generating tokens, corresponding to each generation received.

Examples:

Sample Values

["stop"]
["stop", "length"]
'gen_ai.response.finish_reasons'
GEN_AI_RESPONSE_ID =
Note:

Stability Level: development

The unique identifier for the completion.

Examples:

Sample Values

chatcmpl-123
'gen_ai.response.id'
GEN_AI_RESPONSE_MODEL =
Note:

Stability Level: development

The name of the model that generated the response.

Examples:

Sample Values

gpt-4-0613
'gen_ai.response.model'
GEN_AI_SYSTEM =
Note:

Stability Level: development

The Generative AI product as identified by the client or server instrumentation.

The gen_ai.system describes a family of GenAI models with specific model identified by gen_ai.request.model and gen_ai.response.model attributes.

The actual GenAI product may differ from the one identified by the client. Multiple systems, including Azure OpenAI and Gemini, are accessible by OpenAI client libraries. In such cases, the gen_ai.system is set to openai based on the instrumentation’s best knowledge, instead of the actual system. The server.address attribute may help identify the actual system in use for openai.

For custom model, a custom friendly name SHOULD be used. If none of these options apply, the gen_ai.system SHOULD be set to _OTHER.

Examples:

Sample Values

openai
'gen_ai.system'
GEN_AI_TOKEN_TYPE =
Note:

Stability Level: development

The type of token being counted.

Examples:

Sample Values

input
output
'gen_ai.token.type'
GEN_AI_TOOL_CALL_ID =
Note:

Stability Level: development

The tool call identifier.

Examples:

Sample Values

call_mszuSIzqtI65i1wAUOE8w5H4
'gen_ai.tool.call.id'
GEN_AI_TOOL_DESCRIPTION =
Note:

Stability Level: development

The tool description.

Examples:

Sample Values

Multiply two numbers
'gen_ai.tool.description'
GEN_AI_TOOL_NAME =
Note:

Stability Level: development

Name of the tool utilized by the agent.

Examples:

Sample Values

Flights
'gen_ai.tool.name'
GEN_AI_TOOL_TYPE =
Note:

Stability Level: development

Type of the tool utilized by the agent

Extension: A tool executed on the agent-side to directly call external APIs, bridging the gap between the agent and real-world systems. Agent-side operations involve actions that are performed by the agent on the server or within the agent’s controlled environment. Function: A tool executed on the client-side, where the agent generates parameters for a predefined function, and the client executes the logic. Client-side operations are actions taken on the user’s end or within the client application. Datastore: A tool used by the agent to access and query structured or unstructured external data for retrieval-augmented tasks or knowledge updates.

Examples:

Sample Values

function
extension
datastore
'gen_ai.tool.type'
GEN_AI_USAGE_COMPLETION_TOKENS =
Deprecated.

“Replaced by gen_ai.usage.output_tokens.”, “reason”: “renamed”, “renamed_to”: “gen_ai.usage.output_tokens”

Note:

Stability Level: development

Deprecated, use gen_ai.usage.output_tokens instead.

Examples:

Sample Values

42
'gen_ai.usage.completion_tokens'
GEN_AI_USAGE_INPUT_TOKENS =
Note:

Stability Level: development

The number of tokens used in the GenAI input (prompt).

Examples:

Sample Values

100
'gen_ai.usage.input_tokens'
GEN_AI_USAGE_OUTPUT_TOKENS =
Note:

Stability Level: development

The number of tokens used in the GenAI response (completion).

Examples:

Sample Values

180
'gen_ai.usage.output_tokens'
GEN_AI_USAGE_PROMPT_TOKENS =
Deprecated.

“Replaced by gen_ai.usage.input_tokens.”, “reason”: “renamed”, “renamed_to”: “gen_ai.usage.input_tokens”

Note:

Stability Level: development

Deprecated, use gen_ai.usage.input_tokens instead.

Examples:

Sample Values

42
'gen_ai.usage.prompt_tokens'