withCapabilityProvider<T, R> method
Execute action with capability-specific provider
Implementation
Future<R?> withCapabilityProvider<T, R>(
LLMCapability capability,
Future<R> Function(T provider) action,
) async {
final providerIds = findProvidersWithCapability(capability);
for (final providerId in providerIds) {
final provider = _providers[providerId];
if (provider is T) {
return await action(provider);
}
}
return null;
}