purushah commented on code in PR #964:
URL: https://github.com/apache/flink-agents/pull/964#discussion_r3791042846
##########
plan/src/main/java/org/apache/flink/agents/plan/actions/ChatModelAction.java:
##########
@@ -503,7 +971,14 @@ private static void processToolResponse(ToolResponseEvent
event, RunnerContext c
Collections.emptyList(),
toolResponseMessages);
- chat(initialRequestId, model, messages, promptArgs, outputSchema, ctx);
+ // Tool rounds reuse the already-selected concrete model (no
re-routing); if the initial
+ // request was routed, carry its routing metadata onto the eventual
final response.
+ Map<String, Object> routingMetadata = (Map<String, Object>)
context.get(ROUTING);
Review Comment:
Good suggestion — implemented. The metadata is now stored once, keyed by the
initial request id, attached to the loop's final response, and cleaned up on
every loop exit. `RoutingSelection.carried(...)` is gone and intermediate
messages are no longer stamped; the tool-round tests assert both (including a
mutation-verified cleanup test for the abandoned-loop path).
##########
plan/src/main/java/org/apache/flink/agents/plan/actions/ChatModelAction.java:
##########
@@ -67,6 +105,121 @@ public class ChatModelAction {
private static final ObjectMapper mapper = new ObjectMapper();
+ private static final class RoutingSelection {
Review Comment:
Done — extracted `ResolvedModelRoute`, `ModelRoutingResolver`, and
`ChatModelInvoker` as you sketched. `ChatModelAction` is down to ~690 lines of
event orchestration. No behavior change; full suites green. One heads-up: the
retry warning now logs under `ChatModelInvoker`'s logger, so log alerting keyed
to the old logger name would need updating.
--
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]