FirebaseVertexAI Framework Reference

VertexAI

@available(iOS 15.0, macOS 11.0, *)
public class VertexAI : NSObject

The Vertex AI for Firebase SDK provides access to Gemini models directly from your app.

  • The default VertexAI instance.

    Declaration

    Swift

    public static func vertexAI(location: String = "us-central1") -> VertexAI

    Parameters

    location

    The region identifier, defaulting to us-central1; see Vertex AI regions for a list of supported regions.

    Return Value

    An instance of VertexAI, configured with the default FirebaseApp.

  • Creates an instance of VertexAI configured with a custom FirebaseApp.

    Declaration

    Swift

    public static func vertexAI(app: FirebaseApp, location: String = "us-central1") -> VertexAI

    Return Value

    A VertexAI instance, configured with the custom FirebaseApp.

  • Initializes a generative model with the given parameters.

    Note

    Refer to Gemini models for guidance on choosing an appropriate model for your use case.

    Declaration

    Swift

    public func generativeModel(modelName: String,
                                generationConfig: GenerationConfig? = nil,
                                safetySettings: [SafetySetting]? = nil,
                                tools: [Tool]? = nil,
                                toolConfig: ToolConfig? = nil,
                                systemInstruction: ModelContent? = nil,
                                requestOptions: RequestOptions = RequestOptions())
      -> GenerativeModel

    Parameters

    modelName

    The name of the model to use, for example "gemini-1.5-flash-preview-0514"; see available model names for a list of supported model names.

    generationConfig

    The content generation parameters your model should use.

    safetySettings

    A value describing what types of harmful content your model should allow.

    tools

    A list of Tool objects that the model may use to generate the next response.

    toolConfig

    Tool configuration for any Tool specified in the request.

    systemInstruction

    Instructions that direct the model to behave a certain way; currently only text content is supported.

    requestOptions

    Configuration parameters for sending requests to the backend.