@@ -283,6 +283,14 @@ def from_cypher(self, cypher_query: str) -> Optional["GraphProgram"]:
283283 if step_type == "Control" :
284284 self .add (Control (id = step_props ["id" ]))
285285 elif step_type == "Action" :
286+ if "id" not in step_props :
287+ raise ValueError (f"{ step_id } Action node should have \" { step_id } \" in its id field" )
288+ if "purpose" not in step_props :
289+ raise ValueError (f"{ step_id } Action node should have a purpose field" )
290+ if "tool" not in step_props :
291+ raise ValueError (f"{ step_id } Action node should have a tool field" )
292+ if "prompt" not in step_props :
293+ raise ValueError (f"{ step_id } Action node should have a prompt field" )
286294 self .add (Action (
287295 id = step_props ["id" ],
288296 purpose = step_props ["purpose" ],
@@ -293,13 +301,25 @@ def from_cypher(self, cypher_query: str) -> Optional["GraphProgram"]:
293301 disable_inference = True if "disable_inference" in step_props else False ,
294302 ))
295303 elif step_type == "Decision" :
304+ if "id" not in step_props :
305+ raise ValueError (f"{ step_id } Decision node should have \" { step_id } \" in its id field" )
306+ if "purpose" not in step_props :
307+ raise ValueError (f"{ step_id } Decision node should have a purpose field" )
308+ if "question" not in step_props :
309+ raise ValueError (f"{ step_id } Decision node should have a question field" )
296310 self .add (Decision (
297311 id = step_props ["id" ],
298312 purpose = step_props ["purpose" ],
299313 question = step_props ["question" ],
300314 inputs = step_props ["inputs" ] if "inputs" in step_props else None ,
301315 ))
302316 elif step_type == "Program" :
317+ if "id" not in step_props :
318+ raise ValueError (f"{ step_id } Program node should have \" { step_id } \" in its id field" )
319+ if "purpose" not in step_props :
320+ raise ValueError (f"{ step_id } Program node should have a purpose field" )
321+ if "program" not in step_props :
322+ raise ValueError (f"{ step_id } Program node should have a program field" )
303323 self .add (Program (
304324 id = step_props ["id" ],
305325 purpose = step_props ["purpose" ],
0 commit comments