Skip to content

Releases: ddickmann/latence-trace-python

v0.2.0 — Gateway-first SDK

Choose a tag to compare

@latenceainew latenceainew released this 09 May 11:16

Breaking changes

  • SDK now targets api.latence.ai gateway — no more direct RunPod calls
  • Removed code(), rollup(), memory_step(), and session APIs
  • Removed TraceSession, CodeScoringResponse, RollupResponse exports

New

  • Privacy endpoint: trace.privacy.redact() — detect and redact 50+ GDPR entity types
  • Compression endpoint: trace.compression.text() — reduce context tokens while preserving meaning
  • All three endpoints (grounding, privacy, compression) go through the api.latence.ai gateway
  • Tolerant response models that handle partial data from the gateway gracefully

Fixes

  • AsyncLatence parity with the sync client
  • ComplianceUsage, ComplianceRedactionResponse, and CompressionResponse models accept optional fields

Install

pip install latence==0.2.0

v0.1.6

Choose a tag to compare

@latenceainew latenceainew released this 07 May 09:52

What's New

Typed NLI Claim/Atom Models

  • GroundednessNLIAtom, GroundednessNLIClaim, GroundednessNLIDiagnostics are now first-class SDK types
  • GroundednessResponse.nli_diagnostics is now typed as GroundednessNLIDiagnostics (was untyped Mapping)
  • Each claim/atom carries a band field (green/amber/red/skipped) from the server-stamped contradiction-aware verdict

Rollup Schema Alignment

  • RollupDriftTrend now matches backend DriftTrend with min, max, mean, last (was slope/segments)
  • RollupTopDeadFile now matches backend with path, dead_turns, ema_owner_share (was coverage/owner_share/reason_codes)

Full Changelog

v0.1.5...v0.1.6

v0.1.5 — TRACE 0.5.x runtime alignment

Choose a tag to compare

@latenceainew latenceainew released this 07 May 07:47

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

latence 0.1.4

Choose a tag to compare

@latenceainew latenceainew released this 05 May 08:26

First TRACE-focused release of the latence Python SDK on the existing 0.1.x package line.

Highlights

  • Publishes the standalone latence package from latence-trace-python.
  • Adds Latence and AsyncLatence as the primary sync/async clients.
  • Surfaces TRACE product paths directly: privacy, grounding, compression, memory, rollup, and SDK-managed sessions.
  • Keeps LatenceTraceClient and AsyncLatenceTraceClient as migration aliases.
  • Keeps runtime/model dependencies out of the wheel; base dependencies are only httpx and pydantic.

Verification

  • python -m pytest
  • python -m ruff check .
  • SDK/runtime manifest contract check
  • python -m build
  • python -m twine check dist/*
  • Clean-wheel dependency smoke outside the repo root