Skip to content

v0.1.5 — TRACE 0.5.x runtime alignment

Choose a tag to compare

@latenceainew latenceainew released this 07 May 07:47
· 8 commits to main since this release

Highlights

This release brings the SDK into full alignment with the TRACE 0.5.x runtime + RunPod handler. Every wire shape that production callers consume (groundedness scoring, redaction, compression, memory, rollup) now has a typed Pydantic model that mirrors the server schema field-for-field.

Behavior fixes (callers see immediately)

  • RunPod error envelope decoded. _envelope_from_body now accepts error_code/error (the keys the RunPod handler emits via _service_error_payload) in addition to the REST code/message shape. Pre-0.1.5 SDKs silently degraded RunPod failures to HTTP {status}.
  • language is the canonical request field. GroundednessRequest.language now drives the per-class calibration bundle. locale becomes a deprecated alias kept for back-compat — pre-0.1.5 callers using locale had their language hint silently dropped server-side.
  • RunPod default response_format=canonical. The typed GroundednessResponse now populates nested scores / runtime_decision / corpus_route blocks instead of receiving the flat compact dict (which left most typed fields at None). Override by passing response_format="compact" explicitly.
  • First-class scoring kwargs. score_groundedness exposes profile, response_format, include_triangular_diagnostics, evidence_limit, heatmap_format, auto_decide directly (still allows extra= for forward-compat).
  • rollup() shape is consistent. REST and RunPod transports now return the same metrics dict — the RunPod {success, action, rollup: {...}, version} envelope is unwrapped into the canonical metrics shape. Pass as_model=True to receive the new typed RollupResponse.
  • 422 detail lists (FastAPI validator errors) now surface a useful message (validation error at body.response_text: Field required) instead of HTTP 422.

Typed model parity bumps

  • RuntimeDecision adds band, policy_version, policy_sha256, head_registry_sha256, head_version, reason_codes, evidence (typed RuntimeEvidenceUnit), unsupported_spans (typed RuntimeUnsupportedSpan), allow_disabled, block_disabled, allow_threshold, block_threshold, rollback_safe — full RuntimeDecisionRecord parity, including the new calibration_band_coercion:red reason code.
  • GroundednessScores adds nli_aggregate, primary_score/primary_name, reverse_context*, semantic_entropy_*, literal_*, structured_*, context_*_ratio, support_units_usage_*, AST/phantom code-lane channels.
  • GroundednessResponse adds top-level band/score/groundedness_v2, corpus_route (typed), heatmap, warnings, scoring_mode, profile, effective_profile, session_id, *_diagnostics, next_session_state/next_memory_state.
  • MemoryUpdateResponse.hot_context is now required (server contract guarantees it); CompressionResponse.provider stays Optional[str].
  • New RollupResponse, RollupTopDeadFile, RollupDriftTrend, CorpusRoute, RuntimeEvidenceUnit, RuntimeUnsupportedSpan exported at the package root.

Helper updates

  • GroundednessResponse.fill_native_risk_band promotes risk_band from scores.risk_band → top-level band → runtime_decision.band (priority order matches the new backend coercion).
  • integrations._band_utils.resolve_band / resolve_score prefer the calibration risk_band / trace_score over the head-driven runtime_decision.band / decision.score, so adapter consumers render the same band the event log shows.

Deferred to a future release

  • Typed RunPod action mappings for the nine /v1/trace/sessions* paths (session.create/get/event/score/context/source/repair/rollup/close). Those need typed session models and live outside the groundedness/rollup hot path — best done as a focused 0.2.0 surface bump.

Tests

41 unit tests passing (27 existing + 14 new alignment regressions covering: error envelope decoding, 422 detail-list parsing, language alias + conflict guard, first-class kwargs, RunPod canonical default, REST no-default, RunPod rollup normalization, REST rollup typed model, full runtime_decision typing with calibration_band_coercion, expanded GroundednessScores, compact band/score promotion, and _band_utils priority).

Install

pip install -U latence==0.1.5