Skip to content

ConversationExtensions

Namespace: LLama.Batched

Extension method for Conversation

1
public static class ConversationExtensions

Inheritance ObjectConversationExtensions

Methods

Rewind(Conversation, Int32)

Rewind a Conversation back to an earlier state by removing tokens from the end

1
public static void Rewind(Conversation conversation, int tokens)

Parameters

conversation Conversation
The conversation to rewind

tokens Int32
The number of tokens to rewind

Exceptions

ArgumentOutOfRangeException
Thrown if tokens parameter is larger than TokenCount

ShiftLeft(Conversation, Int32, Int32)

Shift all tokens over to the left, removing "count" tokens from the start and shifting everything over. Leaves "keep" tokens at the start completely untouched. This can be used to free up space when the context gets full, keeping the prompt at the start intact.

1
public static void ShiftLeft(Conversation conversation, int count, int keep)

Parameters

conversation Conversation
The conversation to rewind

count Int32
How much to shift tokens over by

keep Int32
The number of tokens at the start which should not be shifted