Generates content using a unified API that automatically detects model capabilities.
Description
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.
Parameters
$promptWordPressAiClientPromptrequired- The prompt content.
$modelOrConfigWordPressAiClientProvidersModelsContractsModelInterface|WordPressAiClientProvidersModelsDTOModelConfigrequired- Specific model to use, or model configuration for auto-discovery.
$registryWordPressAiClientProvidersProviderRegistry|nulloptional- Optional custom registry. If null, uses default.
Default:
null
Source
public static function generateResult($prompt, $modelOrConfig, ?ProviderRegistry $registry = null): GenerativeAiResult
{
self::validateModelOrConfigParameter($modelOrConfig);
return self::getConfiguredPromptBuilder($prompt, $modelOrConfig, $registry)->generateResult();
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.