| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Base class for an image generation model for providers that implement OpenAI's API format. This abstract class is designed to work with any AI provider that offers an OpenAI-compatible API endpoint for image generation, including but not limited to Anthropic, Google, and other providers that have adopted OpenAI's image generation API specification as a standard interface.
| File Size: | 298 lines (13 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| generateImageResult(array $prompt) X-Ref |
| {@inheritDoc} |
| prepareGenerateImageParams(array $prompt) X-Ref |
| Prepares the given prompt and the model configuration into parameters for the API request. return: ImageGenerationParams The parameters for the API request. param: list<Message> $prompt The prompt to generate an image for. Either a single message or a list of messages |
| preparePromptParam(array $messages) X-Ref |
| Prepares the prompt parameter for the API request. return: string The prepared prompt parameter. param: list<Message> $messages The messages to prepare. However as of today, OpenAI compatible image generation |
| prepareSizeParam(?MediaOrientationEnum $orientation, ?string $aspectRatio) X-Ref |
| Prepares the size parameter for the API request. return: string The prepared size parameter. param: MediaOrientationEnum|null $orientation The desired media orientation. param: string|null $aspectRatio The desired media aspect ratio. |
| throwIfNotSuccessful(Response $response) X-Ref |
| Throws an exception if the response is not successful. param: Response $response The HTTP response to check. |
| parseResponseToGenerativeAiResult(Response $response, string $expectedMimeType = 'image/png') X-Ref |
| Parses the response from the API endpoint to a generative AI result. return: GenerativeAiResult The parsed generative AI result. param: Response $response The response from the API endpoint. param: string $expectedMimeType The expected MIME type the response is in. |
| parseResponseChoiceToCandidate(array $choiceData, int $index, string $expectedMimeType = 'image/png') X-Ref |
| Parses a single choice from the API response into a Candidate object. return: Candidate The parsed candidate. param: ChoiceData $choiceData The choice data from the API response. param: int $index The index of the choice in the choices array. param: string $expectedMimeType The expected MIME type the response is in. |
| getResultId(array $responseData) X-Ref |
| Extracts the result ID from the API response data. return: string The result ID. param: array<string, mixed> $responseData The response data from the API. |
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |