VertexAI
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public class VertexAIThe Vertex AI for Firebase SDK provides access to Gemini models directly from your app.
-
Creates an instance of
VertexAI.Declaration
Swift
public static func vertexAI(app: FirebaseApp? = nil, location: String = "us-central1") -> VertexAIReturn Value
A
VertexAIinstance, configured with the customFirebaseApp. -
generativeModel(modelName:generationConfig:safetySettings:tools:toolConfig:systemInstruction:requestOptions:)
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()) -> GenerativeModelParameters
modelNameThe name of the model to use, for example
"gemini-1.5-flash"; see available model names for a list of supported model names.generationConfigThe content generation parameters your model should use.
safetySettingsA value describing what types of harmful content your model should allow.
toolsA list of
Toolobjects that the model may use to generate the next response.toolConfigTool configuration for any
Toolspecified in the request.systemInstructionInstructions that direct the model to behave a certain way; currently only text content is supported.
requestOptionsConfiguration parameters for sending requests to the backend.
-
[Public Preview] Initializes an
ImagenModelwith the given parameters.Warning
For Vertex AI in Firebase, image generation using Imagen 3 models is in Public Preview, which means that the feature is not subject to any SLA or deprecation policy and could change in backwards-incompatible ways.
Important: Only Imagen 3 models (named
imagen-3.0-*) are supported.Declaration
Swift
public func imagenModel(modelName: String, generationConfig: ImagenGenerationConfig? = nil, safetySettings: ImagenSafetySettings? = nil, requestOptions: RequestOptions = RequestOptions()) -> ImagenModelParameters
modelNameThe name of the Imagen 3 model to use, for example
"imagen-3.0-generate-002"; see model versions for a list of supported Imagen 3 models.generationConfigConfiguration options for generating images with Imagen.
safetySettingsSettings describing what types of potentially harmful content your model should allow.
requestOptionsConfiguration parameters for sending requests to the backend.