Skip to content

bugfix: ScriptCreatorGraph verbose settings + RobotsNode handling model IDs #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 20, 2024
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
11 changes: 5 additions & 6 deletions scrapegraphai/graphs/abstract_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,18 @@ def __init__(self, prompt: str, config: dict, source: Optional[str] = None):
self.embedder_model = self._create_default_embedder(llm_config=config["llm"]
) if "embeddings" not in config else self._create_embedder(
config["embeddings"])
self.verbose = False if config is None else config.get(
"verbose", False)
self.headless = True if config is None else config.get(
"headless", True)
self.loader_kwargs = config.get("loader_kwargs", {})

# Create the graph
self.graph = self._create_graph()
self.final_state = None
self.execution_info = None

# Set common configuration parameters
self.verbose = False if config is None else config.get(
"verbose", False)
self.headless = True if config is None else config.get(
"headless", True)
self.loader_kwargs = config.get("loader_kwargs", {})

common_params = {"headless": self.headless,
"verbose": self.verbose,
"loader_kwargs": self.loader_kwargs,
Expand Down
5 changes: 3 additions & 2 deletions scrapegraphai/nodes/robots_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ def execute(self, state: dict) -> dict:
base_url = f"{parsed_url.scheme}://{parsed_url.netloc}"
loader = AsyncChromiumLoader(f"{base_url}/robots.txt")
document = loader.load()
if "ollama" in self.llm_model.model_name:
if hasattr(self.llm_model, "model_name") and "ollama" in self.llm_model.model_name:
self.llm_model.model_name = self.llm_model.model_name.split("/")[-1]
model = self.llm_model.model_name.split("/")[-1]

elif hasattr(self.llm_model, "model_id"): # Bedrock uses model IDs, not model names
model = self.llm_model.model_id.split("/")[-1]
else:
model = self.llm_model.model_name
try:
Expand Down