CoreFiles by mySites.guru
ai-client.php34 lines, 1,717 bytes, from wordpress-7.0-beta3.zip
Raw History Compare with 7.0-beta2
md5
1f577f0b86f62dc020151d144cc9dae7
sha1
013fd078ff03563b5a4e7d734b20657fe79b1f81
sha256
92522366ba7369d04472330d6b67cd0667ede63e5c5528071c36106fd6f0fac6
<?php
/**
 * WordPress AI Client API.
 *
 * @package WordPress
 * @subpackage AI
 * @since 7.0.0
 */

use WordPress\AiClient\AiClient;

/**
 * Creates a new AI prompt builder using the default provider registry.
 *
 * This is the main entry point for generating AI content in WordPress. It returns
 * a fluent builder that can be used to configure and execute AI prompts.
 *
 * The prompt can be provided as a simple string for basic text prompts, or as more
 * complex types for advanced use cases like multi-modal content or conversation history.
 *
 * @since 7.0.0
 *
 * @param string|MessagePart|Message|array|list<string|MessagePart|array>|list<Message>|null $prompt Optional. Initial prompt content.
 *                                                                                                   A string for simple text prompts,
 *                                                                                                   a MessagePart or Message object for
 *                                                                                                   structured content, an array for a
 *                                                                                                   message array shape, or a list of
 *                                                                                                   parts or messages for multi-turn
 *                                                                                                   conversations. Default null.
 * @return WP_AI_Client_Prompt_Builder The prompt builder instance.
 */
function wp_ai_client_prompt( $prompt = null ) {
	return new WP_AI_Client_Prompt_Builder( AiClient::defaultRegistry(), $prompt );
}

The same content is in 5 releases, WordPress 7.0-beta1 to 7.0-beta5. See them all, or every version of this file.