Skip to content

Instantly share code, notes, and snippets.

@bensalcie
Created August 29, 2024 20:42
Show Gist options
  • Save bensalcie/b591e0f2681682f8cf03e677ad40ced8 to your computer and use it in GitHub Desktop.
Save bensalcie/b591e0f2681682f8cf03e677ad40ced8 to your computer and use it in GitHub Desktop.
gemini_model_service.dart
import 'package:google_generative_ai/google_generative_ai.dart';
import 'package:habbito/core/common/constants/app_strings.dart';
class GenerativeModelService {
final GenerativeModel model;
GenerativeModelService({required String apiKey})
: model = GenerativeModel(
model: geminipro,
apiKey: apiKey,
safetySettings: [],
);
Future<String?> generateContent(Iterable<Content> content) async {
final response = await model.generateContent(content);
return response.text;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment