Screen content for threats
The guard
API endpoint is the integration point for GenAI applications using Lakera Guard. It allows you to call on all of Lakera Guard’s defenses with a single API call.
Using guard
, you can submit the text content of an LLM interaction to Lakera Guard. The configured detectors will screen the interaction, and a flagging response will indicate whether any threats were detected, in line with your policy.
Your application can then be programmed to take mitigating action based on the flagging response, such as blocking the interaction, warning the end user, or generating an internal security alert.
Headers
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
List of messages comprising the interaction history with the LLM in OpenAI API Chat Completions format. Can be multiple messages of any role: user, assistant, or system.
ID of the relevant project. The request will be screened according to the policy assigned to the project. If no project ID is passed then the Lakera Guard Default Policy will be used for screening.
When true the response will return a payload object containing any PII, profanity or custom detector regex matches detected, along with their location within the contents.
When true the response will return a breakdown list of the detectors that were run, as defined in the policy, and whether each of them detected something or not.
Metadata tags can be attached to screening requests as an object that can contain any arbitrary key-value pairs. Common use cases include specifying the user or session ID.
When true the response will return an object with developer information about the build of Lakera Guard.
Response
Screening result
Whether any threats were detected with sufficient confidence
Contains detected PII, profanity, or custom regex matches with their locations. Only returned if payload=true in request.
List of detectors run and their results. Only returned if breakdown=true in request.
Build information. Only returned if dev_info=true in request.