rosemarYuan commented on code in PR #869:
URL: https://github.com/apache/flink-agents/pull/869#discussion_r3524361800
##########
api/src/main/java/org/apache/flink/agents/api/event/ChatResponseEvent.java:
##########
@@ -46,7 +48,10 @@ public ChatResponseEvent(
setAttr("total_retry_wait_sec", totalRetryWaitSec);
}
- public ChatResponseEvent(UUID id, Map<String, Object> attributes) {
+ @JsonCreator
+ public ChatResponseEvent(
+ @JsonProperty("id") UUID id,
+ @JsonProperty("attributes") Map<String, Object> attributes) {
super(id, EVENT_TYPE, attributes);
Review Comment:
Thanks for the review suggestion. I agree this should be normalized before
replay dispatch.
I did it in the JSON creator rather than in dispatch: the` (UUID, Map)`
constructor is the Jackson recovery entry point for each concrete built-in
event, so normalizing there makes the recovered object match the live-path
shape immediately, without the runtime needing to know how to hydrate arbitrary
event subclasses.
For each built-in event with typed nested attributes (`ChatRequestEvent,
ChatResponseEvent, ToolResponseEvent, ContextRetrievalResponseEvent`), I moved
its `fromEvent() `conversion into a per-event `normalizeAttributes` helper that
the creator calls. Both paths now produce identical typed attributes, so a
concrete-signature action calling e.g. `getResponse()` on a replayed event no
longer hits a `ClassCastException`.
--
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]