ClearHistory Method  
 

The ClearHistory method clears the conversation history for the current client session.

Syntax

object.ClearHistory

Parameters

None.

Return Value

A value of True is returned if the method succeeds. If the method fails, it will return False and the LastError property will contain the error code.

Remarks

The ClearHistory method removes all messages and responses stored in the conversation history for the specified client session. This can be used to begin a new conversation while preserving the current connection, provider settings, model selection, timeout, system prompt and other session options.

This method only clears the local history maintained by the client. It does not reset provider-specific settings, delete cached model information or close the active HTTP connection. It also does not change the current system prompt.

After the history has been cleared, subsequent calls to SendMessage will not include any previous messages from the conversation history.

If you call this method while enumerating the messages in the conversation history using the GetFirstMessage and GetNextMessage methods, you must call GetFirstMessage again to begin a new enumeration. Calling the GetNextMessage method immediately after calling ClearHistory will result in an error.

Calling this method will not affect the current values of the Prompt or Response properties. Those properties return the most recent message prompt and model response for the client session.

See Also

HistorySize Property, MessageCount Property, Prompt Property, Response Property, Reset Method, TrimHistory Method