eemario commented on code in PR #1206:
URL: https://github.com/apache/flink-agents/pull/1206#discussion_r4256101435
##########
api/src/main/java/org/apache/flink/agents/api/agents/ReActAgent.java:
##########
@@ -152,32 +205,60 @@ public static void startAction(Event event, RunnerContext
ctx) {
}
} else {
if (userPrompt == null) {
- throw new RuntimeException(
- String.format(
- "The input type is %s, which is not primitive
types,"
- + " user should provide prompt to help
convert it to ChatMessage",
- input.getClass()));
- }
-
- Map<String, String> fields = new HashMap<>();
- if (input instanceof Row) {
- Row userInput = (Row) input;
- for (String name :
Objects.requireNonNull(userInput.getFieldNames(true))) {
- fields.put(name, String.valueOf(userInput.getField(name)));
- }
- } else { // regard as pojo
- ObjectMapper objectMapper = new ObjectMapper();
- try {
- fields =
mapper.readValue(objectMapper.writeValueAsString(input), Map.class);
- } catch (JsonProcessingException e) {
+ if (isDefaultSubagentInputMap(input)) {
Review Comment:
Fixed. ReActAgent now records whether its own action declared the built-in
user prompt and output schema, and resolves those private prompt resources only
when the active scope declares them. This preserves ordinary resource fallback
while preventing an unconfigured child from inheriting the parent's private
prompts. I added parent-configured/child-unconfigured regression coverage.
--
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]