ProviderSessionState<TState> Constructor

Definition

Initializes a new instance of the ProviderSessionState<TState> class.

public ProviderSessionState(Func<Microsoft.Agents.AI.AgentSession?,TState> stateInitializer, string stateKey, System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = default);
new Microsoft.Agents.AI.ProviderSessionState<'State (requires 'State : null)> : Func<Microsoft.Agents.AI.AgentSession, 'State (requires 'State : null)> * string * System.Text.Json.JsonSerializerOptions -> Microsoft.Agents.AI.ProviderSessionState<'State (requires 'State : null)>
Public Sub New (stateInitializer As Func(Of AgentSession, TState), stateKey As String, Optional jsonSerializerOptions As JsonSerializerOptions = Nothing)

Parameters

stateInitializer
Func<AgentSession,TState>

A function to initialize the state when it is not yet present in the session's StateBag.

stateKey
String

The key used to store the state in the session's StateBag.

jsonSerializerOptions
JsonSerializerOptions

Options for JSON serialization and deserialization of the state.

Applies to