CodeTrainerMan opened a new pull request, #1144: URL: https://github.com/apache/flink-agents/pull/1144
## What `BaseVectorStore#query(VectorStoreQuery)` unboxes `query.getLimit()` (an `Integer`) into the `int limit` parameter of `queryEmbedding`, so: - a `null` limit fails with a bare `NullPointerException` at the call site, with no mention of the parameter - while `BaseVectorStore#get`'s Javadoc explicitly documents `limit=null` as "unbounded", so passing null is a natural thing to do; - a negative limit is forwarded to the backend as-is (Chroma's `n_results=-1`, OpenSearch's `size`, ...), surfacing as an unrelated store error or an empty result. The Python `VectorStoreQuery.limit` field had no lower bound either, so the two languages did not share a contract. ## Changes - Java `VectorStoreQuery`: reject a `null` or negative `limit` in the constructor with an `IllegalArgumentException` naming the parameter. All four constructors delegate to the one that validates, so every entry point is covered. - Python `VectorStoreQuery.limit`: add `ge=0`. Zero and positive limits keep their current behavior, and the Python default of `10` is unchanged. ## Tests - New `VectorStoreQueryTest` (Java, 4 cases): null and negative rejected, zero and positive accepted. - New `test_vector_store_query.py` (Python, 3 cases): negative rejected, zero/positive accepted, default unchanged. Verified with a before/after check: with the fix stashed, 3 of the 4 Java cases fail (the null one with `NullPointerException`); with it applied, all pass. Full `api` module suite: 447 tests, 0 failures. -- 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]
