You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

llama.batched.conversationextensions.md 1.8 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # ConversationExtensions
  2. Namespace: LLama.Batched
  3. Extension method for [Conversation](./llama.batched.conversation.md)
  4. ```csharp
  5. public static class ConversationExtensions
  6. ```
  7. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [ConversationExtensions](./llama.batched.conversationextensions.md)
  8. ## Methods
  9. ### **Rewind(Conversation, Int32)**
  10. Rewind a [Conversation](./llama.batched.conversation.md) back to an earlier state by removing tokens from the end
  11. ```csharp
  12. public static void Rewind(Conversation conversation, int tokens)
  13. ```
  14. #### Parameters
  15. `conversation` [Conversation](./llama.batched.conversation.md)<br>
  16. The conversation to rewind
  17. `tokens` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  18. The number of tokens to rewind
  19. #### Exceptions
  20. [ArgumentOutOfRangeException](https://docs.microsoft.com/en-us/dotnet/api/system.argumentoutofrangeexception)<br>
  21. Thrown if `tokens` parameter is larger than TokenCount
  22. ### **ShiftLeft(Conversation, Int32, Int32)**
  23. Shift all tokens over to the left, removing "count" tokens from the start and shifting everything over.
  24. Leaves "keep" tokens at the start completely untouched. This can be used to free up space when the context
  25. gets full, keeping the prompt at the start intact.
  26. ```csharp
  27. public static void ShiftLeft(Conversation conversation, int count, int keep)
  28. ```
  29. #### Parameters
  30. `conversation` [Conversation](./llama.batched.conversation.md)<br>
  31. The conversation to rewind
  32. `count` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  33. How much to shift tokens over by
  34. `keep` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  35. The number of tokens at the start which should not be shifted