def prepare_user_message(text: str) -> str: text = text.strip() if not text: raise ValueError("User message cannot be empty.") return text