@retry(stop=stop_after_attempt(3), wait=wait_exponential(multiplier=1, min=4, max=10)) def get_node_definitions(chain, structure: str, example: Dict) -> Dict[str, Dict[str, str]]: """Get node definitions with retry logic""" try: # Get response from LLM response = chain.invoke({"structure": structure, "example": example}) # Parse response node_defs = ast.literal_eval(response) # Validate structure if not validate_node_definition(node_defs): raise ValueError("Invalid node definition structure") return node_defs