Repository navigation
CAMEL-26873: camel-langchain4j-embeddings - deprecate the CamelLangChain4jEmbeddingsFinishReason header - #29794
Conversation
gnodet-bot
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
- [Nit]
LangChain4jEmbeddingsProducer.removeResultHeaders(line 188 on main) still referencesLangChain4jEmbeddingsHeaders.FINISH_REASON. That is right, because it removes a stale value, but it now uses a deprecated constant, which javac-Xlint:deprecationand 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.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
Thanks for the review, @davsclaus! I added @SuppressWarnings("deprecation") on removeResultHeaders, with a short comment on why the deprecated header is still removed. |
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 10 of 722 tested, 25 compile-only — current: 10 all testedMaveniverse 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)
Modules with tests skipped (25)
All tested modules (37 modules, 4m 52s total)Total reactor time: 4m 52s
Top 20 slowest modules:
|
davsclaus
left a comment
There was a problem hiding this comment.
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.
…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>
1ffc712 to
53faff9
Compare
|
The build failure was TextBodyFlowTest in camel-yaml-dsl-validator, which was fixed on main by #29807 (CAMEL-26012). I rebased on main. |
Description
CAMEL-26873, follow-up of CAMEL-26514 (#29654): the producer now calls
EmbeddingModel.embed(EmbeddingRequest), and anEmbeddingResponsehas no finish reason, so theCamelLangChain4jEmbeddingsFinishReasonheader 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_REASONis now@Deprecated, with adeprecationNotein@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.Headersinner class also has aFINISH_REASONconstant, but that whole class is already@Deprecatedand the catalog usesLangChain4jEmbeddingsHeaders, so it is left unchanged.Generated files: the component JSON was regenerated and copied to the catalog. The Endpoint DSL (
LangChain4jEmbeddingsEndpointBuilderFactory) needs a build ofcamel-allcomponentsto 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@Deprecatedon the method), as inAWS2S3VectorsEndpointBuilderFactory.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
mainbranch)Tracking
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 -DskipTestslocally from root folder and I have committed all auto-generated changes.AI-assisted contributions
Co-authored-bytrailers) and the PR description identifies the AI tool used.This PR was prepared with the help of Claude (Anthropic), credited with a
Co-authored-bytrailer in the commit.