Merge pull request #617 from themavik/fix/523-clamp-max-tokens
fix(providers): clamp max_tokens to >= 1 before calling LiteLLM
This commit is contained in:
commit
3411035447
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user