Extractions
Extractions are specific parts of the prompt or response that you define, such as a question, answer, or context. These help Aporia know exactly what to check when running policies on your prompts or responses.
Why Do You Need to Define Extractions?
Defining extractions ensures that our policies run accurately on the correct parts of your prompts or responses. For example, if we want to detect prompt injection, we need to check the user’s question part, not the system prompt. Without this distinction, there could be false positives.
How and Why Do We Use Extractions?
The logic behind extractions is straightforward. Aporia checks the last message received:
- If it matches an extraction, we run the policy on this part.
- If it doesn’t match, we move to the previous message and so on.
Make sure to define question, context, and answer extractions for optimal policy performance.
To give you a sense of how it looks in “real life,” here’s an example: