| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 387 lines (17 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
AiClient:: (16 methods):
defaultRegistry()
setEventDispatcher()
getEventDispatcher()
setCache()
getCache()
isConfigured()
prompt()
generateResult()
generateTextResult()
generateImageResult()
convertTextToSpeechResult()
generateSpeechResult()
generateVideoResult()
message()
validateModelOrConfigParameter()
getConfiguredPromptBuilder()
| defaultRegistry() X-Ref |
| Gets the default provider registry instance. return: ProviderRegistry The default provider registry. |
| setEventDispatcher(?EventDispatcherInterface $dispatcher) X-Ref |
| Sets the event dispatcher for prompt lifecycle events. The event dispatcher will be used to dispatch BeforeGenerateResultEvent and AfterGenerateResultEvent during prompt generation. return: void param: EventDispatcherInterface|null $dispatcher The event dispatcher, or null to disable. |
| getEventDispatcher() X-Ref |
| Gets the event dispatcher for prompt lifecycle events. return: EventDispatcherInterface|null The event dispatcher, or null if not set. |
| setCache(?CacheInterface $cache) X-Ref |
| Sets the PSR-16 cache for storing and retrieving cached data. The cache can be used to store AI responses and other data to avoid redundant API calls and improve performance. return: void param: CacheInterface|null $cache The PSR-16 cache instance, or null to disable caching. |
| getCache() X-Ref |
| Gets the PSR-16 cache instance. return: CacheInterface|null The cache instance, or null if not set. |
| isConfigured($availabilityOrIdOrClassName) X-Ref |
| Checks if a provider is configured and available for use. Supports multiple input formats for developer convenience: - ProviderAvailabilityInterface: Direct availability check - string (provider ID): e.g., AiClient::isConfigured('openai') - string (class name): e.g., AiClient::isConfigured(OpenAiProvider::class) When using string input, this method leverages the ProviderRegistry's centralized dependency management, ensuring HttpTransporter and authentication are properly injected into availability instances. return: bool True if the provider is configured and available, false otherwise. param: ProviderAvailabilityInterface|string|class-string<ProviderInterface> $availabilityOrIdOrClassName |
| prompt($prompt = null, ?ProviderRegistry $registry = null) X-Ref |
| Creates a new prompt builder for fluent API usage. Returns a PromptBuilder instance configured with the specified or default registry. The traditional API methods in this class delegate to PromptBuilder for all generation logic. return: PromptBuilder The prompt builder instance. param: Prompt $prompt Optional initial prompt content. param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| generateResult($prompt, $modelOrConfig, ?ProviderRegistry $registry = null) X-Ref |
| Generates content using a unified API that automatically detects model capabilities. When no model is provided, this method delegates to PromptBuilder for intelligent model discovery based on prompt content and configuration. When a model is provided, it infers the capability from the model's interfaces and delegates to the capability-based method. return: GenerativeAiResult The generation result. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig $modelOrConfig Specific model to use, or model configuration param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| generateTextResult($prompt, $modelOrConfig = null, ?ProviderRegistry $registry = null) X-Ref |
| Generates text using the traditional API approach. return: GenerativeAiResult The generation result. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig|null $modelOrConfig Optional specific model to use, param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| generateImageResult($prompt, $modelOrConfig = null, ?ProviderRegistry $registry = null) X-Ref |
| Generates an image using the traditional API approach. return: GenerativeAiResult The generation result. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig|null $modelOrConfig Optional specific model to use, param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| convertTextToSpeechResult($prompt, $modelOrConfig = null, ?ProviderRegistry $registry = null) X-Ref |
| Converts text to speech using the traditional API approach. return: GenerativeAiResult The generation result. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig|null $modelOrConfig Optional specific model to use, param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| generateSpeechResult($prompt, $modelOrConfig = null, ?ProviderRegistry $registry = null) X-Ref |
| Generates speech using the traditional API approach. return: GenerativeAiResult The generation result. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig|null $modelOrConfig Optional specific model to use, param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| generateVideoResult($prompt, $modelOrConfig = null, ?ProviderRegistry $registry = null) X-Ref |
| Generates a video using the traditional API approach. return: GenerativeAiResult The generation result. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig|null $modelOrConfig Optional specific model to use, param: ProviderRegistry|null $registry Optional custom registry. If null, uses default. |
| message(?string $text = null) X-Ref |
| Creates a new message builder for fluent API usage. This method will be implemented once MessageBuilder is available. MessageBuilder will provide a fluent interface for constructing complex messages with multiple parts, attachments, and metadata. return: object MessageBuilder instance (type will be updated when MessageBuilder is available). param: string|null $text Optional initial message text. |
| validateModelOrConfigParameter($modelOrConfig) X-Ref |
| Validates that parameter is ModelInterface, ModelConfig, or null. return: void param: mixed $modelOrConfig The parameter to validate. |
| getConfiguredPromptBuilder($prompt, $modelOrConfig, ?ProviderRegistry $registry = null) X-Ref |
| Configures PromptBuilder based on model/config parameter type. return: PromptBuilder Configured prompt builder. param: Prompt $prompt The prompt content. param: ModelInterface|ModelConfig|null $modelOrConfig The model or config parameter. param: ProviderRegistry|null $registry Optional custom registry to use. |
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |