Skip to content

Python scraper based on AI

removed unused imports

Marco Vinciguerra203ee2c1862a
diff --git a/scrapegraphai/builders/graph_builder.py b/scrapegraphai/builders/graph_builder.py
index e807a0df..303f1457 100644
--- a/scrapegraphai/builders/graph_builder.py
+++ b/scrapegraphai/builders/graph_builder.py
@@ -4,10 +4,9 @@ GraphBuilder Module
from langchain_core.prompts import ChatPromptTemplate
from langchain.chains import create_extraction_chain
-from ..models import OpenAI, Gemini
+from ..models import Gemini
from ..helpers import nodes_metadata, graph_schema
-from ..models.ernie import Ernie
-
+from langchain_openai import ChatOpenAI
class GraphBuilder:
"""
@@ -71,7 +70,7 @@ class GraphBuilder:
# select the model based on the model name
if "gpt-" in llm_params["model"]:
- return OpenAI(llm_params)
+ return ChatOpenAI(llm_params)
elif "gemini" in llm_params["model"]:
return Gemini(llm_params)
elif "ernie" in llm_params["model"]:
diff --git a/scrapegraphai/graphs/abstract_graph.py b/scrapegraphai/graphs/abstract_graph.py
index eecd2297..c08472da 100644
--- a/scrapegraphai/graphs/abstract_graph.py
+++ b/scrapegraphai/graphs/abstract_graph.py
@@ -135,7 +135,6 @@ class AbstractGraph(ABC):
raise KeyError("model_tokens not specified") from exc
return llm_params["model_instance"]
- # Instantiate the language model based on the model name (models that use the common interface)
def handle_model(model_name, provider, token_key, default_token=8192):
try:
self.model_token = models_tokens[provider][token_key]