answersPlan static method

SyniAnswersPlan? answersPlan({
  1. required String message,
  2. List<SyniRuntimeMessage> messages = const [],
  3. bool firstTurn = false,
})

What a chat turn needs fetched before it runs (runtime 0.8.0+). Pass the person's message, the earlier messages of the conversation, and whether this is the firstTurn. Needs no model. Returns null when the runtime predates state answers; throws SyniRuntimeError for a request the runtime refuses.

Implementation

static SyniAnswersPlan? answersPlan({
  required String message,
  List<SyniRuntimeMessage> messages = const [],
  bool firstTurn = false,
}) {
  final raw = SyniRuntimeFFI.answersPlanJson(jsonEncode({
    'message': message,
    if (messages.isNotEmpty)
      'messages': messages.map((m) => m.toJson()).toList(),
    'first_turn': firstTurn,
  }));
  return raw == null ? null : parseAnswersPlan(raw);
}