using System;
using LLama.Native;
namespace LLama.Sampling;
///
/// A sampling pipeline which always selects the most likely token
///
public class GreedySamplingPipeline
: BaseSamplingPipeline
{
///
protected override void ProcessLogits(SafeLLamaContextHandle ctx, Span logits, ReadOnlySpan lastTokens)
{
}
///
protected override LLamaToken ProcessTokenDataArray(SafeLLamaContextHandle ctx, LLamaTokenDataArray candidates, ReadOnlySpan lastTokens)
{
return candidates.SampleTokenGreedy(ctx);
}
///
public override ISamplingPipeline Clone()
{
return new GreedySamplingPipeline
{
Grammar = Grammar?.Clone()
};
}
}