atiaomar1978-hub opened a new pull request, #24961:
URL: https://github.com/apache/camel/pull/24961

   ## Summary
   
   Implements [CAMEL-23966](https://issues.apache.org/jira/browse/CAMEL-23966) 
by adding the two remaining audio services of the pinned openai-java SDK to the 
`camel-openai` component:
   
   - **`audio-speech`** (text-to-speech) — the message body is the input text; 
the produced body is the generated audio as a `byte[]`, and the `Content-Type` 
header is set from the response format (e.g. `audio/mpeg`, `audio/wav`) so it 
chains naturally into `file:`, object storage, or messaging endpoints. New 
options: `speechModel`, `speechVoice` (default `alloy`), `speechResponseFormat` 
(default `mp3`), `speechSpeed`, `speechInstructions`, plus matching 
`CamelOpenAISpeech*` headers.
   - **`audio-translation`** (transcribe-and-translate to English) — mirrors 
`audio-transcription` and reuses the existing `audio*` options and headers 
(model, prompt, response format, temperature).
   
   Both reuse the existing client, SSL and auth infrastructure. Shared 
multipart file-input handling is extracted into a new `OpenAIAudioSupport` 
helper and reused by the transcription and translation producers (removing 
duplication).
   
   ### Example usage
   
   ```java
   // text-to-speech: turn an LLM answer into an mp3 and drop it on object 
storage
   from("direct:speak")
       .to("openai:chat-completion?model=gpt-5")
       
.to("openai:audio-speech?speechModel=gpt-4o-mini-tts&speechVoice=alloy&speechResponseFormat=mp3")
       .to("aws2-s3://announcements?keyName=answer-${exchangeId}.mp3");
   
   // translate any incoming voice message to English text
   from("file:inbox/voicemail?noop=true")
       .to("openai:audio-translation?audioModel=whisper-1")
       .log("English transcript: ${body}");
   ```
   
   ## Changes
   
   - `OpenAIOperations`: new `audioSpeech` and `audioTranslation` values
   - `OpenAIAudioSpeechProducer`, `OpenAIAudioTranslationProducer`: new 
producers
   - `OpenAIAudioSupport`: shared file-input / parameter-resolution helper; 
`OpenAIAudioTranscriptionProducer` refactored to use it
   - `OpenAIConfiguration` / `OpenAIConstants` / `OpenAIEndpoint`: new options, 
headers and wiring
   - `camel-test-infra-openai-mock`: mock server now serves `/audio/speech` 
(binary) and `/audio/translations`, with `whenSpeech()` / `replyWithSpeech()` 
and `whenTranslation()` / `replyWithTranslation()` builder methods
   - Documentation updated (`openai-component.adoc`, `openai-operations.adoc`) 
and generated metadata regenerated
   
   ## Test plan
   
   - [x] `OpenAIAudioSpeechMockTest` (6 tests): audio bytes returned, 
content-type per format, header overrides, missing model / missing input errors
   - [x] `OpenAIAudioTranslationMockTest` (7 tests): File / Path / byte[] / 
InputStream bodies, header overrides, file-component route, missing model error
   - [x] Existing `OpenAIAudioTranscription*` and SSL/mTLS tests still pass 
after the shared refactor (21 audio + 17 SSL tests green locally)
   
   ---
   _Authored by Cursor Agent (Opus 4.8) on behalf of @atiaomar1978-hub._
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to