Returns the default AI instance that is associated with the provided @firebase/app!FirebaseApp. If no instance exists, initializes a new instance with the default settings.
The @firebase/app!FirebaseApp to use.
Optional
AIOptions that configure the AI instance.
The default AI instance for the given @firebase/app!FirebaseApp.
const ai = getAI(app); Copy
const ai = getAI(app);
// Get an AI instance configured to use the Gemini Developer API (via Google AI).const ai = getAI(app, { backend: new GoogleAIBackend() }); Copy
// Get an AI instance configured to use the Gemini Developer API (via Google AI).const ai = getAI(app, { backend: new GoogleAIBackend() });
// Get an AI instance configured to use the Vertex AI Gemini API.const ai = getAI(app, { backend: new VertexAIBackend() }); Copy
// Get an AI instance configured to use the Vertex AI Gemini API.const ai = getAI(app, { backend: new VertexAIBackend() });
Returns the default AI instance that is associated with the provided @firebase/app!FirebaseApp. If no instance exists, initializes a new instance with the default settings.