SocketTools .NET Edition

LlmClient.ExportHistory Method (String)

Export the current conversation history to a JSON-formatted file.

[Visual Basic]
Overloads Public Function ExportHistory( _
   ByVal fileName As String _
) As Boolean
[C#]
public bool ExportHistory(
   string fileName
);

Parameters

fileName
A string which specifies the name of the file to be created or overwritten. The string may contain environment variables in the path by enclosing the variable name in percent symbols.

Return Value

Returns a value of true if the conversation history has been exported; otherwise returns false.

Remarks

The exported history includes both client messages and model responses stored in the current session history. It cannot be used if the conversation history has been disabled by setting the HistorySize property to zero.

The exported file uses UTF-8 encoded JSON text and is intended to be human-readable. Applications should not depend on the exact formatting or internal structure of the file because future versions of the class may include additional metadata or fields. To help prevent data loss, the method writes the exported history to a temporary file and only replaces the destination file after the export operation has completed successfully. If the export fails, any existing file specified by the fileName parameter is left unchanged.

Important: The conversation history may contain sensitive or private information. Applications should take reasonable precautions to protect exported history files, such as limiting access permissions or encrypting the exported file. Applications which allow users to export conversation history should consider informing users that the exported file may contain private information.

See Also