Skip to content

Add RuntimeConfig declared fields + null-skip (proposal 0032)#78

Merged
chris-colinsky merged 2 commits into
mainfrom
feature/runtime-config-expansion
May 27, 2026
Merged

Add RuntimeConfig declared fields + null-skip (proposal 0032)#78
chris-colinsky merged 2 commits into
mainfrom
feature/runtime-config-expansion

Conversation

@chris-colinsky
Copy link
Copy Markdown
Member

@chris-colinsky chris-colinsky commented May 27, 2026

Summary

Implements proposal 0032 (spec v0.24.0) — RuntimeConfig surface refinements.

  • Three OpenAI-standard sampling parameters promoted from extras to declared fields on RuntimeConfig: frequency_penalty, presence_penalty, 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 §8.1's only rename).
  • Null-skip uniform across all seven declared fields: None is omitted from the wire body, never serialized as JSON null.
  • OTel observer emits gen_ai.request.frequency_penalty / presence_penalty / stop_sequences on 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 drops None-valued kwargs before construction. Pure Python ergonomic; wire layer already null-skips.

Spec submodule bumped from v0.22.1 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). 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.md in the coord repo. Spec greenlit in msg 05.

Test plan

  • CI green (lint, format, types, conformance, unit, smoke, agents-md drift)
  • New conformance fixtures pass: llm-provider/032-runtime-config-declared-fields-and-null-skip (two cases: all seven set + extras, partial config null-skip) and observability/025-otel-llm-request-params-extended
  • Existing 826 tests unaffected
  • python3 scripts/check_conformance_manifest.py exits 0 (28 accepted proposals, 28 manifest entries)
  • from_partial unit tests: drops Nones, forwards extras, empty kwargs OK

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.
Copilot AI review requested due to automatic review settings May 27, 2026 06:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and stop_sequences to declared RuntimeConfig fields and add RuntimeConfig.from_partial(...).
  • Update OpenAI provider request building to map stop_sequencesstop and omit None for 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.

Comment thread tests/unit/test_llm_provider.py
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.
@chris-colinsky chris-colinsky merged commit d23e3ab into main May 27, 2026
6 checks passed
@chris-colinsky chris-colinsky deleted the feature/runtime-config-expansion branch May 27, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants