Search Results for

    Show / Hide Table of Contents

    Class LogitBias

    Optional. Modify the likelihood of specified tokens appearing in the completion.

    Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling.

    The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. Defaults to null.

    Inheritance
    object
    LogitBias
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    [JsonConverter(typeof(LogitBiasConverter))]
    public class LogitBias

    Properties

    | Edit this page View Source

    BiasMap

    Read-only access to the bias map.

    Declaration
    public IReadOnlyDictionary<int, int> BiasMap { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<int, int>
    | Edit this page View Source

    IsEmpty

    Whether any logit biases are defined.

    Declaration
    public bool IsEmpty { get; }
    Property Value
    Type Description
    bool

    Methods

    | Edit this page View Source

    Clear()

    Clear all token biases.

    Declaration
    public void Clear()
    | Edit this page View Source

    Get(int)

    Get bias value for a specific token. Returns null if not set.

    Declaration
    public int? Get(int tokenId)
    Parameters
    Type Name Description
    int tokenId
    Returns
    Type Description
    int?
    | Edit this page View Source

    Remove(int)

    Remove bias for a specific token.

    Declaration
    public bool Remove(int tokenId)
    Parameters
    Type Name Description
    int tokenId
    Returns
    Type Description
    bool
    | Edit this page View Source

    Set(int, int)

    Add or update a bias for a specific token.

    Declaration
    public void Set(int tokenId, int bias)
    Parameters
    Type Name Description
    int tokenId

    Token ID in the tokenizer.

    int bias

    Bias value (-100 to 100).

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation