|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- # SessionState
-
- Namespace: LLama
-
- The state of a chat session in-memory.
-
- ```csharp
- public class SessionState : System.IEquatable`1[[LLama.SessionState, LLamaSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
- ```
-
- Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [SessionState](./llama.sessionstate.md)<br>
- Implements [IEquatable<SessionState>](https://docs.microsoft.com/en-us/dotnet/api/system.iequatable-1)
-
- ## Properties
-
- ### **ExecutorState**
-
- Saved executor state for the session in JSON format.
-
- ```csharp
- public ExecutorBaseState ExecutorState { get; set; }
- ```
-
- #### Property Value
-
- [ExecutorBaseState](./llama.statefulexecutorbase.executorbasestate.md)<br>
-
- ### **ContextState**
-
- Saved context state (KV cache) for the session.
-
- ```csharp
- public State ContextState { get; set; }
- ```
-
- #### Property Value
-
- [State](./llama.llamacontext.state.md)<br>
-
- ### **InputTransformPipeline**
-
- The input transform pipeline used in this session.
-
- ```csharp
- public ITextTransform[] InputTransformPipeline { get; set; }
- ```
-
- #### Property Value
-
- [ITextTransform[]](./llama.abstractions.itexttransform.md)<br>
-
- ### **OutputTransform**
-
- The output transform used in this session.
-
- ```csharp
- public ITextStreamTransform OutputTransform { get; set; }
- ```
-
- #### Property Value
-
- [ITextStreamTransform](./llama.abstractions.itextstreamtransform.md)<br>
-
- ### **HistoryTransform**
-
- The history transform used in this session.
-
- ```csharp
- public IHistoryTransform HistoryTransform { get; set; }
- ```
-
- #### Property Value
-
- [IHistoryTransform](./llama.abstractions.ihistorytransform.md)<br>
-
- ### **History**
-
- The the chat history messages for this session.
-
- ```csharp
- public Message[] History { get; set; }
- ```
-
- #### Property Value
-
- [Message[]](./llama.common.chathistory.message.md)<br>
-
- ## Constructors
-
- ### **SessionState(State, ExecutorBaseState, ChatHistory, List<ITextTransform>, ITextStreamTransform, IHistoryTransform)**
-
- Create a new session state.
-
- ```csharp
- public SessionState(State contextState, ExecutorBaseState executorState, ChatHistory history, List<ITextTransform> inputTransformPipeline, ITextStreamTransform outputTransform, IHistoryTransform historyTransform)
- ```
-
- #### Parameters
-
- `contextState` [State](./llama.llamacontext.state.md)<br>
-
- `executorState` [ExecutorBaseState](./llama.statefulexecutorbase.executorbasestate.md)<br>
-
- `history` [ChatHistory](./llama.common.chathistory.md)<br>
-
- `inputTransformPipeline` [List<ITextTransform>](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1)<br>
-
- `outputTransform` [ITextStreamTransform](./llama.abstractions.itextstreamtransform.md)<br>
-
- `historyTransform` [IHistoryTransform](./llama.abstractions.ihistorytransform.md)<br>
-
- ## Methods
-
- ### **Save(String)**
-
- Save the session state to folder.
-
- ```csharp
- public void Save(string path)
- ```
-
- #### Parameters
-
- `path` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
-
- ### **Load(String)**
-
- Load the session state from folder.
-
- ```csharp
- public static SessionState Load(string path)
- ```
-
- #### Parameters
-
- `path` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
-
- #### Returns
-
- [SessionState](./llama.sessionstate.md)<br>
-
- #### Exceptions
-
- [ArgumentException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentexception)<br>
- Throws when session state is incorrect
-
- ### **ToString()**
-
- ```csharp
- public string ToString()
- ```
-
- #### Returns
-
- [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
-
- ### **PrintMembers(StringBuilder)**
-
- ```csharp
- protected bool PrintMembers(StringBuilder builder)
- ```
-
- #### Parameters
-
- `builder` [StringBuilder](https://docs.microsoft.com/en-us/dotnet/api/system.text.stringbuilder)<br>
-
- #### Returns
-
- [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
-
- ### **GetHashCode()**
-
- ```csharp
- public int GetHashCode()
- ```
-
- #### Returns
-
- [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
-
- ### **Equals(Object)**
-
- ```csharp
- public bool Equals(object obj)
- ```
-
- #### Parameters
-
- `obj` [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object)<br>
-
- #### Returns
-
- [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
-
- ### **Equals(SessionState)**
-
- ```csharp
- public bool Equals(SessionState other)
- ```
-
- #### Parameters
-
- `other` [SessionState](./llama.sessionstate.md)<br>
-
- #### Returns
-
- [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
-
- ### **<Clone>$()**
-
- ```csharp
- public SessionState <Clone>$()
- ```
-
- #### Returns
-
- [SessionState](./llama.sessionstate.md)<br>
|