groups: - id: registry.gen_ai prefix: gen_ai type: attribute_group display_name: GenAI Attributes brief: > This document defines the attributes used to describe telemetry in the context of Generative Artificial Intelligence (GenAI) Models requests and responses. attributes: - id: system stability: experimental type: members: - id: openai stability: experimental value: "openai" brief: 'OpenAI' - id: vertex_ai stability: experimental value: "vertex_ai" brief: 'Vertex AI' - id: anthropic stability: experimental value: "anthropic" brief: 'Anthropic' - id: cohere stability: experimental value: "cohere" brief: 'Cohere' brief: The Generative AI product as identified by the client or server instrumentation. note: | 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. For example, when using OpenAI client libraries to communicate with Mistral, the `gen_ai.system` is set to `openai` based on the instrumentation's best knowledge. 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: 'openai' - id: request.model stability: experimental type: string brief: The name of the GenAI model a request is being made to. examples: 'gpt-4' - id: request.max_tokens stability: experimental type: int brief: The maximum number of tokens the model generates for a request. examples: [100] - id: request.temperature stability: experimental type: double brief: The temperature setting for the GenAI request. examples: [0.0] - id: request.top_p stability: experimental type: double brief: The top_p sampling setting for the GenAI request. examples: [1.0] tag: llm-generic-request - id: request.top_k stability: experimental type: double brief: The top_k sampling setting for the GenAI request. examples: [1.0] - id: request.stop_sequences stability: experimental type: string[] brief: List of sequences that the model will use to stop generating further tokens. examples: ['forest', 'lived'] - id: request.frequency_penalty stability: experimental type: double brief: The frequency penalty setting for the GenAI request. examples: [0.1] - id: request.presence_penalty stability: experimental type: double brief: The presence penalty setting for the GenAI request. examples: [0.1] - id: response.id stability: experimental type: string brief: The unique identifier for the completion. examples: ['chatcmpl-123'] - id: response.model stability: experimental type: string brief: The name of the model that generated the response. examples: ['gpt-4-0613'] - id: response.finish_reasons stability: experimental type: string[] brief: Array of reasons the model stopped generating tokens, corresponding to each generation received. examples: ['stop'] - id: usage.input_tokens stability: experimental type: int brief: The number of tokens used in the GenAI input (prompt). examples: [100] - id: usage.output_tokens stability: experimental type: int brief: The number of tokens used in the GenAI response (completion). examples: [180] - id: token.type stability: experimental type: members: - id: input stability: experimental value: "input" brief: 'Input tokens (prompt, input, etc.)' - id: completion stability: experimental value: "output" brief: 'Output tokens (completion, response, etc.)' brief: The type of token being counted. examples: ['input', 'output'] - id: prompt stability: experimental type: string brief: The full prompt sent to the GenAI model. note: It's RECOMMENDED to format prompts as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation) examples: ["[{'role': 'user', 'content': 'What is the capital of France?'}]"] - id: completion stability: experimental type: string brief: The full response received from the GenAI model. note: It's RECOMMENDED to format completions as JSON string matching [OpenAI messages format](https://platform.openai.com/docs/guides/text-generation) examples: ["[{'role': 'assistant', 'content': 'The capital of France is Paris.'}]"] - id: operation.name stability: experimental type: members: - id: chat value: "chat" brief: 'Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat)' stability: experimental - id: text_completion value: "text_completion" brief: 'Text completions operation such as [OpenAI Completions API (Legacy)](https://platform.openai.com/docs/api-reference/completions)' stability: experimental brief: The name of the operation being performed. note: > 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.