resolve method
Implementation
Future<LanguageModel> resolve(ModelSettings settings) async {
if (!settings.useThirdParty) return onDevice;
final config = settings.selected;
if (config == null || config.validate().isNotEmpty) {
throw const SystemLlmException(SystemLlmException.notConfigured);
}
final apiKey = await keyStore.read(config.id);
final needsKey =
ProviderPresets.byId(config.presetId)?.requiresApiKey ?? false;
if (needsKey && (apiKey == null || apiKey.trim().isEmpty)) {
throw const SystemLlmException(SystemLlmException.notConfigured);
}
return RemoteLanguageModel.create(
config,
apiKey: apiKey,
client: client,
timeout: timeout,
);
}