-
-
Save stepan-bezhuk-axon/1ab4b1e8ff47cccb9c5c0ba65d1616cb to your computer and use it in GitHub Desktop.
PaLM Service
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
abstract class IPaLMDataSource { | |
Future<PaLMModel> generateText(String text); | |
} | |
@override | |
Future<PaLMModel> generateText(String text) async { | |
return await dioClient.onRequest(() async { | |
const url = 'https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText'; | |
final queryParameters = {'key': <API_KEY>}; | |
final body = {'prompt': {'text': text}}; | |
final response = await dioClient.post(url, queryParameters: queryParameters, data: body); | |
return PaLMModel.fromJson(response.data); | |
}); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment