Skip to main content

Prompt Guard | Python SDK

Prompt Guard service client.

PromptGuard(token, config, logger_name, config_id)

Initializes a new Prompt 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 PromptGuard

config = PangeaConfig(domain="aws.us.pangea.cloud")
prompt_guard = PromptGuard(token="pangea_token", config=config)

download-file

PromptGuard.download_file()

Guard (Beta)

PromptGuard.guard(messages)

Guard messages.

How to install a Beta release.

required parameters

Iterable[Message]

Messages.

from pangea.services.prompt_guard import Message

response = prompt_guard.guard([Message(role="user", content="hello world")])

Poll result

PromptGuard.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)