Class SimilarityGuard

Object
akka.javasdk.agent.SimilarityGuard
All Implemented Interfaces:
Guardrail, TextGuardrail

public final class SimilarityGuard extends Object implements TextGuardrail
The SimilarityGuard evaluates the text by making a similarity search in a dataset of "bad examples". If the similarity exceeds a threshold, the result is flagged as blocked.
  • Constructor Details

  • Method Details

    • threshold

      public double threshold()
    • badExamplesResourceDir

      public String badExamplesResourceDir()
    • evaluate

      public Guardrail.Result evaluate(String text)
      Description copied from interface: TextGuardrail
      Evaluates if the text passes the guardrail or not.
      Specified by:
      evaluate in interface TextGuardrail