wenjin272 commented on code in PR #1157:
URL: https://github.com/apache/flink-agents/pull/1157#discussion_r4119321629


##########
api/src/main/java/org/apache/flink/agents/api/event/ContextRetrievalRequestEvent.java:
##########
@@ -37,8 +37,20 @@ public ContextRetrievalRequestEvent(String query, String 
vectorStore) {
         this(query, vectorStore, DEFAULT_MAX_RESULTS);
     }
 
+    /**
+     * Creates a new context retrieval request event.
+     *
+     * @param query the search query text
+     * @param vectorStore the name of the vector store to query
+     * @param maxResults the maximum number of results to return; must be 
positive
+     * @throws IllegalArgumentException if {@code maxResults} is non-positive
+     */
     public ContextRetrievalRequestEvent(String query, String vectorStore, int 
maxResults) {
         super(EVENT_TYPE);
+        if (maxResults <= 0) {

Review Comment:
   Could we apply the same validation in the `UUID`/`attributes` constructor? 
Java’s `fromEvent()` and JSON deserialization use that constructor, so 
`max_results <= 0` still passes reconstruction and fails later in 
`VectorStoreQuery`. Python’s `from_event()` already goes through the validated 
constructor. Please add regression tests for both Java reconstruction paths.



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