open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
261 stars 167 forks source link

Change `gen_ai.response.finish_reasons` type from array to `string`, use it on metrics #1291

Closed lmolkova closed 1 month ago

lmolkova commented 2 months ago

Fixes #1277

Changes

While OpenAI supports returning multiple completions (and therefore could have multiple finish reasons), I did not find models outside of OpenAI that return multiple choices and many SDKs (e.g. vercel) don't support returning multiple choices.

So effectively there is usually one finish reason. Having an array for it:

This PR:

Having comma-separated list has high-ish theoretical cardinality in edge cases, but results in best experience for common case. I'm suggesting to start with it and consider making it opt-in on metrics if it's proven to be problematic.

Merge requirement checklist

lmolkova commented 1 month ago

I'm going to close this PR and pursue other ways that work better for batching and multiple choices outlined here

https://github.com/open-telemetry/semantic-conventions/issues/1277#issuecomment-2273951154