Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions scrapegraphai/graphs/abstract_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ def _create_llm(self, llm_config: dict):
llm_params["model"] = llm_params["model"].split("/")[-1]

# allow user to set model_tokens in config
if "model_tokens" in llm_params:
self.model_token = llm_params["model_tokens"]
elif llm_params["model"] in models_tokens["ollama"]:
try:
self.model_token = models_tokens["ollama"][llm_params["model"]]
except KeyError:
raise KeyError("Model not supported")
try:
if "model_tokens" in llm_params:
self.model_token = llm_params["model_tokens"]
elif llm_params["model"] in models_tokens["ollama"]:
try:
self.model_token = models_tokens["ollama"][llm_params["model"]]
except KeyError:
raise KeyError("Model not supported")
else:
self.model_token = 8192
except AttributeError:
self.model_token = 8192

return Ollama(llm_params)
elif "hugging_face" in llm_params["model"]:
Expand Down
3 changes: 3 additions & 0 deletions scrapegraphai/helpers/models_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@
"dolphin-mixtral": 32000,
"mistral-openorca": 32000,
"stablelm-zephyr": 8192
},
"gemma": {
"gemma": 8192,
}
}