nemoguardrails.library.gcp_moderate_text.actions

View as Markdown

Module Contents

Functions

NameDescription
call_gcp_text_moderation_apiApplication Default Credentials (ADC) is a strategy used by the GCP authentication libraries to automatically
gcp_text_moderation_mappingDetermines whether the output from the GCP text moderation API should be blocked.

Data

log

API

nemoguardrails.library.gcp_moderate_text.actions.call_gcp_text_moderation_api(
context: typing.Optional[dict] = None,
kwargs = {}
) -> dict
async

Application Default Credentials (ADC) is a strategy used by the GCP authentication libraries to automatically find credentials based on the application environment. ADC searches for credentials in the following locations (Search order):

  1. GOOGLE_APPLICATION_CREDENTIALS environment variable
  2. User credentials set up by using the Google Cloud CLI
  3. The attached service account, returned by the metadata server

For more information check https://cloud.google.com/docs/authentication/application-default-credentials

nemoguardrails.library.gcp_moderate_text.actions.gcp_text_moderation_mapping(
result: dict
) -> bool

Determines whether the output from the GCP text moderation API should be blocked.

Returns True (i.e. block the output) if any of the conditions are met.

nemoguardrails.library.gcp_moderate_text.actions.log = logging.getLogger(__name__)