sendMessage method

Future<(Exception?, ThreadMessage?)> sendMessage({
  1. String? threadId,
  2. required String assistantId,
  3. required String content,
})

Implementation

Future<(Exception?, ThreadMessage?)> sendMessage({
  String? threadId,
  required String assistantId,
  required String content,
}) async {
  final userMessage = Message(content: content, role: 'user');

  if (threadId != null) {
    return _sendMessageWithThread(
        threadId: threadId,
        userMessage: userMessage,
        assistantId: assistantId);
  } else {
    return _sendMessageWithoutThread(
        assistantId: assistantId, userMessage: userMessage);
  }
}