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

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.

'gen_ai.agent.description'
GEN_AI_AGENT_ID =
Note:

Stability Level: development

The unique identifier of the GenAI agent.

'gen_ai.agent.id'
GEN_AI_AGENT_NAME =
Note:

Stability Level: development

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

'gen_ai.agent.name'
GEN_AI_COMPLETION =
Deprecated.

Removed, no replacement at this time.

Note:

Stability Level: development

Deprecated, use Event API to report completions contents.

'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.

'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.

'gen_ai.data_source.id'
GEN_AI_EMBEDDINGS_DIMENSION_COUNT =
Note:

Stability Level: development

The number of dimensions the resulting output embeddings should have.

'gen_ai.embeddings.dimension.count'
GEN_AI_EVALUATION_EXPLANATION =
Note:

Stability Level: development

A free-form explanation for the assigned score provided by the evaluator.

'gen_ai.evaluation.explanation'
GEN_AI_EVALUATION_NAME =
Note:

Stability Level: development

The name of the evaluation metric used for the GenAI response.

'gen_ai.evaluation.name'
GEN_AI_EVALUATION_SCORE_LABEL =
Note:

Stability Level: development

Human readable label for evaluation.

This attribute provides a human-readable interpretation of the evaluation score produced by an evaluator. For example, a score value of 1 could mean "relevant" in one evaluation system and "not relevant" in another, depending on the scoring range and evaluator. The label SHOULD have low cardinality. Possible values depend on the evaluation metric and evaluator used; implementations SHOULD document the possible values.

'gen_ai.evaluation.score.label'
GEN_AI_EVALUATION_SCORE_VALUE =
Note:

Stability Level: development

The evaluation score returned by the evaluator.

'gen_ai.evaluation.score.value'
GEN_AI_INPUT_MESSAGES =
Note:

Stability Level: development

The chat history provided to the model as an input.

Instrumentations MUST follow Input messages JSON schema. When the attribute is recorded on events, it MUST be recorded in structured form. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.

Messages MUST be provided in the order they were sent to the model. Instrumentations MAY provide a way for users to filter or truncate input messages.

[!Warning] This attribute is likely to contain sensitive information including user/PII data.

See Recording content on attributes section for more details.

'gen_ai.input.messages'
GEN_AI_OPENAI_REQUEST_RESPONSE_FORMAT =
Deprecated.

Replaced by 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.

Note:

Stability Level: development

Deprecated, use gen_ai.request.seed.

'gen_ai.openai.request.seed'
GEN_AI_OPENAI_REQUEST_SERVICE_TIER =
Deprecated.

Replaced by openai.request.service_tier.

Note:

Stability Level: development

Deprecated, use openai.request.service_tier.

'gen_ai.openai.request.service_tier'
GEN_AI_OPENAI_RESPONSE_SERVICE_TIER =
Deprecated.

Replaced by openai.response.service_tier.

Note:

Stability Level: development

Deprecated, use openai.response.service_tier.

'gen_ai.openai.response.service_tier'
GEN_AI_OPENAI_RESPONSE_SYSTEM_FINGERPRINT =
Deprecated.

Replaced by openai.response.system_fingerprint.

Note:

Stability Level: development

Deprecated, use openai.response.system_fingerprint.

'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_MESSAGES =
Note:

Stability Level: development

Messages returned by the model where each message represents a specific model response (choice, candidate).

Instrumentations MUST follow Output messages JSON schema

Each message represents a single output choice/candidate generated by the model. Each message corresponds to exactly one generation (choice/candidate) and vice versa - one choice cannot be split across multiple messages or one message cannot contain parts from multiple choices.

When the attribute is recorded on events, it MUST be recorded in structured form. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.

Instrumentations MAY provide a way for users to filter or truncate output messages.

[!Warning] This attribute is likely to contain sensitive information including user/PII data.

See Recording content on attributes section for more details.

'gen_ai.output.messages'
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.

Note:

Stability Level: development

Deprecated, use Event API to report prompt contents.

'gen_ai.prompt'
GEN_AI_PROVIDER_NAME =
Note:

Stability Level: development

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

The attribute SHOULD be set based on the instrumentation's best knowledge and may differ from the actual model provider.

Multiple providers, including Azure OpenAI, Gemini, and AI hosting platforms are accessible using the OpenAI REST API and corresponding client libraries, but may proxy or host models from different providers.

The gen_ai.request.model, gen_ai.response.model, and server.address attributes may help identify the actual system in use.

The gen_ai.provider.name attribute acts as a discriminator that identifies the GenAI telemetry format flavor specific to that provider within GenAI semantic conventions. It SHOULD be set consistently with provider-specific attributes and signals. For example, GenAI spans, metrics, and events related to AWS Bedrock should have the gen_ai.provider.name set to aws.bedrock and include applicable aws.bedrock.* attributes and are not expected to include openai.* attributes.

'gen_ai.provider.name'
GEN_AI_REQUEST_CHOICE_COUNT =
Note:

