Class AntsGuardrailsClient
java.lang.Object
com.ants.platform.guardrails.AntsGuardrailsClient
HTTP client for the ANTS guardrail ML-check API.
Guardrails are only active when an agentId is provided AND the
agent has a guardrail policy configured on the platform. If no policy exists,
the client caches that fact and skips HTTP calls on subsequent requests.
var guardrails = AntsGuardrailsClient.builder()
.antsApiKey("pk:sk")
.agentId("agent_123")
.build();
GuardrailResult result = guardrails.checkInput("My SSN is 123-45-6789");
if (result.getResult() == GuardrailResult.Result.BLOCKED) {
throw new GuardrailViolationException("input", result);
}
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic AntsGuardrailsClient.Builderbuilder()checkInput(String text) checkOutput(String text) checkOutput(String text, String inputText) booleanWhether guardrail checks are enabled (requires agentId).
-
Method Details
-
builder
-
isEnabled
public boolean isEnabled()Whether guardrail checks are enabled (requires agentId). -
checkInput
-
checkOutput
-
checkOutput
-