Remove message from message history
updatedMessages = removeMessage(messages,messageIndex)
updatedMessages = removeMessage(messages,messageIndex)
removes an existing message from the specified position in the messageHistory
object messages
.
Initialize the message history.
messages = messageHistory;
Add a user message to the message history.
messages = addUserMessage(messages,"Why is a raven like a writing desk?");
Remove the message from the message history.
messages = removeMessage(messages,1)
messages =
messageHistory with properties:
Messages: {1x0 cell}
messageHistory
object
Message history, specified as a messageHistory
object.
positive integer
Index of the message to remove, specified as a positive integer.
messageHistory
object
Updated message history, specified as a messageHistory
object.
messageHistory
| addSystemMessage
| addUserMessage
| addToolMessage
| addResponseMessage
| addUserMessageWithImages
Copyright 2024 The MathWorks, Inc.