FirebaseAILogic Framework Reference

GenerationOptions

struct GenerationOptions : Sendable, Equatable
extension FirebaseAI.GenerationOptions: GenerationOptionsRepresentable

Options that control how the model generates its response to a prompt.

This is a thin wrapper for the FoundationModels.GenerationOptions struct that is available on a wider range of operating system versions.

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

    Declaration

    Swift

    public struct SamplingMode : Sendable, Equatable
  • A sampling strategy for how the model picks tokens when generating a response.

    Declaration

    Swift

    public var sampling: GenerationOptions.SamplingMode?
  • Temperature influences the confidence of the model's response.

    Declaration

    Swift

    public var temperature: Double?
  • The maximum number of tokens the model is allowed to produce in its response.

    Declaration

    Swift

    public var maximumResponseTokens: Int?
  • Creates generation options that control token sampling behavior.

    Declaration

    Swift

    public init(sampling: GenerationOptions.SamplingMode? = nil, temperature: Double? = nil,
                maximumResponseTokens: Int? = nil)
  • Initializes a FirebaseAI/GenerationOptions from a FoundationModels.GenerationOptions.

    Declaration

    Swift

    @available(iOS 26.0, macOS 26.0, *)
    @available(tvOS, unavailable)
    @available(watchOS, unavailable)
    public init(_ options: FoundationModels.GenerationOptions)

    Parameters

    options

    The FoundationModels.GenerationOptions to wrap.

  • Declaration

    Swift

    public static func == (lhs: GenerationOptions, rhs: GenerationOptions) -> Bool
  • Declaration

    Swift

    public var responseGenerationOptions: ResponseGenerationOptions { get }