fix(providers): clamp max_tokens to >= 1 before calling LiteLLM (#523)

This commit is contained in:
The Mavik 2026-02-13 17:08:10 -05:00
parent bc045fae1f
commit 10e9e0cdc9

View File

@ -122,6 +122,10 @@ class LiteLLMProvider(LLMProvider):
"""
model = self._resolve_model(model or self.default_model)
# Clamp max_tokens to at least 1 — negative or zero values cause
# LiteLLM to reject the request with "max_tokens must be at least 1".
max_tokens = max(1, max_tokens)
kwargs: dict[str, Any] = {
"model": model,
"messages": messages,