vertexAI static method
FirebaseAI
vertexAI({
- FirebaseApp? app,
- FirebaseAppCheck? appCheck,
- FirebaseAuth? auth,
- String? location,
Returns an instance using a specified FirebaseApp
.
If app
is not provided, the default Firebase app will be used.
If pass in appCheck
, request session will get protected from abusing.
Implementation
static FirebaseAI vertexAI({
FirebaseApp? app,
FirebaseAppCheck? appCheck,
FirebaseAuth? auth,
String? location,
}) {
app ??= Firebase.app();
var instanceKey = '${app.name}::vertexai';
if (_cachedInstances.containsKey(instanceKey)) {
return _cachedInstances[instanceKey]!;
}
location ??= _defaultLocation;
FirebaseAI newInstance = FirebaseAI._(
app: app,
location: location,
appCheck: appCheck,
auth: auth,
useVertexBackend: true,
);
_cachedInstances[instanceKey] = newInstance;
return newInstance;
}