Function oneOf

  • A template sampler creator where each sample has logits modified depending on the tokens which are still relevant given the already sampled tokens. For use with LoadedModel

    Parameters

    • items: string[]

    Returns CreateSamplerTemplate

    Remarks

    For example, if we have oneOf(['ranger', 'wizard']) and we've already sampled 'w', the only next relevant tokens would be from 'izard'. If you want oneOf to stop at one of the choices, include the stop character (by default the next character after the expression), eg: oneOf(['ranger"', 'wizard"']).

    See

    Bias

    Example

    template`{
    "weapon": "${a('special weapon', {
    sampler: bias.prefer(oneOf(['Nun-chucks', 'Beam Cannon']), 10),
    })}"
    }`

Generated using TypeDoc