runDecisionBackend method

Future<List<BackendDecisionOutput>> runDecisionBackend(
  1. int headHandle,
  2. List<BackendDecisionSequence> sequences
)

Runs sequences through the decision head headHandle.

This is the low-level integration hook used by DecisionEngine, which builds the sequences and decodes the outputs. headHandle is a handle returned by loadDecisionHeadBackend. Throws LlamaStateException when it is not loaded on this engine, such as after it was freed or its model was unloaded, and on Web when a bridge runtime restart freed it.

Implementation

Future<List<BackendDecisionOutput>> runDecisionBackend(
  int headHandle,
  List<BackendDecisionSequence> sequences,
) async {
  final backendHandle = _decisionHeadHandles[headHandle];
  if (backendHandle == null) {
    throw LlamaStateException(
      'Decision head $headHandle is not loaded on this engine; it was '
      'freed, its model was unloaded, or it was never loaded. Load the '
      'DecisionEngine again.',
    );
  }
  return _decisionBackend().decisionRun(backendHandle, sequences);
}