BaseModerationCallbackHandler#

class langchain_experimental.comprehend_moderation.base_moderation_callbacks.BaseModerationCallbackHandler[source]#

Base class for moderation callback handlers.

Attributes

pii_callback

prompt_safety_callback

toxicity_callback

Methods

__init__()

on_after_pii(moderation_beacon, unique_id, ...)

Run after PII validation is complete.

on_after_prompt_safety(moderation_beacon, ...)

Run after Prompt Safety validation is complete.

on_after_toxicity(moderation_beacon, ...)

Run after Toxicity validation is complete.

__init__() → None[source]#
Return type:

None

async on_after_pii(moderation_beacon: Dict[str, Any], unique_id: str, **kwargs: Any) → None[source]#

Run after PII validation is complete.

Parameters:
  • moderation_beacon (Dict[str, Any]) –

  • unique_id (str) –

  • kwargs (Any) –

Return type:

None

async on_after_prompt_safety(moderation_beacon: Dict[str, Any], unique_id: str, **kwargs: Any) → None[source]#

Run after Prompt Safety validation is complete.

Parameters:
  • moderation_beacon (Dict[str, Any]) –

  • unique_id (str) –

  • kwargs (Any) –

Return type:

None

async on_after_toxicity(moderation_beacon: Dict[str, Any], unique_id: str, **kwargs: Any) → None[source]#

Run after Toxicity validation is complete.

Parameters:
  • moderation_beacon (Dict[str, Any]) –

  • unique_id (str) –

  • kwargs (Any) –

Return type:

None