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 Object → SessionState
Implements IEquatable<SessionState>
Properties
ExecutorState
Saved executor state for the session in JSON format.
public ExecutorBaseState ExecutorState { get; set; }
Property Value
ContextState
Saved context state (KV cache) for the session.
public State ContextState { get; set; }
Property Value
InputTransformPipeline
The input transform pipeline used in this session.
public ITextTransform[] InputTransformPipeline { get; set; }
Property Value
OutputTransform
The output transform used in this session.
public ITextStreamTransform OutputTransform { get; set; }
Property Value
HistoryTransform
The history transform used in this session.
public IHistoryTransform HistoryTransform { get; set; }
Property Value
History
The the chat history messages for this session.
public Message[] History { get; set; }
Property Value
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
Exceptions
ArgumentException
Throws when session state is incorrect
ToString()
public string ToString()
Returns
PrintMembers(StringBuilder)
protected bool PrintMembers(StringBuilder builder)
Parameters
builder
StringBuilder
Returns
GetHashCode()
public int GetHashCode()
Returns
Equals(Object)
public bool Equals(object obj)
Parameters
obj
Object
Returns
Equals(SessionState)
public bool Equals(SessionState other)
Parameters
other
SessionState
Returns
<Clone>$()
public SessionState <Clone>$()