Skip to content

SessionState

Namespace: LLama

The state of a chat session in-memory.

1
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.

1
public ExecutorBaseState ExecutorState { get; set; }

Property Value

ExecutorBaseState

ContextState

Saved context state (KV cache) for the session.

1
public State ContextState { get; set; }

Property Value

State

InputTransformPipeline

The input transform pipeline used in this session.

1
public ITextTransform[] InputTransformPipeline { get; set; }

Property Value

ITextTransform[]

OutputTransform

The output transform used in this session.

1
public ITextStreamTransform OutputTransform { get; set; }

Property Value

ITextStreamTransform

HistoryTransform

The history transform used in this session.

1
public IHistoryTransform HistoryTransform { get; set; }

Property Value

IHistoryTransform

History

The the chat history messages for this session.

1
public Message[] History { get; set; }

Property Value

Message[]

Constructors

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

Create a new session state.

1
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.

1
public void Save(string path)

Parameters

path String

Load(String)

Load the session state from folder.

1
public static SessionState Load(string path)

Parameters

path String

Returns

SessionState

Exceptions

ArgumentException
Throws when session state is incorrect

ToString()

1
public string ToString()

Returns

String

PrintMembers(StringBuilder)

1
protected bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

Boolean

GetHashCode()

1
public int GetHashCode()

Returns

Int32

Equals(Object)

1
public bool Equals(object obj)

Parameters

obj Object

Returns

Boolean

Equals(SessionState)

1
public bool Equals(SessionState other)

Parameters

other SessionState

Returns

Boolean

<Clone>$()

1
public SessionState <Clone>$()

Returns

SessionState