Summary
When a model is not in the token table, the graph warns once to stderr and then proceeds with an 8192-token window. For a model with a 1M-token context this silently truncates every non-trivial page, changing the answer without failing, without appearing in the returned object, and without any indication in execution_info.
Max input tokens for model google_genai/gemini-2.5-flash not found, please specify
the model_tokens parameter in the llm section of the graph configuration.
Using default token size: 8192
Why the default is the problem
A silent 8192 window is a plausible answer generator. The run succeeds, the JSON validates, the fields look reasonable — and the model simply never saw the part of the page that mattered. On a long privacy policy or a services page, the extracted answer flips based on where the truncation landed.
Two properties make it easy to miss:
- the warning is on stderr, so it vanishes in any batch/worker/async context — I hit this inside a 15-agent pipeline where nothing surfaced it
- it is emitted once per process, not once per run, so a long job warns on the first URL and stays silent for the remaining hundreds
What I'd suggest, in preference order
- Raise when
model_tokens is absent for an unknown model, with the message telling the user to set it. Loud beats quietly wrong for something that changes results.
- If a hard raise is too breaking, keep the fallback but put it in the result — e.g.
execution_info["truncated"] = True plus the effective window — so downstream code can detect it.
- Failing both, make the default large rather than small. An over-long prompt fails visibly at the provider; an over-short one fails invisibly.
- Independently:
gemini-2.5-flash / gemini-flash-latest are worth adding to the token table — Google's current flash line is 1M input.
Related
#1099 / #1002 cover model_tokens being rejected on some provider paths. This is the opposite case: it is accepted, absent, and silently defaulted.
Environment
scrapegraphai fresh from PyPI, Python 3.13, macOS, langchain-google-genai (note: not bundled — installing it is a required extra step for Google backends), Playwright chromium headless.
Happy to open a PR for (1) or (2) if you indicate which you'd accept.
Summary
When a model is not in the token table, the graph warns once to stderr and then proceeds with an 8192-token window. For a model with a 1M-token context this silently truncates every non-trivial page, changing the answer without failing, without appearing in the returned object, and without any indication in
execution_info.Why the default is the problem
A silent 8192 window is a plausible answer generator. The run succeeds, the JSON validates, the fields look reasonable — and the model simply never saw the part of the page that mattered. On a long privacy policy or a services page, the extracted answer flips based on where the truncation landed.
Two properties make it easy to miss:
What I'd suggest, in preference order
model_tokensis absent for an unknown model, with the message telling the user to set it. Loud beats quietly wrong for something that changes results.execution_info["truncated"] = Trueplus the effective window — so downstream code can detect it.gemini-2.5-flash/gemini-flash-latestare worth adding to the token table — Google's current flash line is 1M input.Related
#1099/#1002covermodel_tokensbeing rejected on some provider paths. This is the opposite case: it is accepted, absent, and silently defaulted.Environment
scrapegraphaifresh from PyPI, Python 3.13, macOS,langchain-google-genai(note: not bundled — installing it is a required extra step for Google backends), Playwright chromium headless.Happy to open a PR for (1) or (2) if you indicate which you'd accept.