Skip to content

Commit 88e956a

Browse files
[RFC 0052] Stage 0: Update GenAI fields (#2525)
* Add example document * Add OTel in progress work to follow-up on * Update fields for OTel v1.37.0 and not-yet-released v1.38.0 --------- Co-authored-by: Alexandra Konrad <[email protected]>
1 parent ee30e83 commit 88e956a

File tree

1 file changed

+115
-12
lines changed

1 file changed

+115
-12
lines changed

rfcs/text/0052-gen_ai-additional-fields.md

Lines changed: 115 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,14 @@ Stage 1: Describe at a high level how this change affects fields. Include new or
3131

3232
Field | Type | Description /Usage
3333
-- | -- | --
34-
gen_ai.system.message.content | text/TBD | The contents of the system message.
35-
gen_ai.system.message.role | text | The actual role of the message author as passed in the message.
36-
gen_ai.user.message.content | text | The contents of the user message.
37-
gen_ai.user.message.role | text | The actual role of the message author as passed in the message.
38-
gen_ai.assistant.message.content | text | The contents of the tool message.
39-
gen_ai.assistant.message.role | text | The actual role of the message author as passed in the message.
40-
gen_ai.assistant.message.tool_calls[] | text | The tool calls generated by the model, such as function calls.
41-
gen_ai.assistant.message.function[] | [TBD] | The function call.
42-
gen_ai.assistant.message.arguments | [TBD] | The arguments of the function as provided in the LLM response.
43-
gen_ai.assistant.message.name | text | The name of the function.
44-
gen_ai.assistant.message.id | text | The id of the tool call.
45-
gen_ai.assistant.message.type | [TBD] | The type of the tool.
34+
gen_ai.system_instructions | (Looking for feedback) flattened | The system message or instructions provided to the GenAI model separately from the chat history.
35+
gen_ai.input.messages | (Looking for feedback) flattened | The chat history provided to the model as an input.
36+
gen_ai.output.messages | (Looking for feedback) flattened | Messages returned by the model where each message represents a specific model response (choice, candidate).
37+
gen_ai.tool.definitions | (Looking for feedback) nested | (Part of invoke_agent span) The list of source system tool definitions available to the GenAI agent or model.
38+
gen_ai.tool.call.arguments | (Looking for feedback) nested | (Part of OTel execute_tool span) Parameters passed to the tool call.
39+
gen_ai.tool.call.result | (Looking for feedback) nested | (Part of OTel execute_tool span) The result returned by the tool call (if any and if execution was successful).
40+
41+
Changes based on OTel https://github.com/open-telemetry/semantic-conventions/pull/2179/files
4642

4743
<!--
4844
Stage 2: Add or update all remaining field definitions. The list should now be exhaustive. The goal here is to validate the technical details of all remaining fields and to provide a basis for releasing these field definitions as beta in the schema. Use GitHub code blocks with yml syntax formatting, and add them to the corresponding RFC folder.
@@ -60,6 +56,106 @@ Stage 1: Describe at a high-level how these field changes will be used in practi
6056
Stage 1: Provide a high-level description of example sources of data. This does not yet need to be a concrete example of a source document, but instead can simply describe a potential source (e.g. nginx access log). This will ultimately be fleshed out to include literal source examples in a future stage. The goal here is to identify practical sources for these fields in the real world. ~1-3 sentences or unordered list.
6157
-->
6258

59+
Example usage:
60+
61+
```json
62+
{
63+
"gen_ai": {
64+
"system_instructions": {
65+
[
66+
{
67+
"type": "text",
68+
"content": "You are a assistant for frequent travelers."
69+
},
70+
{
71+
"type": "text",
72+
"content": "Your mission is to assist travelers with their queries about locations around the world."
73+
}
74+
]
75+
},
76+
"input": {
77+
"messages": {
78+
[
79+
{
80+
"role": "user",
81+
"parts": [
82+
{
83+
"type": "text",
84+
"content": "Weather in Paris?"
85+
}
86+
]
87+
},
88+
{
89+
"role": "assistant",
90+
"parts": [
91+
{
92+
"type": "tool_call",
93+
"id": "call_VSPygqKTWdrhaFErNvMV18Yl",
94+
"name": "get_weather",
95+
"arguments": {
96+
"location": "Paris"
97+
}
98+
}
99+
]
100+
},
101+
{
102+
"role": "tool",
103+
"parts": [
104+
{
105+
"type": "tool_call_response",
106+
"id": " call_VSPygqKTWdrhaFErNvMV18Yl",
107+
"result": "rainy, 57°F"
108+
}
109+
]
110+
}
111+
]
112+
}
113+
},
114+
"output" :{
115+
"messages": {
116+
[
117+
{
118+
"role": "assistant",
119+
"parts": [
120+
{
121+
"type": "text",
122+
"content": "The weather in Paris is currently rainy with a temperature of 57°F."
123+
}
124+
],
125+
"finish_reason": "stop"
126+
}
127+
]
128+
},
129+
130+
// Below needs to be updated, but keeping in this commit for illustration purposes.
131+
"assistant": {
132+
"message": {
133+
"content": "To carry a 5lb package, you would need a drone with sufficient payload capacity. Drones designed for heavy lifting often fall in the industrial or commercial category. Consider drones with a payload capacity of at least 6-7lbs to ensure safe transport and account for additional factors like battery and stability.",
134+
"role": "assistant",
135+
"tool_calls": [
136+
{
137+
"function": "getDroneSpecifications",
138+
"arguments": {"payloadWeight": 5},
139+
"name": "getDroneSpecifications",
140+
"id": "toolCall1",
141+
"type": "function_call",
142+
},
143+
{
144+
"function": "retrieveAvailableDronesDocument",
145+
"arguments": {"documentType": "availableDrones", "payloadRequirement": 5},
146+
"name": "retrieveAvailableDronesDocument",
147+
"id": "toolCall2",
148+
"type": "function_call",
149+
}
150+
],
151+
}
152+
},
153+
}
154+
}
155+
}
156+
```
157+
158+
63159
<!--
64160
Stage 2: Included a real world example source document. Ideally this example comes from the source(s) identified in stage 1. If not, it should replace them. The goal here is to validate the utility of these field changes in the context of a real world example. Format with the source name as a ### header and the example document in a GitHub code block with json formatting, or if on the larger side, add them to the corresponding RFC folder.
65161
-->
@@ -84,6 +180,9 @@ The goal here is to research and understand the impact of these changes on users
84180
Stage 1: Identify potential concerns, implementation challenges, or complexity. Spend some time on this. Play devil's advocate. Try to identify the sort of non-obvious challenges that tend to surface later. The goal here is to surface risks early, allow everyone the time to work through them, and ultimately document resolution for posterity's sake.
85181
-->
86182

183+
In OTel, many field types are set to `any` and are typically .json objects. [Example](https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-events/)
184+
In ECS, should we use something like [flattened](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/flattened) type, if allowed?
185+
87186
<!--
88187
Stage 2: Document new concerns or resolutions to previously listed concerns. It's not critical that all concerns have resolutions at this point, but it would be helpful if resolutions were taking shape for the most significant concerns.
89188
-->
@@ -116,7 +215,11 @@ e.g.:
116215
<!-- Insert any links appropriate to this RFC in this section. -->
117216

118217
* https://opentelemetry.io/blog/2024/otel-generative-ai/
218+
* https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-events/
219+
* https://github.com/open-telemetry/semantic-conventions/commits/main/docs/gen-ai/gen-ai-events.md
220+
* https://github.com/open-telemetry/semantic-conventions/pull/2702
119221
* https://www.elastic.co/docs/reference/ecs/ecs-gen_ai#_gen_ai_field_details
222+
* https://github.com/open-telemetry/semantic-conventions/pull/2179/
120223

121224
### RFC Pull Requests
122225

0 commit comments

Comments
 (0)