FirebaseAILogic Framework Reference

SamplingMode

public struct SamplingMode : Sendable, Equatable

A type that defines how values are sampled from a probability distribution.

  • A sampling mode that always chooses the most likely token.

    Declaration

    Swift

    public static var greedy: GenerationOptions.SamplingMode { get }
  • A sampling mode that considers a fixed number of high-probability tokens.

    Declaration

    Swift

    public static func random(top k: Int, seed: UInt64? = nil) -> GenerationOptions
      .SamplingMode
  • A mode that considers a variable number of high-probability tokens based on the specified threshold.

    Declaration

    Swift

    public static func random(probabilityThreshold: Double,
                              seed: UInt64? = nil) -> GenerationOptions.SamplingMode
  • Declaration

    Swift

    public static func == (lhs: SamplingMode, rhs: SamplingMode) -> Bool