feat(llm): add a configurable output-token cap

- some model/gateway combinations emit unbounded reasoning/output and hang or
  trip an idle timeout (e.g. some deepseek-v4-flash deployments)
- add an opt-in max_tokens config knob + TRADINGAGENTS_MAX_TOKENS, forwarded to
  every provider when set (Gemini takes it as max_output_tokens); int-coerced,
  rejects non-positive/boolean values #1204
This commit is contained in:
Yijia-Xiao
2026-08-30 06:26:57 +00:00
parent 539eae8fd6
commit 0ef56e6a33
6 changed files with 155 additions and 2 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ class MinimaxChatOpenAI(NormalizedChatOpenAI):
# Kwargs forwarded from user config to ChatOpenAI
_PASSTHROUGH_KWARGS = (
"timeout", "max_retries", "reasoning_effort", "temperature",
"timeout", "max_retries", "reasoning_effort", "temperature", "max_tokens",
"api_key", "callbacks", "http_client", "http_async_client",
)