src/reasoning-translation
Generic reasoning-budget translation for Model Serving and gateway callers.
Provider wires disagree on effort labels (xhigh, ultra, med, none, …).
This module owns one industry-shaped ladder and two parsers:
- parseReasoning: fuzzy-match one label onto ReasoningLevel
- parseReasoningLevels: unwrap nested / double-encoded error bodies
- remapReasoning / adaptRequestReasoning: map a request onto a
supported ladder and rewrite
reasoning_effort/reasoning.effort
Documented model ladders come from the committed HTML snapshot refreshed by
bun run --filter '@dbx-tools/model' metadata (same cache path as
capabilities / rate limits). Error-body parsing is never cached; callers
persist learned ladders via the metadata module.
Error bodies arrive as complete HTTP JSON whether the request asked for streaming or not (Databricks rejects unsupported efforts with 400 before SSE starts), so parseReasoningLevels applies to both paths.