Spaces:
Runtime error
Runtime error
Update graph_builder.py
Browse files- graph_builder.py +2 -1
graph_builder.py
CHANGED
|
@@ -712,6 +712,7 @@ def build_document_extraction_graph():
|
|
| 712 |
workflow.add_edge("store_in_knowledge_base", END)
|
| 713 |
|
| 714 |
# Handle errors - any node can output an error
|
|
|
|
| 715 |
for node in workflow.nodes:
|
| 716 |
# Check if status is error, if yes, go to END
|
| 717 |
workflow.add_conditional_edges(
|
|
@@ -719,7 +720,7 @@ def build_document_extraction_graph():
|
|
| 719 |
lambda state: "status" in state and state["status"] == "error",
|
| 720 |
{
|
| 721 |
True: END,
|
| 722 |
-
False: None
|
| 723 |
}
|
| 724 |
)
|
| 725 |
|
|
|
|
| 712 |
workflow.add_edge("store_in_knowledge_base", END)
|
| 713 |
|
| 714 |
# Handle errors - any node can output an error
|
| 715 |
+
# FIX: Properly define the conditional edges to handle errors
|
| 716 |
for node in workflow.nodes:
|
| 717 |
# Check if status is error, if yes, go to END
|
| 718 |
workflow.add_conditional_edges(
|
|
|
|
| 720 |
lambda state: "status" in state and state["status"] == "error",
|
| 721 |
{
|
| 722 |
True: END,
|
| 723 |
+
False: workflow.get_next_node(node) if node != "store_in_knowledge_base" else None
|
| 724 |
}
|
| 725 |
)
|
| 726 |
|