Skip to content

Commit 9e9f8f0

Browse files
committed
removed max depth
1 parent 9483afd commit 9e9f8f0

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

scrapegraphai/graphs/base_graph.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,21 @@ def execute(self, initial_state: dict) -> Tuple[dict, list]:
132132
cb_total["successful_requests"] += cb["successful_requests"]
133133
cb_total["total_cost_USD"] += cb["total_cost_USD"]
134134

135-
# Do not execute the graph from this point on if previous node gave a signal
136-
if 'skip_branch' in result:
137-
print(f"---- Not executing sub-graph since {current_node.node_name} \
138-
raised a stop signal ---")
139-
elif current_node in self.edges:
140-
current_node_connections = self.edges[current_node]
141-
if current_node.node_type == 'conditional_node':
135+
136+
137+
current_node_connections = self.edges[current_node]
138+
if current_node.node_type == 'conditional_node':
142139
# Assert that there are exactly two out edges from the conditional node
143-
if len(current_node_connections) != 2:
144-
raise ValueError(f"Conditional node should have exactly two out connections {current_node_connections.node_name}")
145-
if result["next_node"] == 0:
146-
queue.append(current_node_connections[0])
147-
else:
148-
queue.append(current_node_connections[1])
140+
if len(current_node_connections) != 2:
141+
raise ValueError(f"Conditional node should have exactly two out connections {current_node_connections.node_name}")
142+
if result["next_node"] == 0:
143+
queue.append(current_node_connections[0])
144+
else:
145+
queue.append(current_node_connections[1])
149146
# remove the conditional node result
150147
del result["next_node"]
151-
else:
152-
queue.extend(node for node in current_node_connections)
148+
else:
149+
queue.extend(node for node in current_node_connections)
153150

154151

155152
exec_info.append({

scrapegraphai/nodes/graph_iterator_node.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,6 @@ async def _async_execute(self, state: dict, batchsize: int) -> dict:
110110
else:
111111
graph_instance.config["graph_depth"] = 1
112112

113-
# Check if max depth is reached
114-
if "max_depth" in graph_instance.config and \
115-
graph_instance.config["graph_depth"] > graph_instance.config["max_depth"]:
116-
print("Max search depth is reached. Terminating search")
117-
state.update({"skip_branch": "True"})
118-
return state
119-
120-
# sets the prompt for the graph instance
121113
graph_instance.prompt = user_prompt
122114

123115
participants = []

0 commit comments

Comments
 (0)