CodeTrainerMan opened a new pull request, #1157:
URL: https://github.com/apache/flink-agents/pull/1157

   ## What is the purpose of the change
   
   `ContextRetrievalRequestEvent` accepted a non-positive `max_results` and 
stored it as-is, on
   both the Java and the Python side. The value is passed straight into 
`VectorStoreQuery` by
   `ContextRetrievalAction`, so after #1144 an illegal value only fails 
**inside the action at
   runtime**, far away from where the user actually built the event. The event 
is also serialized
   and exchanged between the Java and Python runtimes, so an invalid value can 
cross the language
   boundary before it blows up.
   
   This PR rejects `max_results <= 0` at construction time, so the failure 
points at the
   parameter that is actually wrong.
   
   Fixes #1156
   
   ## Brief change log
   
   * `ContextRetrievalRequestEvent` (Java): reject a non-positive `max_results` 
with an
     `IllegalArgumentException` naming the parameter and its value, consistent 
with #1144
   * `ContextRetrievalRequestEvent` (Python): reject a non-positive 
`max_results` with a
     `ValueError`
   * Added `ContextRetrievalRequestEventTest` (Java) and 
`test_context_retrieval_event.py`
     (Python)
   
   ## Verifying this change
   
   * Java: `mvn -pl api test -Dtest=ContextRetrievalRequestEventTest` passes (4 
tests)
   * Java format: `mvn -pl api spotless:apply`
   * Python: `ruff format` and `ruff check` are clean; the Python unit tests 
require `pyflink`,
     which is not installed locally, so they are covered by CI
   
   ## Does this pull request potentially affect one of the following parts
   
   * Dependencies (does it add or upgrade a dependency): no
   * The public API: no signature change, but constructing the event with 
`max_results <= 0` now
     fails fast instead of failing later inside the action
   


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