Spaces:
Runtime error
Runtime error
Update utils/langgraph_pipeline.py
Browse files- utils/langgraph_pipeline.py +8 -12
utils/langgraph_pipeline.py
CHANGED
@@ -19,16 +19,15 @@ state_schema = {
|
|
19 |
"chat_log": list,
|
20 |
}
|
21 |
|
22 |
-
#
|
23 |
-
pm_node = ToolNode
|
24 |
-
proj_node = ToolNode
|
25 |
-
arch_node = ToolNode
|
26 |
-
dev_node = ToolNode
|
27 |
-
qa_node = ToolNode
|
28 |
-
|
29 |
-
#
|
30 |
graph = StateGraph(state_schema)
|
31 |
-
|
32 |
graph.add_node("ProductManager", pm_node)
|
33 |
graph.add_node("ProjectManager", proj_node)
|
34 |
graph.add_node("SoftwareArchitect", arch_node)
|
@@ -42,15 +41,12 @@ graph.add_edge("SoftwareArchitect", "SoftwareEngineer")
|
|
42 |
graph.add_edge("SoftwareEngineer", "QualityAssurance")
|
43 |
graph.add_edge("QualityAssurance", END)
|
44 |
|
45 |
-
# Compile it
|
46 |
compiled_graph = graph.compile()
|
47 |
|
48 |
-
# Define the wrapper
|
49 |
def run_pipeline_and_save(prompt: str):
|
50 |
initial_state = {
|
51 |
"input": prompt,
|
52 |
"chat_log": [],
|
53 |
}
|
54 |
final_state = compiled_graph.invoke(initial_state)
|
55 |
-
|
56 |
return final_state["chat_log"], final_state["qa_output"]
|
|
|
19 |
"chat_log": list,
|
20 |
}
|
21 |
|
22 |
+
# Define the ToolNodes directly
|
23 |
+
pm_node = ToolNode(product_manager_agent.run)
|
24 |
+
proj_node = ToolNode(project_manager_agent.run)
|
25 |
+
arch_node = ToolNode(software_architect_agent.run)
|
26 |
+
dev_node = ToolNode(software_engineer_agent.run)
|
27 |
+
qa_node = ToolNode(quality_assurance_agent.run)
|
28 |
+
|
29 |
+
# Build the graph
|
30 |
graph = StateGraph(state_schema)
|
|
|
31 |
graph.add_node("ProductManager", pm_node)
|
32 |
graph.add_node("ProjectManager", proj_node)
|
33 |
graph.add_node("SoftwareArchitect", arch_node)
|
|
|
41 |
graph.add_edge("SoftwareEngineer", "QualityAssurance")
|
42 |
graph.add_edge("QualityAssurance", END)
|
43 |
|
|
|
44 |
compiled_graph = graph.compile()
|
45 |
|
|
|
46 |
def run_pipeline_and_save(prompt: str):
|
47 |
initial_state = {
|
48 |
"input": prompt,
|
49 |
"chat_log": [],
|
50 |
}
|
51 |
final_state = compiled_graph.invoke(initial_state)
|
|
|
52 |
return final_state["chat_log"], final_state["qa_output"]
|