CAMEL-23947: Remove unwired langchain4j-chat model builder helpers#24895
Conversation
These helpers were never wired into the component (chatModel is autowired) and contained bugs. Document the removal in the 4.22 upgrade guide.
gnodet
left a comment
There was a problem hiding this comment.
Review: CAMEL-23947 — Remove unwired langchain4j-chat model builder helpers
Clean removal of two dead-code helper classes, both of which contained bugs confirming they were never actively used:
OpenAiChatLanguageModelBuilder—.logRequests(logResponses)on line 72 passes the wrong field tologRequests()(should be.logResponses(logResponses)).HugginFaceChatLanguageModelBuilder—build()returnsHuggingFaceLanguageModel(aLanguageModel), not aChatModel, contradicting the class name.
Neither class was referenced anywhere in the codebase — the component autowires chatModel directly. Removing rather than fixing is the right call per the JIRA recommendation.
The upgrade guide entry is correctly placed and provides clear migration guidance (use LangChain4j's own builders or Spring Boot starters).
LGTM ✅
AI-generated review — Claude Code on behalf of gnodet.
Review based on code analysis only; tests were not executed.
|
there is a merge conflict |
|
@davsclaus I have resolved the merge conflicts, by considering both changes. |
|
🌟 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: 10 tested, 28 compile-only — current: 9 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 9).
|
CAMEL-23947 is done
What changed
Per the Jira recommendation, the unwired dead-code helpers were removed (not fixed/wired):
OpenAiChatLanguageModelBuilder.java— had a bug where.logRequests(logResponses)swapped the logging flagsHugginFaceChatLanguageModelBuilder.java— returnedHuggingFaceLanguageModel(LanguageModel), notChatModelcamel-4x-upgrade-guide-4_22.adocunder=== camel-langchain4j-chatNeither builder was referenced anywhere else in the codebase; the component autowires
chatModelinstead.Tests
Ran with Java 21:
BUILD SUCCESS — 4 tests passed (
LangChain4jRagAggregatorTest). The Jira attachment reproducer test was not added because it targets code we removed.Commit & push
4e2522e7bd1—CAMEL-23947: Remove unwired langchain4j-chat model builder helpers