CAMEL-24539: camel-openai - store embeddings and audio full responses under operation-specific properties - #26110
CAMEL-24539: camel-openai - store embeddings and audio full responses under operation-specific properties#26110oscerd wants to merge 1 commit into
Conversation
… under operation-specific properties When storeFullResponse=true, the embeddings and audio operations stored their full SDK response under CamelOpenAIResponse, the property typed as the chat-completion response (ChatCompletion). A downstream processor reading that property for its declared type received an incompatible object (for example the tool-execution producer casts it to ChatCompletion), while the chat, responses, moderation and image operations already use their own operation-specific properties. Add operation-specific properties and store each response under the matching one: - embeddings -> CamelOpenAIEmbeddingsResponse (CreateEmbeddingResponse) - audio transcription -> CamelOpenAIAudioTranscriptionResponse (TranscriptionCreateResponse) - audio translation -> CamelOpenAIAudioTranslationResponse (TranslationCreateResponse) The storeFullResponse option documentation and the 4.23 upgrade guide are updated accordingly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y1gCrVvA3FowKoRM9EvmT Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 13 tested, 24 compile-only — current: 10 all testedMaveniverse Scalpel detected 37 affected modules (current approach: 10).
|
gnodet
left a comment
There was a problem hiding this comment.
Good fix — the bug is real and the approach (operation-specific exchange properties) is consistent with what chat-completion, responses, moderation and image operations already do. The code changes to the three producers are correct.
Two gaps worth addressing:
1. Missing tests for audio transcription/translation storeFullResponse
The embeddings mock test was updated to assert the response lands under CamelOpenAIEmbeddingsResponse (and not under CamelOpenAIResponse). The same coverage is missing for the two audio operations. Given this PR exists precisely because the wrong property key was silently accepted for a long time, adding storeFullResponse tests to OpenAIAudioTranscriptionMockTest and OpenAIAudioTranslationMockTest would prevent regression on the exact same class of bug.
2. Missing operations doc updates
The upgrade guide is updated (good), but openai-operations.adoc doesn't mention storeFullResponse for embeddings, audio transcription, or audio translation — and the new headers (CamelOpenAIEmbeddingsResponse, CamelOpenAIAudioTranscriptionResponse, CamelOpenAIAudioTranslationResponse) don't appear in the output-headers tables for those sections. The image section at line 722 already documents its storeFullResponse property; the other three operations should get the same treatment.
This review was generated by an AI agent, Hermès, on behalf of @gnodet.
Issue
CAMEL-24539
Problem
With
storeFullResponse=true, the embeddings and audio operations store their full SDK response underCamelOpenAIResponse. That exchange property is typed as the chat-completion response(
com.openai.models.chat.completions.ChatCompletion), so a downstream reader that expects that typereceives an incompatible object — for example
OpenAIToolExecutionProducerreadsCamelOpenAIResponseas a
ChatCompletion. The chat, responses, moderation and image operations already use their ownoperation-specific properties (
CamelOpenAIResponsesResponse,CamelOpenAIModerationResponse,CamelOpenAIImageResponse).Fix
Add operation-specific properties and store each response under the matching one:
CamelOpenAIEmbeddingsResponse(CreateEmbeddingResponse)CamelOpenAIAudioTranscriptionResponse(TranscriptionCreateResponse)CamelOpenAIAudioTranslationResponse(TranslationCreateResponse)The
storeFullResponseoption documentation and the 4.23 upgrade guide are updated to list the newproperties. Generated catalog and endpoint-DSL metadata regenerated.
Testing
OpenAIEmbeddingsMockTest.storeFullResponseStoresEmbeddingResponsenow asserts the response is storedunder
CamelOpenAIEmbeddingsResponseand is not set under the chat-completionCamelOpenAIResponse.camel-openaiunit suite green.mvn -Psourcecheck validategreen.🤖 Generated with Claude Code