[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ -> ai-client.php (summary)

WordPress AI Client API.

File Size: 100 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  wp_supports_ai()
  wp_ai_client_prompt()
  wp_ai_client_embedding()

Functions
Functions that are not part of a class:

wp_supports_ai()   X-Ref
Returns whether AI features are supported in the current environment.

return: bool Whether AI features are supported.

wp_ai_client_prompt( $prompt = null )   X-Ref
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.

return: WP_AI_Client_Prompt_Builder The prompt builder instance.
param: string|MessagePart|Message|array|list<string|MessagePart|array>|list<Message>|null $prompt Optional. Initial prompt content.

wp_ai_client_embedding( ...$input )   X-Ref
Creates a new AI embedding builder using the default provider registry.

This is the main entry point for generating embeddings in WordPress. It returns
a fluent builder that can be used to configure and generate embedding vectors.

Each input can be provided as a simple string for basic text inputs, or as more
complex types. Pass multiple arguments, or a single list of inputs, to embed
multiple inputs at once, each producing its own embedding vector.

A model must be specified on the returned builder via `using_model()` or
`using_provider_model()`. Embedding vectors are only comparable to other
vectors produced by the same model, so no model is selected automatically.

return: WP_AI_Client_Embedding_Builder The embedding builder instance.
param: string|MessagePart|File|array ...$input Optional. Initial input(s) to embed.



Generated : Sun Nov 1 08:20:35 2026 Cross-referenced by PHPXref