API reference · Kjarni 0.2.7

Class ChatConversation

Namespace: Kjarni
Assembly: Kjarni.dll

Stateful conversation that maintains chat history automatically. The parent Chat must outlive this object.

public class ChatConversation : IDisposable

Inheritance

object ← ChatConversation

Implements

IDisposable

Properties

Length

Number of messages in history.

public int Length { get; }

Property Value

int

Methods

Clear(bool)

Clear conversation history.

public void Clear(bool keepSystem = true)

Parameters

keepSystem bool

Dispose()

Releases the conversation and its history. The object cannot be used afterwards.

public void Dispose()

Send(string)

Send a message and get the response. Both are added to history.

public string Send(string message)

Parameters

message string

Returns

string

Send(string, GenerationConfig)

Send with custom generation config.

public string Send(string message, GenerationConfig config)

Parameters

message string

config GenerationConfig

Returns

string

Stream(string, Func<string, bool>)

Stream a response. Message and full response are added to history.

public void Stream(string message, Func<string, bool> onToken)

Parameters

message string

onToken Func<string, bool>

Kjarni runs the same engine on every platform: