Skip to content

SessionState

Namespace: LLama

The state of a chat session in-memory.

public class SessionState : System.IEquatable`1[[LLama.SessionState, LLamaSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]

Inheritance ObjectSessionState
Implements IEquatable<SessionState>

Properties

ExecutorState

Saved executor state for the session in JSON format.

public ExecutorBaseState ExecutorState { get; set; }

Property Value

ExecutorBaseState

ContextState

Saved context state (KV cache) for the session.

public State ContextState { get; set; }

Property Value

State

InputTransformPipeline

The input transform pipeline used in this session.

public ITextTransform[] InputTransformPipeline { get; set; }

Property Value

ITextTransform[]

OutputTransform

The output transform used in this session.

public ITextStreamTransform OutputTransform { get; set; }

Property Value

ITextStreamTransform

HistoryTransform

The history transform used in this session.

public IHistoryTransform HistoryTransform { get; set; }

Property Value

IHistoryTransform

History

The the chat history messages for this session.

public Message[] History { get; set; }

Property Value

Message[]

Constructors

SessionState(State, ExecutorBaseState, ChatHistory, List<ITextTransform>, ITextStreamTransform, IHistoryTransform)

Create a new session state.

public SessionState(State contextState, ExecutorBaseState executorState, ChatHistory history, List<ITextTransform> inputTransformPipeline, ITextStreamTransform outputTransform, IHistoryTransform historyTransform)

Parameters

contextState State

executorState ExecutorBaseState

history ChatHistory

inputTransformPipeline List<ITextTransform>

outputTransform ITextStreamTransform

historyTransform IHistoryTransform

Methods

Save(String)

Save the session state to folder.

public void Save(string path)

Parameters

path String

Load(String)

Load the session state from folder.

public static SessionState Load(string path)

Parameters

path String

Returns

SessionState

Exceptions

ArgumentException
Throws when session state is incorrect

ToString()

public string ToString()

Returns

String

PrintMembers(StringBuilder)

protected bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

Boolean

GetHashCode()

public int GetHashCode()

Returns

Int32

Equals(Object)

public bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

Equals(SessionState)

public bool Equals(SessionState other)

Parameters

other SessionState

Returns

Boolean

<Clone>$()

public SessionState <Clone>$()

Returns

SessionState