Skip to content

CAMEL-26873: camel-langchain4j-embeddings - deprecate the CamelLangChain4jEmbeddingsFinishReason header - #29794

Merged
davsclaus merged 2 commits into
apache:mainfrom
urunni88:CAMEL-26873-deprecate-finish-reason
Nov 13, 2026
Merged

davsclaus merged 2 commits into
apache:mainfrom
urunni88:CAMEL-26873-deprecate-finish-reason

Conversation

@urunni88

@urunni88 urunni88 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

CAMEL-26873, follow-up of CAMEL-26514 (#29654): the producer now calls EmbeddingModel.embed(EmbeddingRequest), and an EmbeddingResponse has no finish reason, so the CamelLangChain4jEmbeddingsFinishReason header is no longer set. It was still declared with @Metadata, so the catalog and the component doc listed a header the producer never sets.

LangChain4jEmbeddingsHeaders.FINISH_REASON is now @Deprecated, with a deprecationNote in @Metadata. The constant is kept, so code that references it still compiles, and the producer still removes a stale value of it.

The legacy LangChain4jEmbeddings.Headers inner class also has a FINISH_REASON constant, but that whole class is already @Deprecated and the catalog uses LangChain4jEmbeddingsHeaders, so it is left unchanged.

Generated files: the component JSON was regenerated and copied to the catalog. The Endpoint DSL (LangChain4jEmbeddingsEndpointBuilderFactory) needs a build of camel-allcomponents to regenerate, so I updated it by hand to match the generator's output for other deprecated headers (the description with the deprecation note in the javadoc, wrapped at 80 columns, and @Deprecated on the method), as in AWS2S3VectorsEndpointBuilderFactory.

No behavior change, so no upgrade guide entry: the 4.24 guide already says the header is no longer set. The tests of camel-langchain4j-embeddings pass.

Target

  • I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)

Tracking

  • If this is a large change, bug fix, or code improvement, I checked there is a JIRA issue filed for the change (usually before you start working on it).

Apache Camel coding standards and style

  • I checked that each commit in the pull request has a meaningful subject line and body.

  • I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.

AI-assisted contributions

  • 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.

@gnodet-bot gnodet-bot 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.

LGTM. The deprecation is applied consistently: @Deprecated + deprecationNote on the constant in LangChain4jEmbeddingsHeaders, both generated JSON catalogs updated with deprecated:true and the deprecation note, and the DSL factory method marked @Deprecated with the updated Javadoc. The PR description correctly explains why LangChain4jEmbeddings.Headers.FINISH_REASON (the legacy deprecated inner class) is intentionally left unchanged — that entire class is already @Deprecated since 4.15 and is not the subject of this fix. No behavior change; no tests needed.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@davsclaus davsclaus 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.

Thanks for closing this loose end from CAMEL-26514. The catalog no longer advertises a header the producer never sets, and the constant stays, so code that uses it still compiles.

I checked it against the conventions. @Deprecated with a deprecationNote in @Metadata on LangChain4jEmbeddingsHeaders.FINISH_REASON gives the same JSON shape as other headers deprecated in 4.24 (for example CamelAwsStsSecretKey in aws2-sts.json: "deprecated": true, a deprecationNote, and the note added to the description). The component JSON and the catalog copy are identical. The hand-edited LangChain4jEmbeddingsEndpointBuilderFactory matches what the generator writes for a deprecated header: the note in the Javadoc, wrapped at 80 columns, and @Deprecated on the method, as in STS2EndpointBuilderFactory. The 4.24 upgrade guide already says the header is no longer set, so no new entry is needed. The doc page gets its header table from the JSON, so nothing else needs to change.

  1. [Nit] LangChain4jEmbeddingsProducer.removeResultHeaders (line 188 on main) still references LangChain4jEmbeddingsHeaders.FINISH_REASON. That is right, because it removes a stale value, but it now uses a deprecated constant, which javac -Xlint:deprecation and Sonar (S1874) flag. If you want to keep the build quiet, add @SuppressWarnings("deprecation") on that method with a short comment. Optional.

Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@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.

@urunni88

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @davsclaus! I added @SuppressWarnings("deprecation") on removeResultHeaders, with a short comment on why the deprecated header is still removed.

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • catalog/camel-catalog
  • components/camel-ai/camel-langchain4j-embeddings
  • dsl/camel-endpointdsl

🔬 Scalpel shadow comparison — Scalpel: 10 of 722 tested, 25 compile-only — current: 10 all tested

Maveniverse Scalpel detected 10 affected modules (current approach: 10).

Skip-tests mode would test 10 modules (3 direct + 9 downstream), skip tests for 25 (generated code, meta-modules)

Modules Scalpel would test (10)
  • camel-jbang-mcp ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-mcp ← downstream of org.apache.camel:camel-jbang-core
  • camel-jbang-plugin-tui ← downstream of org.apache.camel:camel-catalog
  • camel-jbang-plugin-validate ← downstream of org.apache.camel:camel-yaml-dsl-validator
  • camel-jbang-run ← downstream of org.apache.camel:camel-catalog
  • camel-langchain4j-embeddings ← components/camel-ai/camel-langchain4j-embeddings/src/generated/resources/META-INF/org/apache/camel/component/langchain4j/embeddings/langchain4j-embeddings.json, components/camel-ai/camel-langchain4j-embeddings/src/main/java/org/apache/camel/component/langchain4j/embeddings/LangChain4jEmbeddingsHeaders.java, components/camel-ai/camel-langchain4j-embeddings/src/main/java/org/apache/camel/component/langchain4j/embeddings/LangChain4jEmbeddingsProducer.java
  • camel-langchain4j-embeddingstore ← downstream of org.apache.camel:camel-langchain4j-embeddings
  • camel-launcher-container ← downstream of org.apache.camel:camel-launcher
  • camel-yaml-dsl-validator ← downstream of org.apache.camel:camel-catalog
  • camel-yaml-dsl-validator-maven-plugin ← downstream of org.apache.camel:camel-yaml-dsl-validator
Modules with tests skipped (25)
  • apache-camel
  • camel-allcomponents
  • camel-catalog-console
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • 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

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

All tested modules (37 modules, 4m 52s total)

Total reactor time: 4m 52s

Module Duration Status
Camel :: JBang :: Plugin :: TUI 44.1s SUCCESS
Camel :: JBang :: MCP 41.0s SUCCESS
Camel :: AI :: LangChain4j :: EmbeddingStore 22.5s SUCCESS
Camel :: JBang :: Plugin :: Validate 21.9s SUCCESS
Camel :: YAML DSL :: Validator 18.9s SUCCESS
Camel :: YAML DSL 16.8s SUCCESS
Camel :: Catalog :: Camel Catalog 15.4s SUCCESS
Camel :: Component DSL 14.3s SUCCESS
Camel :: JBang :: Run 12.9s SUCCESS
Camel :: Docs 10.1s SUCCESS
Camel :: JBang :: Plugin :: Kubernetes 9.8s SUCCESS
Camel :: JBang :: Plugin :: Testing 9.5s SUCCESS
Camel :: Kamelet Main 9.4s SUCCESS
Camel :: Catalog :: Camel Report Maven Plugin 6.3s SUCCESS
Camel :: JBang :: Plugin :: Generate 5.3s SUCCESS
Camel :: Catalog :: Camel Route Parser 5.1s SUCCESS
Camel :: Assembly 4.5s SUCCESS
Camel :: YAML DSL :: Deserializers 4.5s SUCCESS
Camel :: All Components Sync point 3.3s SUCCESS
Camel :: YAML DSL :: Validator Maven Plugin 2.7s SUCCESS
Camel :: YAML DSL :: Maven Plugins 2.2s SUCCESS
Camel :: Catalog :: Maven 1.9s SUCCESS
Camel :: Catalog :: Suggest (deprecated) 1.9s SUCCESS
Camel :: JBang :: Plugin :: MCP 1.2s SUCCESS
Camel :: Coverage 1.2s SUCCESS
Camel :: Catalog :: Dummy Component 1.1s SUCCESS
Camel :: JBang :: Main 0.9s SUCCESS
Camel :: JBang :: Plugin :: Edit 0.8s SUCCESS
Camel :: Catalog :: Console 0.7s SUCCESS
Camel :: Endpoint DSL :: Support 0.7s SUCCESS
Camel :: JBang :: Integration tests 0.6s SUCCESS
Camel :: Launcher :: Container 0.5s SUCCESS
Camel :: AI :: LangChain4j :: Embedding n/a
Camel :: Endpoint DSL n/a
Camel :: Integration Tests n/a
Camel :: JBang :: Core n/a
Camel :: Launcher n/a

Top 20 slowest modules:

  • Camel :: JBang :: Plugin :: TUI (44.1s)
  • Camel :: JBang :: MCP (41.0s)
  • Camel :: AI :: LangChain4j :: EmbeddingStore (22.5s)
  • Camel :: JBang :: Plugin :: Validate (21.9s)
  • Camel :: YAML DSL :: Validator (18.9s)
  • Camel :: YAML DSL (16.8s)
  • Camel :: Catalog :: Camel Catalog (15.4s)
  • Camel :: Component DSL (14.3s)
  • Camel :: JBang :: Run (12.9s)
  • Camel :: Docs (10.1s)
  • Camel :: JBang :: Plugin :: Kubernetes (9.8s)
  • Camel :: JBang :: Plugin :: Testing (9.5s)
  • Camel :: Kamelet Main (9.4s)
  • Camel :: Catalog :: Camel Report Maven Plugin (6.3s)
  • Camel :: JBang :: Plugin :: Generate (5.3s)
  • Camel :: Catalog :: Camel Route Parser (5.1s)
  • Camel :: Assembly (4.5s)
  • Camel :: YAML DSL :: Deserializers (4.5s)
  • Camel :: All Components Sync point (3.3s)
  • Camel :: YAML DSL :: Validator Maven Plugin (2.7s)

⚙️ View full build and test results

@davsclaus davsclaus 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.

Thanks for following up on the nit. @SuppressWarnings("deprecation") on removeResultHeaders keeps the build quiet, and the comment explains why the deprecated header is still removed. LGTM.


Reviewed with Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

urunni88 and others added 2 commits November 13, 2026 17:41
…ain4jEmbeddingsFinishReason header

The producer no longer sets this header since CAMEL-26514, as the EmbeddingResponse of LangChain4j has no finish reason.

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Claude <noreply@anthropic.com>
@urunni88
urunni88 force-pushed the CAMEL-26873-deprecate-finish-reason branch from 1ffc712 to 53faff9 Compare November 13, 2026 12:11
@urunni88

Copy link
Copy Markdown
Contributor Author

The build failure was TextBodyFlowTest in camel-yaml-dsl-validator, which was fixed on main by #29807 (CAMEL-26012). I rebased on main.

@davsclaus davsclaus added this to the 4.24.0 milestone Nov 13, 2026
@davsclaus davsclaus added the enhancement New feature or request label Nov 13, 2026
@davsclaus
davsclaus merged commit ddead8e into apache:main Nov 13, 2026
6 checks passed
@urunni88
urunni88 deleted the CAMEL-26873-deprecate-finish-reason branch November 13, 2026 16:21
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