Constructor ChatHistory
- Namespace
- LMKit.TextGeneration.Chat
- Assembly
- LM-Kit.NET.dll
ChatHistory(LM)
Create a new instance of the ChatHistory class.
public ChatHistory(LM model)
Parameters
modelLMSpecifies the Model object that will be utilized in conjunction with this chat history instance.
Examples
using LMKit.Model;
using LMKit.TextGeneration.Chat;
using System;
// Load a model
LM model = LM.LoadFromModelID("llama-3.2-1b");
// Create a new chat history
ChatHistory history = new ChatHistory(model);
// Add messages
history.AddMessage(AuthorRole.User, "Hello!");
history.AddMessage(AuthorRole.Assistant, "Hi there! How can I help you?");
Console.WriteLine($"Chat history contains {history.MessageCount} messages");