CLlmClient::ResetSession Method  
 
BOOL ResetSession();

The ResetSession method resets the current client session to its initial state, clearing any existing conversation context.

Parameters

None.

Return Value

If the method succeeds, the return value is non-zero. If the method fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The ResetSession method resets the client session to its initial state. Any active connection to the service provider is closed, the conversation history is cleared, and token usage statistics for the session are reset.

This method can be used to discard the current conversation context and start a new session using the existing client handle. Configuration settings such as the selected provider, model name, system prompt, and client options are preserved.

If a blocking operation is currently in progress, this method will fail. Applications should call IsBlocking to determine if the client is busy before attempting to reset the session.

Because this method clears the conversation history, it also invalidates any string pointers previously returned in LLM_RESPONSE structures or by message history methods. Applications must not use those pointers after this method returns. If the application needs to keep any message or response text, it should make its own copy before resetting the session.

Requirements

Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: csllmv12.lib

See Also