Support Images generation through OPEN AI API #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Image Generation - A new ImageGenerationAgent class has been added to the com.xebia.functional.agents package. This agent is responsible for generating images based on a given prompt. It interacts with the OpenAIClient to create image generation requests and handles the responses. The ImageGenerationAgent is integrated into the AIScope class, providing methods to generate images with or without variables and serialize the response to a specified format.
Input Checking - The method checkInput has been moved from the LLMAgent class to a standalone function. This change improves code reusability as the input-checking logic can now be used by other agents as well.
Update to OpenAIClient - The OpenAIClient interface and its implementation KtorOpenAIClient have been updated to include a method for creating image generation requests. The ImagesGenerationRequest and ImagesGenerationResponse data classes have been added to handle these requests and responses.
Test Updates - The testLLM object in ChainTestUtils.kt has been updated to include a mock implementation of the new createImages method. Not sure if there is a useful test to add, given we are calling Open AI.
Example Update - The example in Population.kt has been updated to demonstrate the new image generation feature.