refactor(providers): drop unreachable GenerationSettings fallback

This commit is contained in:
04cb
2026-04-15 23:52:38 +08:00
committed by Xubin Ren
parent 54f7ad3752
commit eacc9fbb5f
2 changed files with 1 additions and 27 deletions
+1 -10
View File
@@ -514,12 +514,8 @@ class LLMProvider(ABC):
"""Call chat_stream() with retry on transient provider failures."""
if max_tokens is self._SENTINEL or max_tokens is None:
max_tokens = self.generation.max_tokens
if max_tokens is None:
max_tokens = GenerationSettings.max_tokens
if temperature is self._SENTINEL or temperature is None:
temperature = self.generation.temperature
if temperature is None:
temperature = GenerationSettings.temperature
if reasoning_effort is self._SENTINEL:
reasoning_effort = self.generation.reasoning_effort
@@ -554,19 +550,14 @@ class LLMProvider(ABC):
Parameters default to ``self.generation`` when not explicitly passed,
so callers no longer need to thread temperature / max_tokens /
reasoning_effort through every layer. Explicit ``None`` is also
normalized to the provider's generation defaults, with a final fallback
to :class:`GenerationSettings` class defaults so that downstream
normalized to the provider's generation defaults so that downstream
``_build_kwargs`` never sees ``None`` for ``max_tokens`` / ``temperature``
(which would crash ``max(1, max_tokens)``).
"""
if max_tokens is self._SENTINEL or max_tokens is None:
max_tokens = self.generation.max_tokens
if max_tokens is None:
max_tokens = GenerationSettings.max_tokens
if temperature is self._SENTINEL or temperature is None:
temperature = self.generation.temperature
if temperature is None:
temperature = GenerationSettings.temperature
if reasoning_effort is self._SENTINEL:
reasoning_effort = self.generation.reasoning_effort