diff --git a/rfcs/text/0052-gen_ai-additional-fields.md b/rfcs/text/0052-gen_ai-additional-fields.md index 5569bd35a8..42377df9eb 100644 --- a/rfcs/text/0052-gen_ai-additional-fields.md +++ b/rfcs/text/0052-gen_ai-additional-fields.md @@ -31,12 +31,12 @@ Stage 1: Describe at a high level how this change affects fields. Include new or Field | Type | Description /Usage -- | -- | -- -gen_ai.system_instructions | (Looking for feedback) flattened | The system message or instructions provided to the GenAI model separately from the chat history. -gen_ai.input.messages | (Looking for feedback) flattened | The chat history provided to the model as an input. -gen_ai.output.messages | (Looking for feedback) flattened | Messages returned by the model where each message represents a specific model response (choice, candidate). -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. -gen_ai.tool.call.arguments | (Looking for feedback) nested | (Part of OTel execute_tool span) Parameters passed to the tool call. -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). +gen_ai.system_instructions | flattened | The system message or instructions provided to the GenAI model separately from the chat history. +gen_ai.input.messages | nested | The chat history provided to the model as an input. +gen_ai.output.messages | nested | Messages returned by the model where each message represents a specific model response (choice, candidate). +gen_ai.tool.definitions | nested | (Part of invoke_agent span) The list of source system tool definitions available to the GenAI agent or model. +gen_ai.tool.call.arguments | flattened | (Part of OTel execute_tool span) Parameters passed to the tool call. +gen_ai.tool.call.result | flattened | (Part of OTel execute_tool span) The result returned by the tool call (if any and if execution was successful). Changes based on OTel https://github.com/open-telemetry/semantic-conventions/pull/2179/files @@ -62,97 +62,73 @@ Example usage: { "gen_ai": { "system_instructions": { - [ - { - "type": "text", - "content": "You are a assistant for frequent travelers." - }, - { - "type": "text", - "content": "Your mission is to assist travelers with their queries about locations around the world." - } + [ + { + "type": "text", + "content": "You are a assistant for frequent travelers." + }, + { + "type": "text", + "content": "Your mission is to assist travelers with their queries about locations around the world." + } ] }, "input": { "messages": { [ - { - "role": "user", - "parts": [ { - "type": "text", - "content": "Weather in Paris?" - } - ] - }, - { - "role": "assistant", - "parts": [ + "role": "user", + "parts": [ + { + "type": "text", + "content": "Weather in Paris?" + } + ] + }, { - "type": "tool_call", - "id": "call_VSPygqKTWdrhaFErNvMV18Yl", - "name": "get_weather", - "arguments": { - "location": "Paris" + "role": "assistant", + "parts": [ + { + "type": "tool_call", + "id": "call_VSPygqKTWdrhaFErNvMV18Yl", + "name": "get_weather", + "arguments": { + "location": "Paris" + } } - } - ] - }, - { - "role": "tool", - "parts": [ + ] + }, { - "type": "tool_call_response", - "id": " call_VSPygqKTWdrhaFErNvMV18Yl", - "result": "rainy, 57°F" + "role": "tool", + "parts": [ + { + "type": "tool_call_response", + "id": " call_VSPygqKTWdrhaFErNvMV18Yl", + "result": "rainy, 57°F" + } + ] } - ] - } ] } }, "output" :{ "messages": { [ - { - "role": "assistant", - "parts": [ { - "type": "text", - "content": "The weather in Paris is currently rainy with a temperature of 57°F." - } - ], - "finish_reason": "stop" - } - ] - }, - - // Below needs to be updated, but keeping in this commit for illustration purposes. - "assistant": { - "message": { - "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.", - "role": "assistant", - "tool_calls": [ - { - "function": "getDroneSpecifications", - "arguments": {"payloadWeight": 5}, - "name": "getDroneSpecifications", - "id": "toolCall1", - "type": "function_call", - }, - { - "function": "retrieveAvailableDronesDocument", - "arguments": {"documentType": "availableDrones", "payloadRequirement": 5}, - "name": "retrieveAvailableDronesDocument", - "id": "toolCall2", - "type": "function_call", + "role": "assistant", + "parts": [ + { + "type": "text", + "content": "The weather in Paris is currently rainy with a temperature of 57°F." + } + ], + "finish_reason": "stop" } - ], - } - }, + ] + }, + } } } -} ``` @@ -226,8 +202,4 @@ e.g.: * Stage 0: https://github.com/elastic/ecs/pull/2519 - - +* Stage 1: https://github.com/elastic/ecs/pull/2525 diff --git a/rfcs/text/0052/gen_ai.yaml b/rfcs/text/0052/gen_ai.yaml new file mode 100644 index 0000000000..6febb99ab4 --- /dev/null +++ b/rfcs/text/0052/gen_ai.yaml @@ -0,0 +1,133 @@ +--- +- name: gen_ai + fields: + - name: system_instructions + type: flattened + description: The system message or instructions provided to the GenAI model separately from the chat history. + example: > + { + "type": "text", + "content": "You are an Agent that greet users, always use greetings tool to respond" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: input.messages + type: nested + description: The chat history provided to the model as an input. + example: > + { + "role": "user", + "parts": [ + { + "type": "text", + "content": "Weather in Paris?" + } + ] + }, + { + "role": "assistant", + "parts": [ + { + "type": "tool_call", + "id": "call_VSPygqKTWdrhaFErNvMV18Yl", + "name": "get_weather", + "arguments": { + "location": "Paris" + } + } + ] + }, + { + "role": "tool", + "parts": [ + { + "type": "tool_call_response", + "id": " call_VSPygqKTWdrhaFErNvMV18Yl", + "result": "rainy, 57°F" + } + ] + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: output.messages + type: nested + description: Messages returned by the model where each message represents a specific model response (choice, candidate). + example: > + { + "role": "assistant", + "parts": [ + { + "type": "text", + "content": "The weather in Paris is currently rainy with a temperature of 57°F." + } + ], + "finish_reason": "stop" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: tool.definitions + type: nested + description: The list of source system tool definitions available to the GenAI agent or model. + example: > + { + "type": "function", + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": [ + "celsius", + "fahrenheit" + ] + } + }, + "required": [ + "location", + "unit" + ] + } + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: tool.call.arguments + type: flattened + description: Parameters passed to the tool call. + example: > + { + "location": "San Francisco?", + "date": "2025-10-01" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: tool.call.result + type: flattened + description: The result returned by the tool call (if any and if execution was successful). + example: > + { + "temperature_range": { + "high": 75, + "low": 60 + }, + "conditions": "sunny" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match diff --git a/schemas/gen_ai.yml b/schemas/gen_ai.yml index 95a567a641..c8bfdfd909 100644 --- a/schemas/gen_ai.yml +++ b/schemas/gen_ai.yml @@ -235,3 +235,133 @@ beta: This field is beta and subject to change. otel: - relation: match + - name: system_instructions + type: flattened + description: The system message or instructions provided to the GenAI model separately from the chat history. + example: > + { + "type": "text", + "content": "You are an Agent that greet users, always use greetings tool to respond" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: input.messages + type: nested + description: The chat history provided to the model as an input. + example: > + { + "role": "user", + "parts": [ + { + "type": "text", + "content": "Weather in Paris?" + } + ] + }, + { + "role": "assistant", + "parts": [ + { + "type": "tool_call", + "id": "call_VSPygqKTWdrhaFErNvMV18Yl", + "name": "get_weather", + "arguments": { + "location": "Paris" + } + } + ] + }, + { + "role": "tool", + "parts": [ + { + "type": "tool_call_response", + "id": " call_VSPygqKTWdrhaFErNvMV18Yl", + "result": "rainy, 57°F" + } + ] + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: output.messages + type: nested + description: Messages returned by the model where each message represents a specific model response (choice, candidate). + example: > + { + "role": "assistant", + "parts": [ + { + "type": "text", + "content": "The weather in Paris is currently rainy with a temperature of 57°F." + } + ], + "finish_reason": "stop" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: tool.definitions + type: nested + description: The list of source system tool definitions available to the GenAI agent or model. + example: > + { + "type": "function", + "name": "get_current_weather", + "description": "Get the current weather in a given location", + "parameters": { + "type": "object", + "properties": { + "location": { + "type": "string", + "description": "The city and state, e.g. San Francisco, CA" + }, + "unit": { + "type": "string", + "enum": [ + "celsius", + "fahrenheit" + ] + } + }, + "required": [ + "location", + "unit" + ] + } + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: tool.call.arguments + type: flattened + description: Parameters passed to the tool call. + example: > + { + "location": "San Francisco?", + "date": "2025-10-01" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match + - name: tool.call.result + type: flattened + description: The result returned by the tool call (if any and if execution was successful). + example: > + { + "temperature_range": { + "high": 75, + "low": 60 + }, + "conditions": "sunny" + } + level: extended + beta: This field is beta and subject to change. + otel: + - relation: match