urunni88 opened a new pull request, #29654: URL: https://github.com/apache/camel/pull/29654
# Description [CAMEL-26514](https://issues.apache.org/jira/browse/CAMEL-26514): the producer called `EmbeddingModel.embed(TextSegment)` and `embedAll(List)`, whose `Response` does not carry the model name, so the documented `CamelLangChain4jEmbeddingsResponseModel` header was never set. Following the recommendation on the JIRA, the producer now calls `embed(EmbeddingRequest)` for both a single body and a List body, and sets the header from `EmbeddingResponse.modelName()` when it is not null. As noted on the JIRA, this has two side effects, both described in the 4.24 upgrade guide: - `EmbeddingResponse` has no finish reason, so the `CamelLangChain4jEmbeddingsFinishReason` header is no longer set. Happy to deprecate that header here or in a follow-up if you prefer. - A model that only overrides `embed(TextSegment)` is bypassed: LangChain4j's default methods then call each other until a `StackOverflowError`. The stub models of `LangChain4jEmbeddingsObservabilityTest` and `LangChain4jEmbeddingsErrorMetadataTest` hit exactly this, so they now implement `embedAll(List<TextSegment>)`, as the LangChain4j models do. Test: `LangChain4jEmbeddingsObservabilityTest.shouldSetResponseModelHeader` sends a single body and a List body and checks the header on each message. It fails without the fix (the header is `null`) and passes with it. All 21 tests of the module pass. # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with the help of Claude (Anthropic), credited with a `Co-authored-by` trailer in the commit. -- 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]
