天问 9aa561e25e Update 'README.md' | 2 months ago | |
---|---|---|
README.md | 2 months ago |
openai sdk
dart_openai: ^1.9.1
类似项目:
_openAI = OpenAI.instance.build(
token: OPENAI_API_KEY,
baseOption: HttpSetup(receiveTimeout: const Duration(seconds: 5)),
enableLog: true);
final request = ChatCompleteText(
model: GptTurbo0301ChatModel(),
messages: messagesHistory,
maxToken: 200);
final response = await _openAI.onChatCompletion(request: request);
return response!.choices
.map((choice) => ChatMessage(
user: ChatUser(id: '2'),
createdAt: DateTime.now(),
text: choice.message!.content))
.toList();
}