This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 57027be8671e CAMEL-24648: camel-openai - add storeFullResponse tests 
for audio operations and document it for embeddings/audio (#26188)
57027be8671e is described below

commit 57027be8671e4818ccf6723b26bde92595fcb4ae
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Sep 8 13:50:25 2026 +0200

    CAMEL-24648: camel-openai - add storeFullResponse tests for audio 
operations and document it for embeddings/audio (#26188)
    
    Follow-up to CAMEL-24539. Add storeFullResponse coverage to 
OpenAIAudioTranscriptionMockTest and
    OpenAIAudioTranslationMockTest, each asserting the full response lands 
under the operation-specific
    property (CamelOpenAIAudioTranscriptionResponse / 
CamelOpenAIAudioTranslationResponse) and not under the
    chat-completion CamelOpenAIResponse. Document storeFullResponse for the 
embeddings, audio transcription
    and audio translation operations in openai-operations.adoc, mirroring the 
image operation.
    
    Co-Authored-By: Claude Opus 4.8 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01HLufhRHi2YZc6yQFkAok6n
    Signed-off-by: Andrea Cosentino <[email protected]>
---
 .../apache/camel/catalog/docs/openai-operations.adoc  |  6 ++++++
 .../camel-openai/src/main/docs/openai-operations.adoc |  6 ++++++
 .../openai/OpenAIAudioTranscriptionMockTest.java      | 17 +++++++++++++++++
 .../openai/OpenAIAudioTranslationMockTest.java        | 19 +++++++++++++++++++
 4 files changed, 48 insertions(+)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-operations.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-operations.adoc
index 10b05e4d7282..7188c55c03d0 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-operations.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/openai-operations.adoc
@@ -168,6 +168,8 @@ The following headers are set after an embeddings request:
 | `CamelOpenAISimilarityScore` | Double | Cosine similarity (if reference 
embedding provided)
 |===
 
+Set `storeFullResponse=true` to keep the complete SDK response in the 
`CamelOpenAIEmbeddingsResponse` exchange property.
+
 == Moderation Operation
 
 The `moderation` operation checks text against the OpenAI usage policies. It 
is the canonical pre-filter for untrusted
@@ -362,6 +364,8 @@ Supported audio formats: flac, mp3, mp4, mpeg, mpga, m4a, 
ogg, wav, webm.
 | `CamelOpenAIAudioDetectedLanguage` | String | Language detected in the audio 
(verbose_json only)
 |===
 
+Set `storeFullResponse=true` to keep the complete SDK response in the 
`CamelOpenAIAudioTranscriptionResponse` exchange property.
+
 === Audio Models by Provider
 
 [cols="1,2,3"]
@@ -501,6 +505,8 @@ NOTE: The translation operation always outputs English 
text, so it does not acce
 | `CamelOpenAIAudioDetectedLanguage` | String | Source language detected in 
the audio (verbose_json only)
 |===
 
+Set `storeFullResponse=true` to keep the complete SDK response in the 
`CamelOpenAIAudioTranslationResponse` exchange property.
+
 == Audio Speech (Text-to-Speech) Operation
 
 The `audio-speech` operation synthesizes spoken audio from text using OpenAI's 
`POST /v1/audio/speech` endpoint. The message body is the input text, and the 
produced body is the generated audio as a `byte[]`. The `Content-Type` header 
is set based on the selected response format, so the result chains naturally 
into `file:`, object storage, or messaging endpoints.
diff --git 
a/components/camel-ai/camel-openai/src/main/docs/openai-operations.adoc 
b/components/camel-ai/camel-openai/src/main/docs/openai-operations.adoc
index 10b05e4d7282..7188c55c03d0 100644
--- a/components/camel-ai/camel-openai/src/main/docs/openai-operations.adoc
+++ b/components/camel-ai/camel-openai/src/main/docs/openai-operations.adoc
@@ -168,6 +168,8 @@ The following headers are set after an embeddings request:
 | `CamelOpenAISimilarityScore` | Double | Cosine similarity (if reference 
embedding provided)
 |===
 
+Set `storeFullResponse=true` to keep the complete SDK response in the 
`CamelOpenAIEmbeddingsResponse` exchange property.
+
 == Moderation Operation
 
 The `moderation` operation checks text against the OpenAI usage policies. It 
is the canonical pre-filter for untrusted
@@ -362,6 +364,8 @@ Supported audio formats: flac, mp3, mp4, mpeg, mpga, m4a, 
ogg, wav, webm.
 | `CamelOpenAIAudioDetectedLanguage` | String | Language detected in the audio 
(verbose_json only)
 |===
 
+Set `storeFullResponse=true` to keep the complete SDK response in the 
`CamelOpenAIAudioTranscriptionResponse` exchange property.
+
 === Audio Models by Provider
 
 [cols="1,2,3"]
@@ -501,6 +505,8 @@ NOTE: The translation operation always outputs English 
text, so it does not acce
 | `CamelOpenAIAudioDetectedLanguage` | String | Source language detected in 
the audio (verbose_json only)
 |===
 
+Set `storeFullResponse=true` to keep the complete SDK response in the 
`CamelOpenAIAudioTranslationResponse` exchange property.
+
 == Audio Speech (Text-to-Speech) Operation
 
 The `audio-speech` operation synthesizes spoken audio from text using OpenAI's 
`POST /v1/audio/speech` endpoint. The message body is the input text, and the 
produced body is the generated audio as a `byte[]`. The `Content-Type` header 
is set based on the selected response format, so the result chains naturally 
into `file:`, object storage, or messaging endpoints.
diff --git 
a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranscriptionMockTest.java
 
b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranscriptionMockTest.java
index 427791d4325c..38235b168655 100644
--- 
a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranscriptionMockTest.java
+++ 
b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranscriptionMockTest.java
@@ -64,6 +64,10 @@ public class OpenAIAudioTranscriptionMockTest extends 
CamelTestSupport {
                         .to("openai:audio-transcription?apiKey=dummy&baseUrl="
                             + openAIMock.getBaseUrl() + "/v1");
 
+                from("direct:transcribe-store-response")
+                        
.to("openai:audio-transcription?audioModel=whisper-1&apiKey=dummy&storeFullResponse=true&baseUrl="
+                            + openAIMock.getBaseUrl() + "/v1");
+
                 from("file:" + tempDir.toString() + 
"?noop=true&initialDelay=0&delay=100")
                         
.to("openai:audio-transcription?audioModel=whisper-1&apiKey=dummy&baseUrl="
                             + openAIMock.getBaseUrl() + "/v1")
@@ -156,4 +160,17 @@ public class OpenAIAudioTranscriptionMockTest extends 
CamelTestSupport {
         assertTrue(result.getException() instanceof IllegalArgumentException);
         assertTrue(result.getException().getMessage().contains("Audio model 
must be specified"));
     }
+
+    @Test
+    void storeFullResponseStoresTranscriptionResponse() {
+        byte[] audioBytes = new byte[] { 0x00, 0x01, 0x02 };
+
+        Exchange result = template.request("direct:transcribe-store-response", 
e -> e.getIn().setBody(audioBytes));
+
+        assertNull(result.getException());
+        
assertNotNull(result.getProperty(OpenAIConstants.AUDIO_TRANSCRIPTION_RESPONSE),
+                "storeFullResponse=true must store the full transcription 
response in the CamelOpenAIAudioTranscriptionResponse property");
+        assertNull(result.getProperty(OpenAIConstants.RESPONSE),
+                "the transcription response must not be stored under the 
chat-completion CamelOpenAIResponse property");
+    }
 }
diff --git 
a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranslationMockTest.java
 
b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranslationMockTest.java
index 73147c44a630..f76cbea5b7ae 100644
--- 
a/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranslationMockTest.java
+++ 
b/components/camel-ai/camel-openai/src/test/java/org/apache/camel/component/openai/OpenAIAudioTranslationMockTest.java
@@ -61,6 +61,10 @@ public class OpenAIAudioTranslationMockTest extends 
CamelTestSupport {
                         .to("openai:audio-translation?apiKey=dummy&baseUrl="
                             + openAIMock.getBaseUrl() + "/v1");
 
+                from("direct:translate-store-response")
+                        
.to("openai:audio-translation?audioModel=whisper-1&apiKey=dummy&storeFullResponse=true&baseUrl="
+                            + openAIMock.getBaseUrl() + "/v1");
+
                 from("file:" + tempDir.toString() + 
"?noop=true&initialDelay=0&delay=100")
                         
.to("openai:audio-translation?audioModel=whisper-1&apiKey=dummy&baseUrl="
                             + openAIMock.getBaseUrl() + "/v1")
@@ -153,4 +157,19 @@ public class OpenAIAudioTranslationMockTest extends 
CamelTestSupport {
                 .isInstanceOf(IllegalArgumentException.class)
                 .hasMessageContaining("Audio model must be specified");
     }
+
+    @Test
+    void storeFullResponseStoresTranslationResponse() {
+        byte[] audioBytes = new byte[] { 0x00, 0x01, 0x02 };
+
+        Exchange result = template.request("direct:translate-store-response", 
e -> e.getIn().setBody(audioBytes));
+
+        assertThat(result.getException()).isNull();
+        
assertThat(result.getProperty(OpenAIConstants.AUDIO_TRANSLATION_RESPONSE))
+                .as("storeFullResponse=true must store the full translation 
response under CamelOpenAIAudioTranslationResponse")
+                .isNotNull();
+        assertThat(result.getProperty(OpenAIConstants.RESPONSE))
+                .as("the translation response must not be stored under the 
chat-completion CamelOpenAIResponse property")
+                .isNull();
+    }
 }

Reply via email to