From 3876cb7be86e081065ca18c443647261a4b205d1 Mon Sep 17 00:00:00 2001 From: Marco Vinciguerra Date: Tue, 24 Sep 2024 09:35:33 +0200 Subject: [PATCH] feat: update exception Co-Authored-By: Federico Aguzzi <62149513+f-aguzzi@users.noreply.github.com> --- scrapegraphai/graphs/abstract_graph.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scrapegraphai/graphs/abstract_graph.py b/scrapegraphai/graphs/abstract_graph.py index c8c0ba72..b546460f 100644 --- a/scrapegraphai/graphs/abstract_graph.py +++ b/scrapegraphai/graphs/abstract_graph.py @@ -154,12 +154,13 @@ class AbstractGraph(ABC): try: self.model_token = models_tokens[llm_params["model_provider"]][llm_params["model"]] except KeyError: - print(f"""Model {llm_params['model_provider']}/{llm_params['model']} not found, + print(f"""Model {llm_params['model_provider']}/{llm_params['model']} not found, using default token size (8192)""") self.model_token = 8192 try: - if llm_params["model_provider"] not in {"oneapi","nvidia","ernie","deepseek","togetherai"}: + if llm_params["model_provider"] not in \ + {"oneapi","nvidia","ernie","deepseek","togetherai"}: if llm_params["model_provider"] == "bedrock": llm_params["model_kwargs"] = { "temperature" : llm_params.pop("temperature") } with warnings.catch_warnings(): @@ -195,7 +196,7 @@ class AbstractGraph(ABC): return ChatNVIDIA(**llm_params) except Exception as e: - print(f"Error instancing model: {e}") + raise Exception(f"Error instancing model: {e}") def get_state(self, key=None) -> dict: