Skip to content

CAMEL-23947: Remove unwired langchain4j-chat model builder helpers#24895

Merged
davsclaus merged 2 commits into
apache:mainfrom
atiaomar1978-hub:CAMEL-23947-remove-unwired-model-builders
Jul 20, 2026
Merged

CAMEL-23947: Remove unwired langchain4j-chat model builder helpers#24895
davsclaus merged 2 commits into
apache:mainfrom
atiaomar1978-hub:CAMEL-23947-remove-unwired-model-builders

Conversation

@atiaomar1978-hub

Copy link
Copy Markdown
Contributor

CAMEL-23947 is done

What changed

Per the Jira recommendation, the unwired dead-code helpers were removed (not fixed/wired):

  1. Deleted OpenAiChatLanguageModelBuilder.java — had a bug where .logRequests(logResponses) swapped the logging flags
  2. Deleted HugginFaceChatLanguageModelBuilder.java — returned HuggingFaceLanguageModel (LanguageModel), not ChatModel
  3. Added upgrade guide note in camel-4x-upgrade-guide-4_22.adoc under === camel-langchain4j-chat

Neither builder was referenced anywhere else in the codebase; the component autowires chatModel instead.

Tests

Ran with Java 21:

.\mvnw.cmd -pl components/camel-ai/camel-langchain4j-chat test

BUILD SUCCESS — 4 tests passed (LangChain4jRagAggregatorTest). The Jira attachment reproducer test was not added because it targets code we removed.

Commit & push

These helpers were never wired into the component (chatModel is autowired)
and contained bugs. Document the removal in the 4.22 upgrade guide.

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. OpenAiChatLanguageModelBuilder.logRequests(logResponses) on line 72 passes the wrong field to logRequests() (should be .logResponses(logResponses)).
  2. HugginFaceChatLanguageModelBuilderbuild() returns HuggingFaceLanguageModel (a LanguageModel), not a ChatModel, 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.

@davsclaus

Copy link
Copy Markdown
Contributor

there is a merge conflict

@atiaomar1978-hub

Copy link
Copy Markdown
Contributor Author

@davsclaus I have resolved the merge conflicts, by considering both changes.

@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-ai/camel-langchain4j-chat
  • docs

🔬 Scalpel shadow comparison — Scalpel: 10 tested, 28 compile-only — current: 9 all tested

Maveniverse Scalpel detected 38 affected modules (current approach: 9).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 10 modules (2 direct + 8 downstream), skip tests for 28 (generated code, meta-modules)

Modules Scalpel would test (10)
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-langchain4j-chat
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
  • docs
Modules with tests skipped (28)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • components/camel-ai/camel-langchain4j-chat: 1 test(s) disabled on GitHub Actions
All tested modules (38 modules)
  • Camel :: AI :: LangChain4j :: Chat
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus added this to the 4.22.0 milestone Jul 20, 2026
@davsclaus davsclaus added the task label Jul 20, 2026
@davsclaus
davsclaus merged commit 41b304d into apache:main Jul 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants