Add RuntimeConfig declared fields + null-skip (proposal 0032)#78
Merged
Conversation
Implements proposal 0032 (spec v0.24.0). Three OpenAI-standard sampling parameters promoted from the extras pass-through to declared fields on RuntimeConfig: frequency_penalty, presence_penalty, and stop_sequences. The declared name stop_sequences matches the OpenTelemetry GenAI semconv (and Anthropic / Gemini wire-key conventions); the OpenAI-compatible wire mapping translates it to OpenAI's shorter body key stop on emission, per spec §8.1. Null-skip is now uniform across all seven declared fields: a field set to None is omitted from the wire body entirely (no JSON null). The existing four fields already followed this pattern; the three new fields extend it. OTel observer emits gen_ai.request.frequency_penalty, gen_ai.request.presence_penalty, and gen_ai.request.stop_sequences on the LLM span when the corresponding RuntimeConfig field is set (per observability §5.5.2's expanded attribute list). RuntimeConfig.from_partial(**kwargs) classmethod is a pure Python ergonomic that drops None-valued kwargs before construction. The wire layer already null-skips, so this is convenience only. Spec submodule bumped to v0.24.0; conformance.toml grows entries for proposals 0031 (langfuse mapping, not-yet) and 0032 (not-yet here, flips to implemented with since=0.10.0 in the release PR). Tests: fixture llm-provider/032 and observability/025 pass. Langfuse fixtures 022-024 deferred in the parser harness until PR 3 ships the matching directive model.
There was a problem hiding this comment.
Pull request overview
Implements spec proposal 0032 (v0.24.0) by expanding RuntimeConfig’s declared sampling parameters, ensuring declared-field null-skip behavior on the OpenAI wire mapping, and extending observability/conformance coverage accordingly.
Changes:
- Promote
frequency_penalty,presence_penalty, andstop_sequencesto declaredRuntimeConfigfields and addRuntimeConfig.from_partial(...). - Update OpenAI provider request building to map
stop_sequences→stopand omitNonefor all declared fields; extend OTel emission for the new request params. - Bump pinned spec version to v0.24.0 and extend conformance harness/tests/docs for the new surface.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_llm_provider.py | Adds unit tests for RuntimeConfig.from_partial. |
| tests/test_smoke.py | Updates spec version assertion to 0.24.0. |
| tests/conformance/test_observability.py | Extends fixture allowlist and runtime-config parsing for new fields. |
| tests/conformance/test_llm_provider.py | Adds generic <field>_absent wire assertions and flattens config.extras into RuntimeConfig extras. |
| tests/conformance/test_fixture_parsing.py | Defers Langfuse fixtures until the next PR’s harness lands. |
| tests/conformance/harness/directives.py | Extends RuntimeConfigSpec with the three new declared fields. |
| src/openarmature/observability/otel/observer.py | Emits new gen_ai.request.* attributes when set. |
| src/openarmature/llm/response.py | Adds new declared fields and RuntimeConfig.from_partial. |
| src/openarmature/llm/providers/openai.py | Adds null-skip and wire mapping for the new fields; surfaces new request params to observer. |
| src/openarmature/AGENTS.md | Updates embedded spec version and observability text to reflect v0.24.0. |
| src/openarmature/init.py | Bumps __spec_version__ to 0.24.0. |
| pyproject.toml | Bumps [tool.openarmature].spec_version to 0.24.0. |
| docs/concepts/observability.md | Documents the expanded request parameter attribute list and updates extras examples. |
| conformance.toml | Pins spec_pin to v0.24.0 and adds proposal stubs for 0031/0032. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The is-None assertions on max_tokens and seed weren't load-bearing: both fields default to None on a base RuntimeConfig, so the test would have passed even if from_partial forwarded the None kwargs. Added model_fields_set assertions, which carry only fields the caller explicitly set during construction, to prove the drop. Addresses CoPilot PR review feedback on #78.
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
Implements proposal 0032 (spec v0.24.0) — RuntimeConfig surface refinements.
RuntimeConfig:frequency_penalty,presence_penalty,stop_sequences.stop_sequencesmatches the OpenTelemetry GenAI semconv and Anthropic / Gemini wire-key conventions; the OpenAI-compatible wire mapping translates it to OpenAI's shorter body keystopon emission (per §8.1's only rename).Noneis omitted from the wire body, never serialized as JSON null.gen_ai.request.frequency_penalty/presence_penalty/stop_sequenceson the LLM span when set, per observability §5.5.2's expanded attribute list. The §8.4.3 Langfuse mapping picks them up by inclusion when PR 3 lands.RuntimeConfig.from_partial(**kwargs)classmethod dropsNone-valued kwargs before construction. Pure Python ergonomic; wire layer already null-skips.Spec submodule bumped from v0.22.1 to v0.24.0.
conformance.tomlgrows entries for proposals 0031 (Langfuse mapping,not-yet) and 0032 (not-yethere; flips toimplementedwithsince = "0.10.0"in the release PR). The Langfuse fixtures 022-024 are deferred in the fixture-parser harness until PR 3 ships the matching directive model.First of 6 PRs in the v0.10.0 batch. Sequence + plan are in
04-python-batched-impl-plan.mdin the coord repo. Spec greenlit in msg 05.Test plan
llm-provider/032-runtime-config-declared-fields-and-null-skip(two cases: all seven set + extras, partial config null-skip) andobservability/025-otel-llm-request-params-extendedpython3 scripts/check_conformance_manifest.pyexits 0 (28 accepted proposals, 28 manifest entries)from_partialunit tests: drops Nones, forwards extras, empty kwargs OK