Stability Level: development

The target number of candidate completions to return.

'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.

'gen_ai.request.encoding_formats'
GEN_AI_REQUEST_FREQUENCY_PENALTY =
Note:

Stability Level: development

The frequency penalty setting for the GenAI request.

'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.

'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.

'gen_ai.request.model'
GEN_AI_REQUEST_PRESENCE_PENALTY =
Note:

Stability Level: development

The presence penalty setting for the GenAI request.

'gen_ai.request.presence_penalty'
GEN_AI_REQUEST_SEED =
Note:

Stability Level: development

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

'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.

'gen_ai.request.stop_sequences'
GEN_AI_REQUEST_TEMPERATURE =
Note:

Stability Level: development

The temperature setting for the GenAI request.

'gen_ai.request.temperature'
GEN_AI_REQUEST_TOP_K =
Note:

Stability Level: development

The top_k sampling setting for the GenAI request.

'gen_ai.request.top_k'
GEN_AI_REQUEST_TOP_P =
Note:

Stability Level: development

The top_p sampling setting for the GenAI request.

'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.

'gen_ai.response.finish_reasons'
GEN_AI_RESPONSE_ID =
Note:

Stability Level: development

The unique identifier for the completion.

'gen_ai.response.id'
GEN_AI_RESPONSE_MODEL =
Note:

Stability Level: development

The name of the model that generated the response.

'gen_ai.response.model'
GEN_AI_SYSTEM =
Deprecated.

Replaced by gen_ai.provider.name.

Note:

Stability Level: development

Deprecated, use gen_ai.provider.name instead.

'gen_ai.system'
GEN_AI_SYSTEM_INSTRUCTIONS =
Note:

Stability Level: development

The system message or instructions provided to the GenAI model separately from the chat history.

This attribute SHOULD be used when the corresponding provider or API allows to provide system instructions or messages separately from the chat history.

Instructions that are part of the chat history SHOULD be recorded in gen_ai.input.messages attribute instead.

Instrumentations MUST follow System instructions JSON schema.

When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.

Instrumentations MAY provide a way for users to filter or truncate system instructions.

[!Warning] This attribute may contain sensitive information.

See Recording content on attributes section for more details.

'gen_ai.system_instructions'
GEN_AI_TOKEN_TYPE =
Note:

Stability Level: development

The type of token being counted.

'gen_ai.token.type'
GEN_AI_TOOL_CALL_ARGUMENTS =
Note:

Stability Level: development

Parameters passed to the tool call.

[!WARNING] This attribute may contain sensitive information.

It's expected to be an object - in case a serialized string is available to the instrumentation, the instrumentation SHOULD do the best effort to deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.

'gen_ai.tool.call.arguments'
GEN_AI_TOOL_CALL_ID =
Note:

Stability Level: development

The tool call identifier.

'gen_ai.tool.call.id'
GEN_AI_TOOL_CALL_RESULT =
Note:

Stability Level: development

The result returned by the tool call (if any and if execution was successful).

[!WARNING] This attribute may contain sensitive information.

It's expected to be an object - in case a serialized string is available to the instrumentation, the instrumentation SHOULD do the best effort to deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.

'gen_ai.tool.call.result'
GEN_AI_TOOL_DEFINITIONS =
Note:

Stability Level: development

The list of source system tool definitions available to the GenAI agent or model.

The value of this attribute matches source system tool definition format.

It's expected to be an array of objects where each object represents a tool definition. In case a serialized string is available to the instrumentation, the instrumentation SHOULD do the best effort to deserialize it to an array. When recorded on spans, it MAY be recorded as a JSON string if structured format is not supported and SHOULD be recorded in structured form otherwise.

Since this attribute could be large, it's NOT RECOMMENDED to populate it by default. Instrumentations MAY provide a way to enable populating this attribute.

'gen_ai.tool.definitions'
GEN_AI_TOOL_DESCRIPTION =
Note:

Stability Level: development

The tool description.

'gen_ai.tool.description'
GEN_AI_TOOL_NAME =
Note:

Stability Level: development

Name of the tool utilized by the agent.

'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.

'gen_ai.tool.type'
GEN_AI_USAGE_COMPLETION_TOKENS =
Deprecated.

Replaced by gen_ai.usage.output_tokens.

Note:

Stability Level: development

Deprecated, use gen_ai.usage.output_tokens instead.

'gen_ai.usage.completion_tokens'
GEN_AI_USAGE_INPUT_TOKENS =
Note:

Stability Level: development

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

'gen_ai.usage.input_tokens'
GEN_AI_USAGE_OUTPUT_TOKENS =
Note:

Stability Level: development

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

'gen_ai.usage.output_tokens'
GEN_AI_USAGE_PROMPT_TOKENS =
Deprecated.

Replaced by gen_ai.usage.input_tokens.

Note:

Stability Level: development

Deprecated, use gen_ai.usage.input_tokens instead.

'gen_ai.usage.prompt_tokens'