codekingpro/portable-devtools
114k
1"""Message responsible for deleting other messages."""2 3from typing import Any, Literal4 5from langchain_core.messages.base import BaseMessage6 7 8class RemoveMessage(BaseMessage):9 """Message responsible for deleting other messages."""10 11 type: Literal["remove"] = "remove"12 """The type of the message (used for serialization)."""13 14 def __init__(15 self,16 id: str,17 **kwargs: Any,18 ) -> None:19 """Create a RemoveMessage.20 21 Args:22 id: The ID of the message to remove.23 **kwargs: Additional fields to pass to the message.24 25 Raises:26 ValueError: If the 'content' field is passed in kwargs.27 28 """29 if kwargs.pop("content", None):30 msg = "RemoveMessage does not support 'content' field."31 raise ValueError(msg)32 33 super().__init__("", id=id, **kwargs)34 