ravismash commented on PR #1435:
URL: https://github.com/apache/flink-agents/pull/1435#issuecomment-7132327050

   > Thanks for the fix. I checked it on this branch 
([9acba1b](https://github.com/apache/flink-agents/commit/9acba1b678625cb52e0ce15d3091a2622fc0d74b))
 and with the change applied on top of current main 
([0a646ef](https://github.com/apache/flink-agents/commit/0a646ef5fb369c5dd2613e3a2dc8e13d0fd0e749)).
   > 
   > On the branch, the 12 tests in `ChatModelActionTest` pass, and so does the 
plan module (772 tests), except three `BashToolTest` cases that also fail on 
main on my Windows machine. With `ChatModelAction.java` reverted to the base 
and the new tests kept, `rowSchemaOutputRejectsMissingField` fails and the 
other two new tests still pass. On the Python side, 
`_generate_structured_output` raises `KeyError` for a missing field, keeps an 
explicit `null` as `None` and ignores an extra key, which matches the table in 
the description.
   > 
   > One problem shows up only on current main. 
[#1363](https://github.com/apache/flink-agents/pull/1363), merged after this 
branch's base, lets a model router escalate when a tier's answer cannot be 
shaped into the output schema. On a tier that can still escalate, the parse 
step in `ChatModelInvoker.withOutputSchema` only treats a 
`JsonProcessingException` as the answer's fault, and `ModelRoutingExecutor` 
fails the whole request on any other exception from that step. So the 
`IllegalArgumentException` from the new check is handled like a broken schema, 
not like a bad answer.
   > 
   > To check this, I added a few tests modeled on 
`aJsonNullAnswerUnderARowSchemaIsRejectedAndEscalates`: a router with tiers 
`small` and `big`, a row schema `(answer, source)`, and `small` answering 
`{"answer":"41"}`. With this PR applied on main, the request fails with that 
`IllegalArgumentException`: `small` is called once, there is no escalation 
event, and `big` is never called. With the same schema, an answer that is not 
JSON escalates to `big`. On the last tier, the missing field is retried, as the 
description says. `model_routing.md` says that an answer that cannot satisfy 
the output schema can trigger escalation.
   > 
   > In the same method, main already throws 
`MismatchedInputException.from((JsonParser) null, Map.class, ...)` for a bare 
JSON `null`. Throwing that for a missing field too would make it an 
output-schema rejection on a tier that can escalate, and keep it a retried 
failure everywhere else. I tried this locally: my tests pass, and so do the 35 
existing tests in `ChatModelActionEscalationTest`. 
`rowSchemaOutputRejectsMissingField` would then need to expect 
`MismatchedInputException`, and the failure behavior in the description would 
change to match. An escalation test like mine would cover the router path.
   > 
   > I did not test against a real model.
   
   Good catch. I rebased onto main, and a missing field now throws 
MismatchedInputException, the same as a bare null answer. A tiered route 
escalates instead of failing the request. Added 
anAnswerMissingARowSchemaFieldIsRejectedAndEscalates to 
ChatModelActionEscalationTest. It fails on the old IllegalArgumentException.


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