currentLoadedId method

Future<String?> currentLoadedId(
  1. ModelCategory category
)

Currently-loaded model id for a given category, or null when nothing is loaded. Lets callers do the "already-loaded?" check without hand-rolling a per-capability switch.

Implementation

Future<String?> currentLoadedId(ModelCategory category) async {
  switch (category) {
    case ModelCategory.MODEL_CATEGORY_LANGUAGE:
      final m = await RunAnywhereLLM.shared.currentModel();
      return m?.id;
    case ModelCategory.MODEL_CATEGORY_MULTIMODAL:
    case ModelCategory.MODEL_CATEGORY_VISION:
      return RunAnywhereVLM.shared.currentModelId;
    case ModelCategory.MODEL_CATEGORY_SPEECH_RECOGNITION:
      return RunAnywhereSTT.shared.currentModelId;
    case ModelCategory.MODEL_CATEGORY_SPEECH_SYNTHESIS:
      return RunAnywhereTTS.shared.currentVoiceId;
    case ModelCategory.MODEL_CATEGORY_VOICE_ACTIVITY_DETECTION:
      return RunAnywhereVAD.shared.currentModelId;
    default:
      final m = await RunAnywhereLLM.shared.currentModel();
      return m?.id;
  }
}