diff --git a/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java b/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java index a745f62fcf..4cfd6c6607 100644 --- a/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java +++ b/ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/remote/ConnectorUtils.java @@ -192,7 +192,7 @@ public static ModelTensors processOutput( if (modelResponse == null) { throw new IllegalArgumentException("model response is null"); } - if (mlGuard != null && mlGuard.validate(modelResponse, MLGuard.Type.OUTPUT)) { + if (mlGuard != null && !mlGuard.validate(modelResponse, MLGuard.Type.OUTPUT)) { throw new IllegalArgumentException("guardrails triggered for LLM output"); } List modelTensors = new ArrayList<>();