CAMEL-24533: camel-weaviate - store the document text in the object properties on CREATE/UPDATE - #25900
Conversation
|
🌟 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: 11 tested, 27 compile-only — current: 11 all testedMaveniverse Scalpel detected 38 affected modules (current approach: 11).
|
fe452fc to
6a00a88
Compare
davsclaus
left a comment
There was a problem hiding this comment.
Reviewed against the project's Jira/commit conventions and this component's git history. Commit message, CAMEL-24533: prefix, AI attribution and sign-off all look correct, and the underlying bug (embedded text silently dropped on CREATE/UPDATE) is real and confirmed against MilvusEmbeddingsDataTypeTransformer's pattern.
However, CI is red for a reason directly caused by this diff (not flaky infra): LangChain4jEmbeddingsComponentWeaviateTargetIT.querybyid fails with Expecting actual: {"text"="hi"} to contain key: "sky". See the inline comment for the root cause and a suggested fix direction.
This review does not replace specialized tools such as CodeRabbit, Sourcery, or SonarCloud static analysis.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
Thanks @davsclaus — fixed in the latest commit. Claude Code on behalf of oscerd |
davsclaus
left a comment
There was a problem hiding this comment.
Review
Verified beyond the diff:
- Checked out the PR branch and ran the new test class (
mvn test -Dtest=WeaviateEmbeddingsDataTypeTransformerTest) — 3/3 pass. - Ran
mvn install -DskipTests -Psourcecheckoncamel-weaviate— clean, no formatting/import/license violations. - Compared against the Milvus sibling transformer (
MilvusEmbeddingsDataTypeTransformer), which this PR says it mirrors — confirmed Milvus unconditionally writestext.text(); this PR's version is slightly more defensive (null-checkstext). - Traced the
PROPERTIESheader downstream intoWeaviateVectorDbProducer.create()/updateById()(lines 130, 156) — confirmed the map this PR builds is consumed correctly by both actions. - Checked git history: this file hasn't been touched since the original port in CAMEL-22311 (2023) — the text-drop was an incomplete port, not an intentional design decision, so this fix doesn't revert any deliberate prior behavior.
- Confirmed JIRA CAMEL-24533 is correctly linked, typed
Bug, and assigned to the PR author.
Notes (non-blocking)
- CI is currently red on
build (25, false), but that failure is unrelated to this PR — it's a pre-existingmain-branch drift in generated catalog docs for unrelated AI components, being fixed separately. Not something to hold this PR on. - The second commit's approach of merging the new text/id into any existing
PROPERTIESheader (rather than overwriting it) is a nice defensive touch beyond a literal Milvus port — protects a caller who pre-populates custom properties before the transformer runs. - No upgrade-guide entry needed here — this restores previously-dropped data rather than changing a default or public behavior contract.
Good fix, well tested, no concerns.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
…roperties on CREATE/UPDATE WeaviateEmbeddingsDataTypeTransformer set the message body to the embedding vector and only wrote the optional id into the Weaviate object properties; the embedded text (the TextSegment body) was never written under textFieldName, so the source passage was silently lost. For a RAG pipeline this means the store cannot return the text that produced a match. The Milvus sibling stores the text correctly. Write the text under textFieldName into the properties for CREATE and UPDATE_BY_ID (shared setProperties helper). Also correct the default-branch message, which claimed only create and updatebyid were supported although query is handled too. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
…ad of replacing it Addresses review: setProperties unconditionally built a fresh PROPERTIES map, discarding properties the caller had already set on the message (which broke LangChain4jEmbeddingsComponentWeaviateTargetIT.querybyid). Read the existing PROPERTIES header and merge the text (and optional id) into a copy of it, only creating a new map when none exists. Extend the unit test to cover a pre-populated PROPERTIES header. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
f101438 to
b7f8841
Compare
gnodet
left a comment
There was a problem hiding this comment.
Clean bug fix — the Weaviate transformer was the only AI-component sibling (vs. Milvus, Qdrant, PgVector) that silently dropped the document text on CREATE/UPDATE. The fix correctly stores the text in the object properties, and the merge-into-existing-PROPERTIES approach with new HashMap<>(existing) is a nice defensive touch.
Non-blocking observations:
- The
queryEmbeddingOperationmethod still uses the older pattern (fresh HashMap, no sharedsetPropertieshelper). Pre-existing and out of scope for this fix, but could be aligned in a follow-up for consistency. - The null guard on
text(text != null && text.text() != null) is more defensive than the Milvus sibling — good improvement.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
…roperties on CREATE/UPDATE WeaviateEmbeddingsDataTypeTransformer set the message body to the embedding vector and only wrote the optional id into the Weaviate object properties; the embedded text (the TextSegment body) was never written under textFieldName, so the source passage was silently lost. For a RAG pipeline this means the store cannot return the text that produced a match. The Milvus sibling transformer already stores the text correctly. Write the text under textFieldName into the properties for CREATE and UPDATE_BY_ID via a shared setProperties helper, merging into any PROPERTIES header the caller already set rather than replacing it. Also correct the default-branch error message, which claimed only create and updatebyid were supported although query is handled too. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Closes #25900 (cherry picked from commit b4c20cb)
…roperties on CREATE/UPDATE WeaviateEmbeddingsDataTypeTransformer set the message body to the embedding vector and only wrote the optional id into the Weaviate object properties; the embedded text (the TextSegment body) was never written under textFieldName, so the source passage was silently lost. For a RAG pipeline this means the store cannot return the text that produced a match. The Milvus sibling transformer already stores the text correctly. Write the text under textFieldName into the properties for CREATE and UPDATE_BY_ID via a shared setProperties helper, merging into any PROPERTIES header the caller already set rather than replacing it. Also correct the default-branch error message, which claimed only create and updatebyid were supported although query is handled too. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Closes #25900 (cherry picked from commit b4c20cb)
Issue
CAMEL-24533
Problem
WeaviateEmbeddingsDataTypeTransformerbuilds the Weaviate write from the resolved parameters(
vectorFieldName,textFieldName,text, ...), but on CREATE and UPDATE_BY_ID it only set the bodyto the embedding vector and, optionally, the id property:
The embedded text (
text.text()) was never written into the properties, so the original documenttext was silently discarded. In a RAG pipeline the vector store then cannot return the source passage
that produced a match. The Milvus sibling transformer stores the text correctly — Weaviate was an
incomplete port.
Fix
Write the text under
textFieldNameinto the Weaviate object properties for CREATE and UPDATE_BY_ID(via a shared
setPropertieshelper). Also correct the default-branch error message, which said onlycreateandupdatebyidwere supported althoughqueryis handled as well.textFieldNameis a resolved header value, so this is a pure logic change — no generated metadata isaffected.
Testing
WeaviateEmbeddingsDataTypeTransformerTestasserts that CREATE and UPDATE_BY_ID write the text(under the default
textfield) and the id into theCamelWeaviatePropertiesmap.mvn -Psourcecheck validategreen.Claude Code on behalf of oscerd