googleAI static method

FirebaseAI googleAI({
  1. String? apiKey,
  2. String? apiVersion,
})

Returns an instance that talks to the Gemini Developer API.

apiKey and apiVersion override the values given to initialize.

Implementation

static FirebaseAI googleAI({String? apiKey, String? apiVersion}) {
  final key = apiKey ?? _defaultApiKey;
  if (key == null || key.isEmpty) {
    throw StateError(
      'No API key. Call FirebaseAI.initialize(apiKey: ...) first, '
      'or pass FirebaseAI.googleAI(apiKey: ...).',
    );
  }
  final version = apiVersion ??
      _defaultApiVersion ??
      (key.startsWith('auth_tokens/') ? 'v1alpha' : 'v1beta');
  return FirebaseAI._(core.LiveService(apiKey: key, apiVersion: version));
}