0 purchases
dart chatgpt
Dart ChatGPT API #
This package requires a valid token from OpenAi Account to access official REST API.
Exemple #
var openai = OpenAI.instance.build(
token: '<your opanAI Token>',
baseOption: HttpSetup(receiveTimeout: 10000, connectTimeout: 10000),
isLogger: true,
);
final request = ChatCompletionRequest(
messages: [
Message(
role: 'system',
content: 'Você é um chatbot chamado Professor, que ajuda os alunos a'
' resolverem problemas escolares de forma divertida em portugês.'),
Message(
role: 'user',
content:
'Olá professor, Me esplique em pequenas frases a segunda teoria de newton?'),
],
);
var stream =
openai.onChatCompleteStream(request: request).asBroadcastStream();
stream.listen(
(res) {
print(res?.choices?.first.message);
},
).onError((err) {
print("$err");
});
copied to clipboard
Credit #
Huge thanks to justec.dev for creating Flutter ChatGPT API 💪
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.