-
Notifications
You must be signed in to change notification settings - Fork 945
Description
What happened?
Context
The Semantic Conventions for Generative AI in 1.37.0 specify that for gen_ai.input.messages and gen_ai.output.messages, "When the attribute is recorded on events, it MUST be recorded in structured form", but Logger doesn't accept the respective JSON schemas of input and output messages as an event attribute.
Steps to Reproduce
Can easily reproduce using the tests in the instrumentation-openai package here: open-telemetry/opentelemetry-js-contrib#3194
this.logger.emit({
timestamp: Date.now(),
context: ctx,
severityNumber: SeverityNumber.INFO,
eventName: EVENT_GEN_AI_CLIENT_INFERENCE_OPERATION_DETAILS,
attributes: {
[ATTR_GEN_AI_PROVIDER_NAME]: GEN_AI_PROVIDER_NAME_VALUE_OPENAI,
[ATTR_GEN_AI_INPUT_MESSAGES]: [
{
"key": "value"
}
],
},
});Expected Result
The ATTR_GEN_AI_INPUT_MESSAGES attribute is logged.
Actual Result
The ATTR_GEN_AI_INPUT_MESSAGES attribute throws error.
Additional Details
It appears that Logger only accepts an array of primitives as an attribute.
OpenTelemetry Setup Code
package.json
Relevant log output
Operating System and Version
No response
Runtime and Version
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.