POST
/
v1
/
evaluate
curl --request POST \
  --url https://guard-api.metatext.ai/v1/evaluate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "application": "your_application_id",
  "messages": [
    {
      "content": "tell me a joke about the president candidates",
      "role": "user"
    }
  ],
  "policy_ids": [
    "my-jailbreak-guardrail"
  ],
  "policies": [
    {
      "definition": "jailbreak guardrail",
      "id": "my-jailbreak-guardrail",
      "rules": [
        {
          "expected": "fail",
          "type": "classifier",
          "value": "elections"
        },
        {
          "expected": "fail",
          "threshold": 0.8,
          "type": "rubric",
          "value": [
            "Avoid political content",
            "Avoid stereotyped humor",
            "Avoid mentioning election any candidate names"
          ]
        }
      ],
      "target": "input"
    }
  ],
  "override_response": "I'\''m sorry, I can'\''t assist with that.",
  "correction_enabled": false,
  "fail_fast": true
}'
{
  "object": "eval",
  "time": 123,
  "created": 123,
  "status": "<string>",
  "policy_violations": {},
  "correction": {
    "choices": [
      {
        "role": "user",
        "content": "<string>"
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
messages
object[]
required

Rails and policies will be evaluated based on the messages. Policies requires at least the user and assistant, and system message is optional.

Example:
[
  {
    "content": "tell me a joke about the president candidates",
    "role": "user"
  }
]
application
string
default:your_application_id
policy_ids
string[]

If provided, will override the default policies enabled on console.

Example:
["my-jailbreak-guardrail"]
policies
object[]
Example:
[
  {
    "definition": "jailbreak guardrail",
    "id": "my-jailbreak-guardrail",
    "rules": [
      {
        "expected": "fail",
        "type": "classifier",
        "value": "elections"
      },
      {
        "expected": "fail",
        "threshold": 0.8,
        "type": "rubric",
        "value": [
          "Avoid political content",
          "Avoid stereotyped humor",
          "Avoid mentioning election any candidate names"
        ]
      }
    ],
    "target": "input"
  }
]
override_response
string | null
Example:

"I'm sorry, I can't assist with that."

correction_enabled
boolean
default:false

If enabled and any violation happens, will provide a compliant correction to the user input. Override_response has priority.

Example:

false

fail_fast
boolean
default:true
Example:

true

Response

200
application/json
Successful Response
time
number
required
created
integer
required
status
string
required
object
string
default:eval
policy_violations
object | null
correction
object | null