from rdkit import Chem MAX_HEAVY_ATOMS = 50 def validate_smiles(smiles: str) -> bool: """Return True if the SMILES is parseable, non-empty, and within size limits.""" if not smiles or not smiles.strip(): return False mol = Chem.MolFromSmiles(smiles.strip()) if mol is None: return False if mol.GetNumHeavyAtoms() > MAX_HEAVY_ATOMS: return False return True