Skip to content

Python scraper based on AI

fix model_tokens not being used for ollama

Jamie Beck35b994a8cd20
diff --git a/scrapegraphai/graphs/abstract_graph.py b/scrapegraphai/graphs/abstract_graph.py
index ae1e90b2..e76a2ed7 100644
--- a/scrapegraphai/graphs/abstract_graph.py
+++ b/scrapegraphai/graphs/abstract_graph.py
@@ -174,8 +174,9 @@ class AbstractGraph(ABC):
elif "ollama" in llm_params["model"]:
model_name = llm_params["model"].split("ollama/")[-1]
- token_key = model_name if "model_tokens" not in llm_params else llm_params["model_tokens"]
- return handle_model(model_name, "ollama", token_key)
+ token_key = model_name if "model_tokens" not in llm_params else None
+ explicit_model_tokens = 8192 if "model_tokens" not in llm_params else llm_params["model_tokens"]
+ return handle_model(model_name, "ollama", token_key, explicit_model_tokens)
elif "claude-3-" in llm_params["model"]:
return handle_model(llm_params["model"], "anthropic", "claude3")
@@ -271,4 +272,4 @@ class AbstractGraph(ABC):
def run(self) -> str:
"""
Abstract method to execute the graph and return the result.
- """
\ No newline at end of file
+ """