Package akka.javasdk.agent
Class SimilarityGuard
Object
akka.javasdk.agent.SimilarityGuard
- All Implemented Interfaces:
Guardrail,TextGuardrail
@Deprecated(since="3.7.0",
forRemoval=true)
public final class SimilarityGuard
extends Object
implements TextGuardrail
Deprecated, for removal: This API element is subject to removal in a future version.
The SimilarityGuard evaluates the text by making a similarity search in a dataset of "bad
examples". If the similarity reaches the threshold, SimilarityGuard blocks the result.
-
Nested Class Summary
Nested classes/interfaces inherited from interface akka.javasdk.agent.Guardrail
Guardrail.GuardrailException, Guardrail.Message, Guardrail.Result -
Constructor Summary
ConstructorsConstructorDescriptionSimilarityGuard(GuardrailContext context) Deprecated, for removal: This API element is subject to removal in a future version.Readsbad-examples-resource-dirandthresholdfrom the guardrail's config. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.The classpath resource directory holding the "bad examples" dataset.Deprecated, for removal: This API element is subject to removal in a future version.Evaluates if the text passes the guardrail or not.doubleDeprecated, for removal: This API element is subject to removal in a future version.SimilarityGuard blocks text at or above this score.
-
Constructor Details
-
SimilarityGuard
Deprecated, for removal: This API element is subject to removal in a future version.Readsbad-examples-resource-dirandthresholdfrom the guardrail's config.
-
-
Method Details
-
threshold
public double threshold()Deprecated, for removal: This API element is subject to removal in a future version.SimilarityGuard blocks text at or above this score. -
badExamplesResourceDir
Deprecated, for removal: This API element is subject to removal in a future version.The classpath resource directory holding the "bad examples" dataset. -
evaluate
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:TextGuardrailEvaluates if the text passes the guardrail or not.- Specified by:
evaluatein interfaceTextGuardrail
-
model-requestormodel-responseis deprecated. SimilarityGuard will support onlymcp-tool-requestandmcp-tool-response. Formodel-request, useModelCallSimilarityGuard. The SDK has no replacement formodel-response.