Skip to content

feat(xai): Add XAI image generation handler and tests#960

Open
timothymarois wants to merge 1 commit intoprism-php:mainfrom
atlas-php:feat/xai-image-generation
Open

feat(xai): Add XAI image generation handler and tests#960
timothymarois wants to merge 1 commit intoprism-php:mainfrom
atlas-php:feat/xai-image-generation

Conversation

@timothymarois
Copy link

This pull request introduces image generation support for the XAI provider, enabling the handling and mapping of image generation requests and responses. The main additions are a new Images handler, a request mapping utility, and integration of these into the provider interface.

Image generation support:

  • Added the Images handler class in src/Providers/XAI/Handlers/Images.php to process image generation requests, validate responses, extract generated images, and build structured responses.
  • Added the ImageRequestMap utility in src/Providers/XAI/Maps/ImageRequestMap.php to map image request parameters for the XAI API, including support for additional provider options.

Provider integration:

  • Registered the new image request and response types, and imported the Images handler in src/Providers/XAI/XAI.php.
  • Added the images() method to the XAI provider class to handle image generation requests using the new handler.Introduce image generation support for the XAI provider: add Images handler (sends POST to images/generations, validates response, extracts GeneratedImage objects, and builds a Response via ResponseBuilder) and ImageRequestMap (maps Request to provider payload and forwards supported and additional provider options). Wire the new handler into XAI by adding an images() method. Add comprehensive tests for URL and base64 responses, provider-specific options, multiple images, usage, and meta handling.

Description

docs say it supports xai image generation, but it actually returns an exception when trying to use xai.

Breaking Changes

None

Introduce image generation support for the XAI provider: add Images handler (sends POST to images/generations, validates response, extracts GeneratedImage objects, and builds a Response via ResponseBuilder) and ImageRequestMap (maps Request to provider payload and forwards supported and additional provider options). Wire the new handler into XAI by adding an images() method. Add comprehensive tests for URL and base64 responses, provider-specific options, multiple images, usage, and meta handling.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant