INNER CODE UNIT · Python
_parse_thinking_budget
TianGzlab/OmicsClaw · omicsclaw/surfaces/desktop/server.py:550
def _parse_thinking_budget(thinking: dict) -> int:
budget = thinking.get("budgetTokens", _DEFAULT_THINKING_BUDGET)
try:
return int(budget)
except (TypeError, ValueError):
return _DEFAULT_THINKING_BUDGET
def _build_thinking_extra_body(
thinking: Any,
*,
provider: str = "",
model: str = "",
) -> dict[str, Any] | None:
"""Normalize optional thinking controls for provider-compatible requests.
The ``adaptive`` thinking type is a frontend UX concept, not a portable
provider contract. This function resolves it to a concrete action based