sendMessage method

Future<String> sendMessage(
  1. List<ChatCompletionMessage> message
)

Implementation

Future<String> sendMessage(List<ChatCompletionMessage> message) async {
  final requestBody = ChatCompletion(messages: message);

  try {
    final rawResponse = await post(body: requestBody);
    final response = transformHttpResponse(rawResponse);
    String message = '';
    for (var element in response.choices) {
      message += element.message.content;
    }
    return message;
  } catch (e) {
    rethrow;
  }
}