withParts

fun Message.withParts(parts: List<MessagePart>): Message

Returns a copy of this message with its parts replaced, keeping only the parts the message role can actually carry.