LlmResetSession Function  
 
BOOL WINAPI LlmResetSession(
  HCLIENT hClient  
);

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

Parameters

hClient
A handle to the client session.

Return Value

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

Remarks

The LlmResetSession function 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 function 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 function will fail. Applications should call LlmIsBlocking to determine if the client is busy before attempting to reset the session.

Because this function clears the conversation history, it also invalidates any string pointers previously returned in LLM_RESPONSE structures or by message history functions. Applications must not use those pointers after this function 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

LlmClearHistory, LlmDisconnect, LlmTrimHistory