Executes the graph by either using BurrBridge or the standard method. Args: initial_state (dict): The initial state to pass to the entry point node. Returns: Tuple[dict, list]: A tuple containing the final state and a list of execution info.
(self, initial_state: dict)
| 342 | return state, exec_info |
| 343 | |
| 344 | def execute(self, initial_state: dict) -> Tuple[dict, list]: |
| 345 | """ |
| 346 | Executes the graph by either using BurrBridge or the standard method. |
| 347 | |
| 348 | Args: |
| 349 | initial_state (dict): The initial state to pass to the entry point node. |
| 350 | |
| 351 | Returns: |
| 352 | Tuple[dict, list]: A tuple containing the final state and a list of execution info. |
| 353 | """ |
| 354 | |
| 355 | self.initial_state = initial_state |
| 356 | if self.use_burr: |
| 357 | from ..integrations import BurrBridge |
| 358 | |
| 359 | bridge = BurrBridge(self, self.burr_config) |
| 360 | result = bridge.execute(initial_state) |
| 361 | state, exec_info = (result["_state"], []) |
| 362 | else: |
| 363 | state, exec_info = self._execute_standard(initial_state) |
| 364 | |
| 365 | if "answer" in state: |
| 366 | logger.info(state["answer"]) |
| 367 | elif "parsed_doc" in state: |
| 368 | logger.info(state["parsed_doc"]) |
| 369 | elif "generated_code" in state: |
| 370 | logger.info(state["generated_code"]) |
| 371 | elif "merged_script" in state: |
| 372 | logger.info(state["merged_script"]) |
| 373 | |
| 374 | logger.info("✨ Try enhanced version of ScrapegraphAI at %s ✨", CLICKABLE_URL) |
| 375 | |
| 376 | return state, exec_info |
| 377 | |
| 378 | def append_node(self, node): |
| 379 | """ |