Created
August 29, 2024 20:42
-
-
Save bensalcie/b591e0f2681682f8cf03e677ad40ced8 to your computer and use it in GitHub Desktop.
gemini_model_service.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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