HistorySize Property  
 

Sets or returns the maximum number of message exchanges retained in the client history.

Syntax

object.HistorySize [= value ]

Remarks

The HistorySize property is an Integer value that specifies the maximum number of message exchanges retained in the client session history. Each message represents a single request submitted to the model and its associated response. Changing the value of this property will change how many messages the client will retain in memory. It is possible to disable the conversation history by setting the value to zero.

The conversation history is maintained on a per-session basis and reflects the sequence of interactions with the model. Messages are stored in chronological order, with new messages appended to the end of the history. When the number of messages exceeds the value of this property, the oldest messages are removed automatically. This ensures that the total number of stored messages does not exceed the configured maximum.

Reducing the history size can help limit memory usage and reduce the amount of context sent with each request, which may improve performance and reduce token usage. However, limiting the history size may also reduce the model's ability to maintain context across multiple interactions.

Disabling the conversation history does not provide additional security or privacy. It only affects whether previous messages are retained and automatically included in subsequent requests. The content of each request is still transmitted to the service provider and may be processed or stored in accordance with that provider's policies. Applications that require secure handling of sensitive information should avoid including confidential data in requests and review the data handling practices of the selected service provider.

Even when message history is disabled, the model may still produce responses that appear contextually relevant within a single interaction. This is because the current request itself may contain enough information for the model to generate an appropriate response. However, without retaining previous messages, the model does not have access to prior exchanges in the conversation and continuity across multiple requests may be limited. In most cases, retaining a moderate history size provides better results for conversational applications.

The default history size is 100 message exchanges.

Data Type

Integer (Int32)

See Also

ContextUsed Property, MessageCount Property, Prompt Property, Response Property, ClearHistory Method, SendMessage Method