diff --git a/LLama/Batched/Conversation.cs b/LLama/Batched/Conversation.cs index b3ce97dd..6cf6e312 100644 --- a/LLama/Batched/Conversation.cs +++ b/LLama/Batched/Conversation.cs @@ -264,6 +264,23 @@ public sealed class Conversation _conversation.Executor.Context.NativeHandle.KvCacheSequenceShift(_conversation.ConversationId, start, end, delta); } #endregion + + #region divide + /// + /// Integer division of the positions by factor of `d > 1`. + /// If the KV cache is RoPEd, the KV data is updated accordingly. + /// + /// Start position (inclusive). If less than zero, it is clamped to zero. + /// End position (exclusive). If less than zero, it is treated as "infinity". + /// Amount to divide each position by. + public void Divide(LLamaPos start, LLamaPos end, int divisor) + { + if (divisor <= 0) + throw new ArgumentOutOfRangeException(nameof(divisor)); + + _conversation.Executor.Context.NativeHandle.KvCacheSequenceDivide(_conversation.ConversationId, start, end, divisor); + } + #endregion } /// diff --git a/LLama/Native/SafeLLamaContextHandle.cs b/LLama/Native/SafeLLamaContextHandle.cs index da53491d..2d9387ae 100644 --- a/LLama/Native/SafeLLamaContextHandle.cs +++ b/LLama/Native/SafeLLamaContextHandle.cs @@ -375,9 +375,9 @@ namespace LLama.Native } /// - /// Integer division of the positions by factor of `d > 1` - /// If the KV cache is RoPEd, the KV data is updated accordingly - /// p0 < 0 : [0, p1] + /// Integer division of the positions by factor of `d > 1`. + /// If the KV cache is RoPEd, the KV data is updated accordingly.
+ /// p0 < 0 : [0, p1]
/// p1 < 0 : [p0, inf) ///
///