Camel-Milvus: create rag helpers to be used as beans#21994
Camel-Milvus: create rag helpers to be used as beans#21994smongiar wants to merge 1 commit intoapache:mainfrom
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
| private String collectionName = "rag_collection"; | ||
| private String collectionDescription = "RAG collection"; | ||
| private String idFieldName = "id"; | ||
| private String dimension = "768"; |
There was a problem hiding this comment.
why are int/long types Strings?
| import io.milvus.response.QueryResultsWrapper; | ||
| import org.apache.camel.Exchange; | ||
|
|
||
| public class RAGResultExtractor { |
|
|
||
| FieldType vectorField = FieldType.newBuilder() | ||
| .withName(vectorFieldName) | ||
| .withDataType(DataType.FloatVector) |
gnodet
left a comment
There was a problem hiding this comment.
A few observations on this PR:
-
Test changes modify what's being tested: The existing tests (
MilvusCreateCollectionTest,MilvusComponentIT) previously tested the Milvus component directly using the Milvus Java SDK APIs. The refactored tests now route through the new RAG helpers, which means they're no longer testing the raw component behavior — they're testing the helpers + component together. This could mask issues in either layer. Consider keeping the original tests as-is and adding new tests for the RAG helpers separately. -
No input validation in processors: The RAG processors like
RAGInsertandRAGUpsertsplittextFieldMappingson=and accesspair[1]without bounds checking. A malformed mapping like"content"(missing=value) would throw anArrayIndexOutOfBoundsException. Similar issue withInteger.parseInt(dimension)— invalid input gives an unhelpful error. -
dimensionandlimitas String fields: InRAGCreateCollection,dimensionis stored asStringbut always parsed toint. Same forlimitinRAGSearchandtextFieldMaxLength. Usingint/longfields directly would be more natural and catch invalid values at configuration time rather than at runtime. -
Unchecked cast warning:
exchange.getIn().getBody(List.class)inRAGInsert/RAGUpsert/RAGSearch— the@SuppressWarnings("unchecked")suppresses the warning butgetBody(List.class)could return null if the body isn't convertible. No null check before using the result.
These are minor issues. The overall approach of providing RAG helper beans is sound.
#Description
Need to collect processors and beans for more comfortable usage in route DSL definitions. Some changes involve JBang as well to make it work with camel CLI
#Target
[ X] I checked that the commit is targeting the correct branch (Camel 4 uses the main branch)
[ X] I have run mvn clean install -DskipTests locally from root folder and I have committed all auto-generated changes.