wpseek.com
WordPress开发者和主题制作者的搜索引擎
wp_ai_client_embedding › WordPress Function
Since7.2.0
已弃用n/a
› wp_ai_client_embedding ( $input )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
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 viausing_model() or
using_provider_model(). Embedding vectors are only comparable to other
vectors produced by the same model, so no model is selected automatically.源码
function wp_ai_client_embedding( ...$input ): WP_AI_Client_Embedding_Builder {
/*
* A single list argument is a list of inputs. It cannot be a single input, since
* the only array input is a message part array shape, which is never a list.
*/
if ( 1 === count( $input ) && isset( $input[0] ) && is_array( $input[0] ) && array_is_list( $input[0] ) ) {
$input = $input[0];
}
return new WP_AI_Client_Embedding_Builder( AiClient::defaultRegistry(), array() === $input ? null : $input );
}