Skip to main content

AI Guard | Python SDK

AI Guard service client.

AIGuard(token, config, logger_name, config_id)

Initializes a new AI Guard client.

required parameters

str

Pangea API token.

optional parameters

PangeaConfig | None

Pangea service configuration.

str

Logger name.

str | None

Configuration ID.

from pangea import PangeaConfig
from pangea.services import AIGuard

config = PangeaConfig(domain="aws.us.pangea.cloud")
ai_guard = AIGuard(token="pangea_token", config=config)

download-file

AIGuard.download_file()

Text guard (Beta)

AIGuard.guard_text(text, recipe, debug)

Guard text.

How to install a Beta release.

required parameters

str

Text.

optional parameters

str

Recipe.

bool

Debug.

response = ai_guard.guard_text("text")

Poll result

AIGuard.poll_result(exception)

Returns request's result that has been accepted by the server

optional parameters

Optional[AcceptedRequestException]

Exception that was previously raised by the SDK on a call that is being processed.

Response Object

PangeaResponse

response = service.poll_result(exception)