Skip to content

Commit dcb30bf

Browse files
lmolkovatrentm
andauthored
Introduce generic gen_ai.output.type instead of gen_ai.openai.request.response_format (#1757)
Co-authored-by: Trent Mick <[email protected]>
1 parent 31b9301 commit dcb30bf

File tree

8 files changed

+222
-95
lines changed

8 files changed

+222
-95
lines changed

.chloggen/1757.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
change_type: breaking
2+
component: gen-ai
3+
note: "Introduce `gen_ai.output.type`and deprecate `gen_ai.openai.request.response_format`"
4+
issues: [1757]

docs/attributes-registry/gen-ai.md

+32-16
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ This document defines the attributes used to describe telemetry in the context o
1515
| Attribute | Type | Description | Examples | Stability |
1616
|---|---|---|---|---|
1717
| <a id="gen-ai-operation-name" href="#gen-ai-operation-name">`gen_ai.operation.name`</a> | string | The name of the operation being performed. [1] | `chat`; `text_completion`; `embeddings` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
18-
| <a id="gen-ai-request-encoding-formats" href="#gen-ai-request-encoding-formats">`gen_ai.request.encoding_formats`</a> | string[] | The encoding formats requested in an embeddings operation, if specified. [2] | `["base64"]`; `["float", "binary"]` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
18+
| <a id="gen-ai-output-type" href="#gen-ai-output-type">`gen_ai.output.type`</a> | string | Represents the content type requested by the client. [2] | `text`; `json`; `image` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
19+
| <a id="gen-ai-request-encoding-formats" href="#gen-ai-request-encoding-formats">`gen_ai.request.encoding_formats`</a> | string[] | The encoding formats requested in an embeddings operation, if specified. [3] | `["base64"]`; `["float", "binary"]` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
1920
| <a id="gen-ai-request-frequency-penalty" href="#gen-ai-request-frequency-penalty">`gen_ai.request.frequency_penalty`</a> | double | The frequency penalty setting for the GenAI request. | `0.1` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2021
| <a id="gen-ai-request-max-tokens" href="#gen-ai-request-max-tokens">`gen_ai.request.max_tokens`</a> | int | The maximum number of tokens the model generates for a request. | `100` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2122
| <a id="gen-ai-request-model" href="#gen-ai-request-model">`gen_ai.request.model`</a> | string | The name of the GenAI model a request is being made to. | `gpt-4` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
@@ -28,16 +29,20 @@ This document defines the attributes used to describe telemetry in the context o
2829
| <a id="gen-ai-response-finish-reasons" href="#gen-ai-response-finish-reasons">`gen_ai.response.finish_reasons`</a> | string[] | Array of reasons the model stopped generating tokens, corresponding to each generation received. | `["stop"]`; `["stop", "length"]` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2930
| <a id="gen-ai-response-id" href="#gen-ai-response-id">`gen_ai.response.id`</a> | string | The unique identifier for the completion. | `chatcmpl-123` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3031
| <a id="gen-ai-response-model" href="#gen-ai-response-model">`gen_ai.response.model`</a> | string | The name of the model that generated the response. | `gpt-4-0613` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
31-
| <a id="gen-ai-system" href="#gen-ai-system">`gen_ai.system`</a> | string | The Generative AI product as identified by the client or server instrumentation. [3] | `openai` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
32+
| <a id="gen-ai-system" href="#gen-ai-system">`gen_ai.system`</a> | string | The Generative AI product as identified by the client or server instrumentation. [4] | `openai` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3233
| <a id="gen-ai-token-type" href="#gen-ai-token-type">`gen_ai.token.type`</a> | string | The type of token being counted. | `input`; `output` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3334
| <a id="gen-ai-usage-input-tokens" href="#gen-ai-usage-input-tokens">`gen_ai.usage.input_tokens`</a> | int | The number of tokens used in the GenAI input (prompt). | `100` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3435
| <a id="gen-ai-usage-output-tokens" href="#gen-ai-usage-output-tokens">`gen_ai.usage.output_tokens`</a> | int | The number of tokens used in the GenAI response (completion). | `180` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3536

3637
**[1] `gen_ai.operation.name`:** 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.
3738

38-
**[2] `gen_ai.request.encoding_formats`:** In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.
39+
**[2] `gen_ai.output.type`:** 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.
40+
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.
41+
Additional output format details may be recorded in the future in the `gen_ai.output.{type}.*` attributes.
3942

40-
**[3] `gen_ai.system`:** The `gen_ai.system` describes a family of GenAI models with specific model identified
43+
**[3] `gen_ai.request.encoding_formats`:** In some GenAI systems the encoding formats are called embedding types. Also, some GenAI systems only accept a single format per request.
44+
45+
**[4] `gen_ai.system`:** The `gen_ai.system` describes a family of GenAI models with specific model identified
4146
by `gen_ai.request.model` and `gen_ai.response.model` attributes.
4247

4348
The actual GenAI product may differ from the one identified by the client.
@@ -61,6 +66,17 @@ If none of these options apply, the `gen_ai.system` SHOULD be set to `_OTHER`.
6166

6267
---
6368

69+
`gen_ai.output.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
70+
71+
| Value | Description | Stability |
72+
|---|---|---|
73+
| `image` | Image | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
74+
| `json` | JSON object with known or unknown schema | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
75+
| `speech` | Speech | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
76+
| `text` | Plain text | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
77+
78+
---
79+
6480
`gen_ai.system` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
6581

6682
| Value | Description | Stability |
@@ -91,27 +107,16 @@ If none of these options apply, the `gen_ai.system` SHOULD be set to `_OTHER`.
91107

92108
## OpenAI Attributes
93109

94-
Thie group defines attributes for OpenAI.
110+
This group defines attributes for OpenAI.
95111

96112
| Attribute | Type | Description | Examples | Stability |
97113
|---|---|---|---|---|
98-
| <a id="gen-ai-openai-request-response-format" href="#gen-ai-openai-request-response-format">`gen_ai.openai.request.response_format`</a> | string | The response format that is requested. | `json` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
99114
| <a id="gen-ai-openai-request-service-tier" href="#gen-ai-openai-request-service-tier">`gen_ai.openai.request.service_tier`</a> | string | The service tier requested. May be a specific tier, default, or auto. | `auto`; `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
100115
| <a id="gen-ai-openai-response-service-tier" href="#gen-ai-openai-response-service-tier">`gen_ai.openai.response.service_tier`</a> | string | The service tier used for the response. | `scale`; `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
101116
| <a id="gen-ai-openai-response-system-fingerprint" href="#gen-ai-openai-response-system-fingerprint">`gen_ai.openai.response.system_fingerprint`</a> | string | A fingerprint to track any eventual change in the Generative AI environment. | `fp_44709d6fcb` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
102117

103118
---
104119

105-
`gen_ai.openai.request.response_format` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
106-
107-
| Value | Description | Stability |
108-
|---|---|---|
109-
| `json_object` | JSON object response format | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
110-
| `json_schema` | JSON schema response format | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
111-
| `text` | Text response format | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
112-
113-
---
114-
115120
`gen_ai.openai.request.service_tier` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
116121

117122
| Value | Description | Stability |
@@ -136,4 +141,15 @@ Describes deprecated `gen_ai.openai` attributes.
136141

137142
| Attribute | Type | Description | Examples | Stability |
138143
|---|---|---|---|---|
144+
| <a id="gen-ai-openai-request-response-format" href="#gen-ai-openai-request-response-format">`gen_ai.openai.request.response_format`</a> | string | Deprecated, use `gen_ai.output.type`. | `text`; `json_object`; `json_schema` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `gen_ai.output.type`. |
139145
| <a id="gen-ai-openai-request-seed" href="#gen-ai-openai-request-seed">`gen_ai.openai.request.seed`</a> | int | Deprecated, use `gen_ai.request.seed`. | `100` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by `gen_ai.request.seed` attribute. |
146+
147+
---
148+
149+
`gen_ai.openai.request.response_format` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
150+
151+
| Value | Description | Stability |
152+
|---|---|---|
153+
| `json_object` | JSON object response format | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
154+
| `json_schema` | JSON schema response format | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
155+
| `text` | Text response format | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

0 commit comments

Comments
 (0)