[ 
https://issues.apache.org/jira/browse/CAMEL-23967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Federico Mariani updated CAMEL-23967:
-------------------------------------
    Description: 
The pinned SDK (4.41.0) exposes {{images().generate(...)}}, 
{{images().edit(...)}} and {{images().createVariation(...)}} (plus streaming 
variants), none of which are reachable from camel-openai. Image generation is a 
common integration step (product imagery pipelines, notification enrichment) 
that chains naturally into Camel's file/storage/messaging components.

Proposal: new operation {{openai:image-generation}} (and optionally 
{{image-edit}}):
* body: prompt String (edit: image file/byte[] with prompt via option/header, 
reusing the vision-input body handling and {{MimeTypeHelper}});
* options/headers: {{imageModel}} (e.g. {{gpt-image-1}}), {{imageSize}}, 
{{imageQuality}}, {{imageResponseFormat}} (b64_json/url), {{imageCount}};
* output: {{byte[]}} body for a single b64 image, {{List<byte[]>}} or URLs for 
multiple; response metadata via headers and {{storeFullResponse}}.

Intended usage:
{code:java}
// generate a product image from a description and store it
from("direct:product-image")
    .setBody(simple("Studio photo of ${header.productName} on a white 
background"))
    .to("openai:image-generation?imageModel=gpt-image-1&imageSize=1024x1024")
    .to("file:target/images?fileName=${header.productName}.png");

// edit an existing image coming from S3
from("aws2-s3:marketing-assets")
    .setHeader(OpenAIConstants.USER_MESSAGE, constant("Add a red SALE banner in 
the top-right corner"))
    .to("openai:image-edit?imageModel=gpt-image-1")
    .to("aws2-s3:marketing-assets-processed");
{code}
Variations can be a follow-up. Skip suggestion for the same review: 
{{videos()}} and {{containers()}} services — too niche for now.

Testing note: unit tests should extend {{camel-test-infra-openai-mock}} with an 
image-generation expectation (e.g. 
{{whenImageGeneration()}}/{{replyWithImage(byte[])}} serving a {{b64_json}} 
payload), like the existing embeddings/transcription mocking — no real model or 
GPU needed. No mainstream local OpenAI-compatible image backend is CI-suitable 
today (Ollama's image generation is experimental, macOS-only and has no 
OpenAI-compatible endpoint; LocalAI works but is heavyweight and 
amd64-oriented, so an optional IT would need 
{{skipITs.ppc64le}}/{{skipITs.s390x}}).

_This issue was drafted by Claude Code on behalf of Federico Mariani_

  was:
The pinned SDK (4.41.0) exposes {{images().generate(...)}}, 
{{images().edit(...)}} and {{images().createVariation(...)}} (plus streaming 
variants), none of which are reachable from camel-openai. Image generation is a 
common integration step (product imagery pipelines, notification enrichment) 
that chains naturally into Camel's file/storage/messaging components.

Proposal: new operation {{openai:image-generation}} (and optionally 
{{image-edit}}):
* body: prompt String (edit: image file/byte[] with prompt via option/header, 
reusing the vision-input body handling and {{MimeTypeHelper}});
* options/headers: {{imageModel}} (e.g. {{gpt-image-1}}), {{imageSize}}, 
{{imageQuality}}, {{imageResponseFormat}} (b64_json/url), {{imageCount}} (n);
* output: {{byte[]}} body for a single b64 image, {{List<byte[]>}} or URLs for 
multiple; response metadata via headers and {{storeFullResponse}}.

Intended usage:
{code:java}
// generate a product image from a description and store it
from("direct:product-image")
    .setBody(simple("Studio photo of ${header.productName} on a white 
background"))
    .to("openai:image-generation?imageModel=gpt-image-1&imageSize=1024x1024")
    .to("file:target/images?fileName=${header.productName}.png");

// edit an existing image coming from S3
from("aws2-s3:marketing-assets")
    .setHeader(OpenAIConstants.USER_MESSAGE, constant("Add a red SALE banner in 
the top-right corner"))
    .to("openai:image-edit?imageModel=gpt-image-1")
    .to("aws2-s3:marketing-assets-processed");
{code}
Variations can be a follow-up. Skip suggestion for the same review: 
{{videos()}} and {{containers()}} services — too niche for now.

Testing note: unit tests should extend {{camel-test-infra-openai-mock}} with an 
image-generation expectation (e.g. 
{{whenImageGeneration()}}/{{replyWithImage(byte[])}} serving a {{b64_json}} 
payload), like the existing embeddings/transcription mocking — no real model or 
GPU needed. No mainstream local OpenAI-compatible image backend is CI-suitable 
today (Ollama's image generation is experimental, macOS-only and has no 
OpenAI-compatible endpoint; LocalAI works but is heavyweight and 
amd64-oriented, so an optional IT would need 
{{skipITs.ppc64le}}/{{skipITs.s390x}}).

_This issue was drafted by Claude Code on behalf of Federico Mariani_


> camel-openai: add image generation and edit operations
> ------------------------------------------------------
>
>                 Key: CAMEL-23967
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23967
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-openai
>    Affects Versions: 4.21.0
>            Reporter: Federico Mariani
>            Priority: Minor
>              Labels: ai
>
> The pinned SDK (4.41.0) exposes {{images().generate(...)}}, 
> {{images().edit(...)}} and {{images().createVariation(...)}} (plus streaming 
> variants), none of which are reachable from camel-openai. Image generation is 
> a common integration step (product imagery pipelines, notification 
> enrichment) that chains naturally into Camel's file/storage/messaging 
> components.
> Proposal: new operation {{openai:image-generation}} (and optionally 
> {{image-edit}}):
> * body: prompt String (edit: image file/byte[] with prompt via option/header, 
> reusing the vision-input body handling and {{MimeTypeHelper}});
> * options/headers: {{imageModel}} (e.g. {{gpt-image-1}}), {{imageSize}}, 
> {{imageQuality}}, {{imageResponseFormat}} (b64_json/url), {{imageCount}};
> * output: {{byte[]}} body for a single b64 image, {{List<byte[]>}} or URLs 
> for multiple; response metadata via headers and {{storeFullResponse}}.
> Intended usage:
> {code:java}
> // generate a product image from a description and store it
> from("direct:product-image")
>     .setBody(simple("Studio photo of ${header.productName} on a white 
> background"))
>     .to("openai:image-generation?imageModel=gpt-image-1&imageSize=1024x1024")
>     .to("file:target/images?fileName=${header.productName}.png");
> // edit an existing image coming from S3
> from("aws2-s3:marketing-assets")
>     .setHeader(OpenAIConstants.USER_MESSAGE, constant("Add a red SALE banner 
> in the top-right corner"))
>     .to("openai:image-edit?imageModel=gpt-image-1")
>     .to("aws2-s3:marketing-assets-processed");
> {code}
> Variations can be a follow-up. Skip suggestion for the same review: 
> {{videos()}} and {{containers()}} services — too niche for now.
> Testing note: unit tests should extend {{camel-test-infra-openai-mock}} with 
> an image-generation expectation (e.g. 
> {{whenImageGeneration()}}/{{replyWithImage(byte[])}} serving a {{b64_json}} 
> payload), like the existing embeddings/transcription mocking — no real model 
> or GPU needed. No mainstream local OpenAI-compatible image backend is 
> CI-suitable today (Ollama's image generation is experimental, macOS-only and 
> has no OpenAI-compatible endpoint; LocalAI works but is heavyweight and 
> amd64-oriented, so an optional IT would need 
> {{skipITs.ppc64le}}/{{skipITs.s390x}}).
> _This issue was drafted by Claude Code on behalf of Federico Mariani_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to