diff --git a/extended/src/main/java/apoc/ml/OpenAI.java b/extended/src/main/java/apoc/ml/OpenAI.java index 1a659f21ef..4bc4814b33 100644 --- a/extended/src/main/java/apoc/ml/OpenAI.java +++ b/extended/src/main/java/apoc/ml/OpenAI.java @@ -3,11 +3,11 @@ import apoc.ApocConfig; import apoc.Extended; import apoc.result.MapResult; -import apoc.util.ExtendedMapUtils; import apoc.util.ExtendedUtil; import apoc.util.JsonUtil; import apoc.util.Util; import com.fasterxml.jackson.core.JsonProcessingException; +import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.neo4j.graphdb.security.URLAccessChecker; import org.neo4j.procedure.Context; @@ -225,7 +225,7 @@ public Stream completion(@Name("prompt") String prompt, @Name("api_ke public Stream chatCompletion(@Name("messages") List> messages, @Name("api_key") String apiKey, @Name(value = "configuration", defaultValue = "{}") Map configuration) throws Exception { boolean failOnError = isFailOnError(configuration); if (checkNullInput(messages, failOnError)) return Stream.empty(); - messages = messages.stream().filter(ExtendedMapUtils::isNotEmpty).toList(); + messages = messages.stream().filter(MapUtils::isNotEmpty).toList(); if (checkEmptyInput(messages, failOnError)) return Stream.empty(); configuration.putIfAbsent("model", GPT_4O_MODEL); return executeRequest(apiKey, configuration, "chat/completions", (String) configuration.get("model"), "messages", messages, "$", apocConfig, urlAccessChecker) diff --git a/extended/src/main/java/apoc/util/ExtendedMapUtils.java b/extended/src/main/java/apoc/util/ExtendedMapUtils.java index 06b8ce9c6e..c6b388b07d 100644 --- a/extended/src/main/java/apoc/util/ExtendedMapUtils.java +++ b/extended/src/main/java/apoc/util/ExtendedMapUtils.java @@ -11,8 +11,4 @@ public static int size(final Map map) { public static boolean isEmpty(final Map map) { return map == null || map.isEmpty(); } - - public static boolean isNotEmpty(final Map map) { - return !isEmpty(map); - } }