uncanny_automator_ai_providers_loaded
Action hook fired after all AI providers are loaded and registered. Allows other plugins or themes to register additional AI providers or perform actions after the AI framework is fully initialized. Fires after all AI providers are loaded and registered, allowing for additional provider registration or initialization tasks.
add_action( 'uncanny_automator_ai_providers_loaded', $callback, 10, 1 );
Description
Fired after Uncanny Automator loads and registers all its default AI providers. Developers can use this action hook to conditionally register custom AI providers or execute logic after the AI framework is fully ready, ensuring all AI integrations are available.
Usage
add_action( 'uncanny_automator_ai_providers_loaded', 'your_function_name', 10, 1 );
Examples
/**
* Example of using the uncanny_automator_ai_providers_loaded hook.
*
* This function demonstrates how to hook into the AI providers loaded event
* to potentially register a new custom AI provider or log information.
* In a real-world scenario, you would likely have a separate class or
* function to handle the registration of your custom AI provider.
* For this example, we'll just log a message.
*/
function my_custom_automator_ai_provider_handler() {
// In a real-world scenario, you might check for conditions
// or dynamically load your custom AI provider here.
// For demonstration, we'll just log that the hook was fired.
// Example: If you had a custom AI provider class like My_Custom_AI_Provider
// you might instantiate and register it like this (hypothetical):
// $custom_provider = new My_Custom_AI_Provider();
// UncannyAutomator()->add_ai_provider( $custom_provider );
error_log( 'Uncanny Automator AI providers have been loaded. Ready to add custom providers if needed.' );
}
add_action( 'uncanny_automator_ai_providers_loaded', 'my_custom_automator_ai_provider_handler', 10, 0 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/core/lib/ai/default-providers-loader.php:63
public function load_providers() {
if ( self::$providers_registered ) {
return;
}
Provider_Factory::register_provider( 'OPENAI', OpenAI_Provider::class );
Provider_Factory::register_provider( 'CLAUDE', Claude_Provider::class );
Provider_Factory::register_provider( 'PERPLEXITY', Perplexity_Provider::class );
Provider_Factory::register_provider( 'GEMINI', Gemini_Provider::class );
Provider_Factory::register_provider( 'COHERE', Cohere_Provider::class );
Provider_Factory::register_provider( 'GROK', Grok_Provider::class );
Provider_Factory::register_provider( 'MISTRAL', Mistral_Provider::class );
/**
* Action hook fired after all AI providers are loaded and registered.
*
* Allows other plugins or themes to register additional AI providers
* or perform actions after the AI framework is fully initialized.
*
* @since 5.6
*/
do_action( 'uncanny_automator_ai_providers_loaded' );
self::$providers_registered = true;
}