Skip to content

Commit 034cfd5

Browse files
dylanpfirnclaude
andcommitted
fix: pop model_tokens so it is not forwarded to the model client
On the plain llm-config path, _create_llm read model_tokens but never removed it from llm_params, so it was splatted into init_chat_model and forwarded to the client. With ChatOpenAI (any OpenAI-compatible base_url) this surfaced as: Completions.create() got an unexpected keyword argument 'model_tokens'. Pop the key after consuming it, matching the model_instance path which already returns before the key can leak. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9ad7e84 commit 034cfd5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

scrapegraphai/graphs/abstract_graph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ def _create_llm(self, llm_config: dict) -> object:
221221
else:
222222
self.model_token = llm_params["model_tokens"]
223223

224+
# Consumed by ScrapeGraphAI; must not be forwarded to the model client.
225+
llm_params.pop("model_tokens", None)
226+
224227
try:
225228
if llm_params["model_provider"] not in {
226229
"oneapi",

0 commit comments

Comments
 (0)