getTokenCount method

int getTokenCount(
  1. String text
)

Implementation

int getTokenCount(String text) {
  if (pLLm == nullptr) {
    throw Exception("ailia LLM not initialized.");
  }

  final Pointer<UnsignedInt> count = malloc<UnsignedInt>();
  Pointer<Char> pText = text.toNativeUtf8().cast<Char>();
  dllHandle.ailiaLLMGetTokenCount(pLLm.value, count, pText);
  int retCount = count.value;
  malloc.free(count);
  return retCount;
}