FirebaseAILogic Framework Reference

HybridModel

public struct HybridModel : LanguageModel

A hybrid model combining a primary, or main, model and a secondary, or fallback, model.

Public Preview: This API is a public preview and may be subject to change.

  • [Public Preview] Creates a HybridModel for the specified models.

    Warning

    This API is a public preview and may be subject to change.

    Declaration

    Swift

    public init(primary: any LanguageModel, secondary: any LanguageModel)

    Parameters

    primary

    The main, or default, model to use.

    secondary

    The backup model to fallback to if the primary model is unavailable.

  • Returns the name of the model.

    Declaration

    Swift

    public var _modelName: String { get }
  • Returns a new session for this model.

    Declaration

    Swift

    public func _startSession(tools: [any ToolRepresentable]?,
                              instructions: String?) throws -> any _ModelSession