gnodet-bot commented on code in PR #30452:
URL: https://github.com/apache/camel/pull/30452#discussion_r4634770371


##########
components/camel-ai/camel-pinecone/src/main/java/org/apache/camel/component/pinecone/transform/PineconeEmbeddingsDataTypeTransformer.java:
##########
@@ -63,9 +63,10 @@ public void transform(Message message, DataType fromType, 
DataType toType) {
         }
         TextSegment text = message.getBody(TextSegment.class);
         String indexId = message.getHeader(PineconeVectorDbHeaders.INDEX_ID, 
UUID.randomUUID(), String.class);
-        String indexName = 
message.getHeader(PineconeVectorDbHeaders.INDEX_NAME, "embeddings", 
String.class);
+        // the index name is left unset when the route does not set it, so 
that the producer uses the indexName
+        // of its endpoint; a default here would override the endpoint option, 
as the producer takes the
+        // header over the option
 

Review Comment:
   💬 **Low — orphaned comment:** The three-line comment explaining why 
`INDEX_NAME` is not set now has no code beneath it (line 69 is blank, then 
unrelated `setHeader(INDEX_ID, ...)` follows). It documents the absence of a 
line, which is fine in principle, but it reads as a dangling comment to anyone 
scanning the method.
   
   Consider moving it to the class-level Javadoc of 
`PineconeEmbeddingsDataTypeTransformer` (or the `@DataTypeTransformer` 
description), where it documents the transformer's contract rather than the 
absence of a statement. The test names already express the intent clearly 
(`theIndexNameHeaderIsLeftUnsetWithoutTheHeader`), so the comment is not 
strictly necessary inline.
   
   ```suggestion
           // CamelPineconeIndexName is intentionally not set here: if the 
route set it, it
           // passes through unchanged; if not, the producer uses its 
endpoint's indexName option.
           message.setHeader(PineconeVectorDbHeaders.INDEX_ID, indexId);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to