Repository navigation
Conversation
The Python constants now group each attribute's values the way the TypeScript const objects do: a plain class per attribute, with the same name as the TypeScript object, whose attributes are the values as plain str, and a one-line docstring that names the key constant. For example, LK_DEVICE_APP_STATE_FOREGROUND is now LkDeviceAppState.FOREGROUND. The class is not an enum.Enum, so the values stay plain str. Upstream keys in the upstream section get a class too, and shipped values render into their key's class (GenAiProviderName.MISTRAL_AI). The 141 flat value constants are removed, so a value has one spelling. The key, event, span, checkpoint and metric constants do not change, and the generated Rust, TypeScript and docs do not change. codegen.sh reads the escaped test value as LkTestEscape.TRICKY, and the README example uses the new spelling.
pblazej
added this pull request to stack #1877
October 21, 2026 16:08
pblazej
marked this pull request as ready for review
October 21, 2026 16:09
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR groups the generated Python values the same way #1872 groups the TypeScript values. Each attribute with a fixed set of values gets one plain class, with the same name as its TypeScript object. A plain class here is an ordinary class with one string constant per value. For example,
GEN_AI_PROVIDER_NAME_MISTRAL_AIbecomesGenAiProviderName.MISTRAL_AI. Rust already uses one module per attribute, so all three languages now use the same shape.What changes
otel/templates/registry/python/semconv.py.j2renders one class per attribute and removes the 141 flat value constants.otel/gen/python/semconv.pyhas the regenerated output.otel/tests/codegen.shchecks the new Python form.Every value is still a plain
str. The classes do not useenum, because Agents type-checks on Python 3.10 and sends the values as strings. The key, event, span, checkpoint and metric constants do not change. The Rust, TypeScript and Markdown output do not change.Python has seven classes that TypeScript does not have. Each one is for an upstream key that Agents uses, such as
GenAiProviderNameandErrorType. Upstream keys are keys that the OpenTelemetry conventions define. The TypeScript output does not list them, and this PR does not change that.Effect on Agents
livekit/agents#7973 used 32 of the removed names, and it now uses the class form. Every string that Agents sends stays byte-identical. This PR builds on #1872, which builds on #1866, so those two PRs merge first.