Skip to content

Commit f55a35d

Browse files
committed
Add more tests
1 parent c38a28b commit f55a35d

File tree

3 files changed

+950
-3
lines changed

3 files changed

+950
-3
lines changed

plugins/qualifire/globals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export const postQualifire = async (
3939

4040
const result = await post(BASE_URL, body, options, timeout_millis || 10000);
4141
const error = result?.error || null;
42-
const verdict = result.status === 'success';
43-
const data = result.evaluationResults;
42+
const verdict = result?.status === 'success';
43+
const data = result?.evaluationResults;
4444

4545
return { error, verdict, data };
4646
};

plugins/qualifire/promptInjections.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ export const handler: PluginHandler = async (
2020
prompt_injections: true,
2121
};
2222

23+
if (eventType !== 'beforeRequestHook') {
24+
return {
25+
error: {
26+
message:
27+
'Qualifire Prompt Injections guardrail only supports before_request_hooks.',
28+
},
29+
verdict,
30+
data,
31+
};
32+
}
33+
2334
try {
2435
return await postQualifire(evaluationBody, parameters?.credentials?.apiKey);
2536
} catch (e: any) {

0 commit comments

Comments
 (0)