Get All Policy Templates
Endpoint: GEThttps://guardrails.aporia.com/api/v1/policies
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
list
. each object in the list contains the following fields:
The policy type.
The policy category.
The policy default_name.
Description of the policy.
Get Specific Policy Template
Endpoint: GEThttps://guardrails.aporia.com/api/v1/policies/{template_type}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The type identifier of the policy template to retrieve.
The policy type.
The policy category.
The policy default name.
Description of the policy.
Create Custom Policy
Endpoint: POSThttps://guardrails.aporia.com/api/v1/policies/custom_policy
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The name of the custom policy.
The target of the policy - either
prompt
or response
.There are 2 configuration modes for custom policy - For advanced mode, the following parameters must be passed:
simple
and advanced
, each with it’s own condition config.For simple mode, the following parameters must be passed:- evaluation_instructions - Instructions that define how the policy should evaluate inputs.
- modality - Defines whether instructions trigger a violation if they evaluate to
TRUE
orFALSE
.
- system_prompt - The system prompt that will be passed to the LLM
- top_p - Top-P sampling probability, between 0 and 1. Defaults to 1.
- temperature - Sampling temperature to use, between 0 and 2. Defaults to 1.
- modality - Defines whether instructions trigger a violation if they evaluate to
TRUE
orFALSE
.
The custom policy type identifier.
The policy category, typically ‘custom’ for user-defined policies.
The default name for the policy template, as provided in the request.
A description of the policy based on the evaluation instructions.
Edit Custom Policy
Endpoint: PUThttps://guardrails.aporia.com/api/v1/policies/custom_policy/{custom_policy_type}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The custom policy type identifier to update. Returned from
Create Custom Policy
endpoint.The name of the custom policy.
The target of the policy - either
prompt
or response
.There are 2 configuration modes for custom policy - For advanced mode, the following parameters must be passed:
simple
and advanced
, each with it’s own condition config.For simple mode, the following parameters must be passed:- evaluation_instructions - Instructions that define how the policy should evaluate inputs.
- modality - Defines whether instructions trigger a violation if they evaluate to
TRUE
orFALSE
.
- system_prompt - The system prompt that will be passed to the LLM
- top_p - Top-P sampling probability, between 0 and 1. Defaults to 1.
- temperature - Sampling temperature to use, between 0 and 2. Defaults to 1.
- modality - Defines whether instructions trigger a violation if they evaluate to
TRUE
orFALSE
.
The custom policy type identifier.
The policy category, typically ‘custom’ for user-defined policies.
The default name for the policy template.
Updated description of the policy based on the new evaluation instructions.
Delete Custom Policy
Endpoint: DELETEhttps://guardrails.aporia.com/api/v1/policies/custom_policy/{custom_policy_type}
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The custom policy type identifier to delete. Returned from
Create Custom Policy
endpoint.200
OK
Create policies for multiple projects
Endpoint: PUThttps://guardrails.aporia.com/api/v1/policies/
Headers:
Content-Type
:application/json
Authorization
:Bearer
+ Your copied Aporia API key
The project ids to create the policies in
A list of policies to create. List of policies, each Policy has the following attributes:
policy_type
(string), priority
(int), condition
(dict), action
(dict).