>} * @phpstan-type WpAiTool array{name: string, description: string, parameters?: array} * @phpstan-type WpAiRequest array{model: string, messages: list, system?: string, temperature?: float, max_tokens?: int, tools?: list, json?: array|true} * @phpstan-type WpAiToolCall array{id: string, name: string, arguments: array} * @phpstan-type WpAiReply array{content: string, reasoning: string, tool_calls: list, finish_reason: string, prompt_tokens: int, completion_tokens: int, total_tokens: int} * * @since 0.5.0 */ interface Client { /** Whether core's AI client is loaded at all (WordPress 7.0+). Cheap, side-effect free, safe on plugins_loaded. */ public function available(): bool; /** * The chat-capable models every configured core provider offers, in registry order. * * @return list empty when unavailable, when AI is switched off for the site, or when no provider is configured */ public function models(): array; /** * One non-streamed generation. * * @param WpAiRequest $request * @return WpAiReply * @throws \RuntimeException when the client is unavailable, no configured provider offers the model, or core answers with an error */ public function generate(array $request): array; }