twosom commented on code in PR #279:
URL: https://github.com/apache/flink-agents/pull/279#discussion_r2448471007
##########
plan/src/main/java/org/apache/flink/agents/plan/actions/ChatModelAction.java:
##########
@@ -118,6 +120,34 @@ public static void chat(
}
}
+ /**
+ * Checks if the provided list of chat messages is an immutable collection.
+ *
+ * <p>This method determines whether the list is an instance of Java's
immutable collections by
+ * checking specific class name patterns used by the JDK implementation.
+ *
+ * <p>Note: This implementation is JDK-specific and may need updates if
the JDK's internal
+ * implementation changes in future versions.
+ *
+ * @param maybeImmutableList The list of chat messages to check
+ * @return {@code true} if the list is an immutable collection, {@code
false} otherwise
+ */
+ private static boolean isImmutable(List<ChatMessage> maybeImmutableList) {
Review Comment:
@xintongsong
Thanks for the feedback! I've updated it to always create a copy of the
message list.
--
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]