@uipath/apollo-react 7.2.1 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/components/Guardrails/__fixtures__/classifier-questions.fixtures.d.ts +3 -0
- package/dist/canvas/components/Guardrails/__fixtures__/classifier-questions.fixtures.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts +2 -0
- package/dist/canvas/components/Guardrails/__fixtures__/definitions-wire.fixtures.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/__fixtures__/host-copy-baselines.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.cjs +220 -0
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.d.ts +13 -0
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/classifier-custom-questions-editor.js +186 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.cjs +316 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.d.ts +15 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/classifier-question-picker.js +282 -0
- package/dist/canvas/components/Guardrails/classifier-utils.cjs +139 -0
- package/dist/canvas/components/Guardrails/classifier-utils.d.ts +25 -0
- package/dist/canvas/components/Guardrails/classifier-utils.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/classifier-utils.js +87 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.cjs +98 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.d.ts +9 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/components/classifier-threshold-slider.js +64 -0
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts +1 -1
- package/dist/canvas/components/Guardrails/components/parameter-label.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/definitions-copy.cjs +66 -1
- package/dist/canvas/components/Guardrails/definitions-copy.d.ts +1 -0
- package/dist/canvas/components/Guardrails/definitions-copy.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/definitions-copy.js +66 -1
- package/dist/canvas/components/Guardrails/definitions-parse.cjs +66 -1
- package/dist/canvas/components/Guardrails/definitions-parse.d.ts +11 -1
- package/dist/canvas/components/Guardrails/definitions-parse.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/definitions-parse.js +63 -1
- package/dist/canvas/components/Guardrails/definitions-wire.d.ts +11 -0
- package/dist/canvas/components/Guardrails/definitions-wire.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-builder.cjs +12 -4
- package/dist/canvas/components/Guardrails/guardrail-builder.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-builder.js +12 -4
- package/dist/canvas/components/Guardrails/guardrail-validator-form.cjs +4 -1
- package/dist/canvas/components/Guardrails/guardrail-validator-form.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/guardrail-validator-form.js +4 -1
- package/dist/canvas/components/Guardrails/i18n.cjs +181 -3
- package/dist/canvas/components/Guardrails/i18n.d.ts +39 -0
- package/dist/canvas/components/Guardrails/i18n.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/i18n.js +168 -2
- package/dist/canvas/components/Guardrails/index.cjs +54 -4
- package/dist/canvas/components/Guardrails/index.d.ts +14 -3
- package/dist/canvas/components/Guardrails/index.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/index.js +7 -2
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.cjs +136 -0
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.d.ts +18 -0
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-classifier-guardrail-parameters.js +102 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.cjs +97 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.d.ts +34 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-classifier-questions.js +60 -0
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.cjs +8 -81
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.d.ts +2 -8
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/use-guardrail-definitions.js +9 -82
- package/dist/canvas/components/Guardrails/use-guardrails-request.cjs +133 -0
- package/dist/canvas/components/Guardrails/use-guardrails-request.d.ts +23 -0
- package/dist/canvas/components/Guardrails/use-guardrails-request.d.ts.map +1 -0
- package/dist/canvas/components/Guardrails/use-guardrails-request.js +99 -0
- package/dist/canvas/components/Guardrails/utils.cjs +4 -2
- package/dist/canvas/components/Guardrails/utils.d.ts +4 -1
- package/dist/canvas/components/Guardrails/utils.d.ts.map +1 -1
- package/dist/canvas/components/Guardrails/utils.js +4 -2
- package/dist/canvas/locales/en.cjs +1 -1
- package/dist/canvas/locales/en.d.ts.map +1 -1
- package/dist/canvas/locales/en.js +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
CLASSIFIER_DEFAULT_THRESHOLD: ()=>CLASSIFIER_DEFAULT_THRESHOLD,
|
|
28
|
+
CLASSIFIER_PARAMETER_IDS: ()=>CLASSIFIER_PARAMETER_IDS,
|
|
29
|
+
CLASSIFIER_VALIDATOR: ()=>CLASSIFIER_VALIDATOR,
|
|
30
|
+
hasClassifierQuestions: ()=>hasClassifierQuestions,
|
|
31
|
+
readClassifierCustomQuestions: ()=>readClassifierCustomQuestions,
|
|
32
|
+
sanitizeClassifierCustomQuestions: ()=>sanitizeClassifierCustomQuestions,
|
|
33
|
+
writeClassifierCustomQuestions: ()=>writeClassifierCustomQuestions
|
|
34
|
+
});
|
|
35
|
+
const CLASSIFIER_VALIDATOR = 'classifier';
|
|
36
|
+
const CLASSIFIER_PARAMETER_IDS = {
|
|
37
|
+
selectedQuestions: 'selectedQuestions',
|
|
38
|
+
questionThresholds: 'questionThresholds',
|
|
39
|
+
questions: 'questions',
|
|
40
|
+
model: 'model',
|
|
41
|
+
modelVendor: 'modelVendor'
|
|
42
|
+
};
|
|
43
|
+
const CLASSIFIER_DEFAULT_THRESHOLD = 0.5;
|
|
44
|
+
const CRITERIA_TRUE_PREFIX = 'questionCriteriaTrue.';
|
|
45
|
+
const CRITERIA_FALSE_PREFIX = 'questionCriteriaFalse.';
|
|
46
|
+
const THRESHOLD_PREFIX = 'questionThreshold.';
|
|
47
|
+
function readClassifierCustomQuestions(parameters) {
|
|
48
|
+
const stored = parameters.find((p)=>p.id === CLASSIFIER_PARAMETER_IDS.questions)?.value;
|
|
49
|
+
const questions = Array.isArray(stored) ? stored.filter((entry)=>'string' == typeof entry) : [];
|
|
50
|
+
const valueFor = (id)=>parameters.find((p)=>p.id === id)?.value;
|
|
51
|
+
return questions.map((question, index)=>{
|
|
52
|
+
const row = {
|
|
53
|
+
question
|
|
54
|
+
};
|
|
55
|
+
const criteriaTrue = valueFor(`${CRITERIA_TRUE_PREFIX}${index}`);
|
|
56
|
+
const criteriaFalse = valueFor(`${CRITERIA_FALSE_PREFIX}${index}`);
|
|
57
|
+
const threshold = valueFor(`${THRESHOLD_PREFIX}${index}`);
|
|
58
|
+
if ('string' == typeof criteriaTrue) row.criteriaTrue = criteriaTrue;
|
|
59
|
+
if ('string' == typeof criteriaFalse) row.criteriaFalse = criteriaFalse;
|
|
60
|
+
if ('number' == typeof threshold) row.threshold = threshold;
|
|
61
|
+
return row;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function sanitizeClassifierCustomQuestions(rows) {
|
|
65
|
+
return rows.filter((row)=>'' !== row.question.trim()).map(({ question, criteriaTrue, criteriaFalse, threshold })=>({
|
|
66
|
+
question,
|
|
67
|
+
...criteriaTrue?.trim() ? {
|
|
68
|
+
criteriaTrue
|
|
69
|
+
} : {},
|
|
70
|
+
...criteriaFalse?.trim() ? {
|
|
71
|
+
criteriaFalse
|
|
72
|
+
} : {},
|
|
73
|
+
...void 0 !== threshold && Math.abs(threshold - CLASSIFIER_DEFAULT_THRESHOLD) > 1e-4 ? {
|
|
74
|
+
threshold
|
|
75
|
+
} : {}
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
function writeClassifierCustomQuestions(parameters, rows) {
|
|
79
|
+
const kept = parameters.filter((p)=>p.id !== CLASSIFIER_PARAMETER_IDS.questions && ![
|
|
80
|
+
CRITERIA_TRUE_PREFIX,
|
|
81
|
+
CRITERIA_FALSE_PREFIX,
|
|
82
|
+
THRESHOLD_PREFIX
|
|
83
|
+
].some((prefix)=>p.id.startsWith(prefix)));
|
|
84
|
+
const clean = sanitizeClassifierCustomQuestions(rows);
|
|
85
|
+
if (0 === clean.length) return kept;
|
|
86
|
+
const written = [
|
|
87
|
+
{
|
|
88
|
+
$parameterType: 'text-list',
|
|
89
|
+
id: CLASSIFIER_PARAMETER_IDS.questions,
|
|
90
|
+
value: clean.map((row)=>row.question)
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
clean.forEach((row, index)=>{
|
|
94
|
+
if (void 0 !== row.criteriaTrue) written.push({
|
|
95
|
+
$parameterType: 'text',
|
|
96
|
+
id: `${CRITERIA_TRUE_PREFIX}${index}`,
|
|
97
|
+
value: row.criteriaTrue
|
|
98
|
+
});
|
|
99
|
+
if (void 0 !== row.criteriaFalse) written.push({
|
|
100
|
+
$parameterType: 'text',
|
|
101
|
+
id: `${CRITERIA_FALSE_PREFIX}${index}`,
|
|
102
|
+
value: row.criteriaFalse
|
|
103
|
+
});
|
|
104
|
+
if (void 0 !== row.threshold) written.push({
|
|
105
|
+
$parameterType: 'number',
|
|
106
|
+
id: `${THRESHOLD_PREFIX}${index}`,
|
|
107
|
+
value: row.threshold
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
return [
|
|
111
|
+
...kept,
|
|
112
|
+
...written
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
function hasClassifierQuestions(parameters) {
|
|
116
|
+
const valueFor = (id)=>parameters.find((p)=>p.id === id)?.value;
|
|
117
|
+
const selected = valueFor(CLASSIFIER_PARAMETER_IDS.selectedQuestions);
|
|
118
|
+
const custom = valueFor(CLASSIFIER_PARAMETER_IDS.questions);
|
|
119
|
+
return Array.isArray(selected) && selected.length > 0 || Array.isArray(custom) && custom.some((q)=>'string' == typeof q && '' !== q.trim());
|
|
120
|
+
}
|
|
121
|
+
exports.CLASSIFIER_DEFAULT_THRESHOLD = __webpack_exports__.CLASSIFIER_DEFAULT_THRESHOLD;
|
|
122
|
+
exports.CLASSIFIER_PARAMETER_IDS = __webpack_exports__.CLASSIFIER_PARAMETER_IDS;
|
|
123
|
+
exports.CLASSIFIER_VALIDATOR = __webpack_exports__.CLASSIFIER_VALIDATOR;
|
|
124
|
+
exports.hasClassifierQuestions = __webpack_exports__.hasClassifierQuestions;
|
|
125
|
+
exports.readClassifierCustomQuestions = __webpack_exports__.readClassifierCustomQuestions;
|
|
126
|
+
exports.sanitizeClassifierCustomQuestions = __webpack_exports__.sanitizeClassifierCustomQuestions;
|
|
127
|
+
exports.writeClassifierCustomQuestions = __webpack_exports__.writeClassifierCustomQuestions;
|
|
128
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
129
|
+
"CLASSIFIER_DEFAULT_THRESHOLD",
|
|
130
|
+
"CLASSIFIER_PARAMETER_IDS",
|
|
131
|
+
"CLASSIFIER_VALIDATOR",
|
|
132
|
+
"hasClassifierQuestions",
|
|
133
|
+
"readClassifierCustomQuestions",
|
|
134
|
+
"sanitizeClassifierCustomQuestions",
|
|
135
|
+
"writeClassifierCustomQuestions"
|
|
136
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
137
|
+
Object.defineProperty(exports, '__esModule', {
|
|
138
|
+
value: true
|
|
139
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const CLASSIFIER_VALIDATOR = "classifier";
|
|
2
|
+
export declare const CLASSIFIER_PARAMETER_IDS: {
|
|
3
|
+
readonly selectedQuestions: "selectedQuestions";
|
|
4
|
+
readonly questionThresholds: "questionThresholds";
|
|
5
|
+
readonly questions: "questions";
|
|
6
|
+
readonly model: "model";
|
|
7
|
+
readonly modelVendor: "modelVendor";
|
|
8
|
+
};
|
|
9
|
+
export declare const CLASSIFIER_DEFAULT_THRESHOLD = 0.5;
|
|
10
|
+
export interface ClassifierCustomQuestion {
|
|
11
|
+
question: string;
|
|
12
|
+
criteriaTrue?: string;
|
|
13
|
+
criteriaFalse?: string;
|
|
14
|
+
threshold?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ClassifierParameterLike {
|
|
17
|
+
id: string;
|
|
18
|
+
$parameterType: string;
|
|
19
|
+
value?: unknown;
|
|
20
|
+
}
|
|
21
|
+
export declare function readClassifierCustomQuestions(parameters: readonly ClassifierParameterLike[]): ClassifierCustomQuestion[];
|
|
22
|
+
export declare function sanitizeClassifierCustomQuestions(rows: readonly ClassifierCustomQuestion[]): ClassifierCustomQuestion[];
|
|
23
|
+
export declare function writeClassifierCustomQuestions<P extends ClassifierParameterLike>(parameters: readonly P[], rows: readonly ClassifierCustomQuestion[]): P[];
|
|
24
|
+
export declare function hasClassifierQuestions(parameters: readonly Pick<ClassifierParameterLike, 'id' | 'value'>[]): boolean;
|
|
25
|
+
//# sourceMappingURL=classifier-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier-utils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/classifier-utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,eAAO,MAAM,wBAAwB;;;;;;CAM3B,CAAC;AAGX,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAShD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAGD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,SAAS,uBAAuB,EAAE,GAC7C,wBAAwB,EAAE,CAgB5B;AAGD,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,SAAS,wBAAwB,EAAE,GACxC,wBAAwB,EAAE,CAW5B;AAMD,wBAAgB,8BAA8B,CAAC,CAAC,SAAS,uBAAuB,EAC9E,UAAU,EAAE,SAAS,CAAC,EAAE,EACxB,IAAI,EAAE,SAAS,wBAAwB,EAAE,GACxC,CAAC,EAAE,CA0CL;AAMD,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,SAAS,IAAI,CAAC,uBAAuB,EAAE,IAAI,GAAG,OAAO,CAAC,EAAE,GACnE,OAAO,CAQT"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const CLASSIFIER_VALIDATOR = 'classifier';
|
|
2
|
+
const CLASSIFIER_PARAMETER_IDS = {
|
|
3
|
+
selectedQuestions: 'selectedQuestions',
|
|
4
|
+
questionThresholds: 'questionThresholds',
|
|
5
|
+
questions: 'questions',
|
|
6
|
+
model: 'model',
|
|
7
|
+
modelVendor: 'modelVendor'
|
|
8
|
+
};
|
|
9
|
+
const CLASSIFIER_DEFAULT_THRESHOLD = 0.5;
|
|
10
|
+
const CRITERIA_TRUE_PREFIX = 'questionCriteriaTrue.';
|
|
11
|
+
const CRITERIA_FALSE_PREFIX = 'questionCriteriaFalse.';
|
|
12
|
+
const THRESHOLD_PREFIX = 'questionThreshold.';
|
|
13
|
+
function readClassifierCustomQuestions(parameters) {
|
|
14
|
+
const stored = parameters.find((p)=>p.id === CLASSIFIER_PARAMETER_IDS.questions)?.value;
|
|
15
|
+
const questions = Array.isArray(stored) ? stored.filter((entry)=>'string' == typeof entry) : [];
|
|
16
|
+
const valueFor = (id)=>parameters.find((p)=>p.id === id)?.value;
|
|
17
|
+
return questions.map((question, index)=>{
|
|
18
|
+
const row = {
|
|
19
|
+
question
|
|
20
|
+
};
|
|
21
|
+
const criteriaTrue = valueFor(`${CRITERIA_TRUE_PREFIX}${index}`);
|
|
22
|
+
const criteriaFalse = valueFor(`${CRITERIA_FALSE_PREFIX}${index}`);
|
|
23
|
+
const threshold = valueFor(`${THRESHOLD_PREFIX}${index}`);
|
|
24
|
+
if ('string' == typeof criteriaTrue) row.criteriaTrue = criteriaTrue;
|
|
25
|
+
if ('string' == typeof criteriaFalse) row.criteriaFalse = criteriaFalse;
|
|
26
|
+
if ('number' == typeof threshold) row.threshold = threshold;
|
|
27
|
+
return row;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function sanitizeClassifierCustomQuestions(rows) {
|
|
31
|
+
return rows.filter((row)=>'' !== row.question.trim()).map(({ question, criteriaTrue, criteriaFalse, threshold })=>({
|
|
32
|
+
question,
|
|
33
|
+
...criteriaTrue?.trim() ? {
|
|
34
|
+
criteriaTrue
|
|
35
|
+
} : {},
|
|
36
|
+
...criteriaFalse?.trim() ? {
|
|
37
|
+
criteriaFalse
|
|
38
|
+
} : {},
|
|
39
|
+
...void 0 !== threshold && Math.abs(threshold - CLASSIFIER_DEFAULT_THRESHOLD) > 1e-4 ? {
|
|
40
|
+
threshold
|
|
41
|
+
} : {}
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
function writeClassifierCustomQuestions(parameters, rows) {
|
|
45
|
+
const kept = parameters.filter((p)=>p.id !== CLASSIFIER_PARAMETER_IDS.questions && ![
|
|
46
|
+
CRITERIA_TRUE_PREFIX,
|
|
47
|
+
CRITERIA_FALSE_PREFIX,
|
|
48
|
+
THRESHOLD_PREFIX
|
|
49
|
+
].some((prefix)=>p.id.startsWith(prefix)));
|
|
50
|
+
const clean = sanitizeClassifierCustomQuestions(rows);
|
|
51
|
+
if (0 === clean.length) return kept;
|
|
52
|
+
const written = [
|
|
53
|
+
{
|
|
54
|
+
$parameterType: 'text-list',
|
|
55
|
+
id: CLASSIFIER_PARAMETER_IDS.questions,
|
|
56
|
+
value: clean.map((row)=>row.question)
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
clean.forEach((row, index)=>{
|
|
60
|
+
if (void 0 !== row.criteriaTrue) written.push({
|
|
61
|
+
$parameterType: 'text',
|
|
62
|
+
id: `${CRITERIA_TRUE_PREFIX}${index}`,
|
|
63
|
+
value: row.criteriaTrue
|
|
64
|
+
});
|
|
65
|
+
if (void 0 !== row.criteriaFalse) written.push({
|
|
66
|
+
$parameterType: 'text',
|
|
67
|
+
id: `${CRITERIA_FALSE_PREFIX}${index}`,
|
|
68
|
+
value: row.criteriaFalse
|
|
69
|
+
});
|
|
70
|
+
if (void 0 !== row.threshold) written.push({
|
|
71
|
+
$parameterType: 'number',
|
|
72
|
+
id: `${THRESHOLD_PREFIX}${index}`,
|
|
73
|
+
value: row.threshold
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
return [
|
|
77
|
+
...kept,
|
|
78
|
+
...written
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
function hasClassifierQuestions(parameters) {
|
|
82
|
+
const valueFor = (id)=>parameters.find((p)=>p.id === id)?.value;
|
|
83
|
+
const selected = valueFor(CLASSIFIER_PARAMETER_IDS.selectedQuestions);
|
|
84
|
+
const custom = valueFor(CLASSIFIER_PARAMETER_IDS.questions);
|
|
85
|
+
return Array.isArray(selected) && selected.length > 0 || Array.isArray(custom) && custom.some((q)=>'string' == typeof q && '' !== q.trim());
|
|
86
|
+
}
|
|
87
|
+
export { CLASSIFIER_DEFAULT_THRESHOLD, CLASSIFIER_PARAMETER_IDS, CLASSIFIER_VALIDATOR, hasClassifierQuestions, readClassifierCustomQuestions, sanitizeClassifierCustomQuestions, writeClassifierCustomQuestions };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ClassifierThresholdSlider: ()=>ClassifierThresholdSlider
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
function ClassifierThresholdSlider({ value, ariaLabel, labels, onChange }) {
|
|
33
|
+
const [live, setLive] = (0, external_react_namespaceObject.useState)(value);
|
|
34
|
+
const [seeded, setSeeded] = (0, external_react_namespaceObject.useState)(value);
|
|
35
|
+
if (value !== seeded) {
|
|
36
|
+
setSeeded(value);
|
|
37
|
+
setLive(value);
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
40
|
+
"data-slot": "classifier-threshold-slider",
|
|
41
|
+
className: "grid gap-1.5 pb-5",
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
44
|
+
className: "flex items-center justify-between text-xs text-muted-foreground",
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
47
|
+
children: labels.strictnessLabel
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
|
|
50
|
+
className: "tabular-nums",
|
|
51
|
+
children: [
|
|
52
|
+
Math.round(100 * live),
|
|
53
|
+
"%"
|
|
54
|
+
]
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
59
|
+
className: "relative min-w-0",
|
|
60
|
+
children: [
|
|
61
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Slider, {
|
|
62
|
+
value: [
|
|
63
|
+
live
|
|
64
|
+
],
|
|
65
|
+
min: 0,
|
|
66
|
+
max: 1,
|
|
67
|
+
step: 0.1,
|
|
68
|
+
"aria-label": ariaLabel,
|
|
69
|
+
onValueChange: ([next])=>void 0 !== next && setLive(next),
|
|
70
|
+
onValueCommit: ([next])=>void 0 !== next && onChange(next)
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
73
|
+
"aria-hidden": "true",
|
|
74
|
+
className: "absolute top-full left-0 mt-1 text-xs text-muted-foreground",
|
|
75
|
+
children: labels.thresholdStrict
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
78
|
+
"aria-hidden": "true",
|
|
79
|
+
className: "absolute top-full left-1/2 mt-1 -translate-x-1/2 text-xs text-muted-foreground",
|
|
80
|
+
children: labels.thresholdBalanced
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
className: "absolute top-full right-0 mt-1 text-xs text-muted-foreground",
|
|
85
|
+
children: labels.thresholdLenient
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
exports.ClassifierThresholdSlider = __webpack_exports__.ClassifierThresholdSlider;
|
|
93
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
94
|
+
"ClassifierThresholdSlider"
|
|
95
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
96
|
+
Object.defineProperty(exports, '__esModule', {
|
|
97
|
+
value: true
|
|
98
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GuardrailClassifierLabels } from '../i18n';
|
|
2
|
+
export interface ClassifierThresholdSliderProps {
|
|
3
|
+
value: number;
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
labels: GuardrailClassifierLabels;
|
|
6
|
+
onChange: (value: number) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ClassifierThresholdSlider({ value, ariaLabel, labels, onChange, }: ClassifierThresholdSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=classifier-threshold-slider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classifier-threshold-slider.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/classifier-threshold-slider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,WAAW,8BAA8B;IAE7C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,yBAAyB,CAAC;IAClC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAGD,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,SAAS,EACT,MAAM,EACN,QAAQ,GACT,EAAE,8BAA8B,2CAkDhC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slider } from "@uipath/apollo-wind";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
function ClassifierThresholdSlider({ value, ariaLabel, labels, onChange }) {
|
|
5
|
+
const [live, setLive] = useState(value);
|
|
6
|
+
const [seeded, setSeeded] = useState(value);
|
|
7
|
+
if (value !== seeded) {
|
|
8
|
+
setSeeded(value);
|
|
9
|
+
setLive(value);
|
|
10
|
+
}
|
|
11
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
12
|
+
"data-slot": "classifier-threshold-slider",
|
|
13
|
+
className: "grid gap-1.5 pb-5",
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ jsxs("div", {
|
|
16
|
+
className: "flex items-center justify-between text-xs text-muted-foreground",
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx("span", {
|
|
19
|
+
children: labels.strictnessLabel
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsxs("span", {
|
|
22
|
+
className: "tabular-nums",
|
|
23
|
+
children: [
|
|
24
|
+
Math.round(100 * live),
|
|
25
|
+
"%"
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
]
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsxs("div", {
|
|
31
|
+
className: "relative min-w-0",
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsx(Slider, {
|
|
34
|
+
value: [
|
|
35
|
+
live
|
|
36
|
+
],
|
|
37
|
+
min: 0,
|
|
38
|
+
max: 1,
|
|
39
|
+
step: 0.1,
|
|
40
|
+
"aria-label": ariaLabel,
|
|
41
|
+
onValueChange: ([next])=>void 0 !== next && setLive(next),
|
|
42
|
+
onValueCommit: ([next])=>void 0 !== next && onChange(next)
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx("span", {
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: "absolute top-full left-0 mt-1 text-xs text-muted-foreground",
|
|
47
|
+
children: labels.thresholdStrict
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ jsx("span", {
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
className: "absolute top-full left-1/2 mt-1 -translate-x-1/2 text-xs text-muted-foreground",
|
|
52
|
+
children: labels.thresholdBalanced
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsx("span", {
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
className: "absolute top-full right-0 mt-1 text-xs text-muted-foreground",
|
|
57
|
+
children: labels.thresholdLenient
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { ClassifierThresholdSlider };
|
|
@@ -2,7 +2,7 @@ import type { GuardrailValidatorFormLabels } from '../i18n';
|
|
|
2
2
|
import type { GuardrailParameterDefinition } from '../types';
|
|
3
3
|
export interface ParameterLabelProps {
|
|
4
4
|
paramDef: GuardrailParameterDefinition;
|
|
5
|
-
labels: GuardrailValidatorFormLabels
|
|
5
|
+
labels: Pick<GuardrailValidatorFormLabels, 'moreInformation'>;
|
|
6
6
|
htmlFor?: string;
|
|
7
7
|
asTextHeader?: boolean;
|
|
8
8
|
id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-label.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/parameter-label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,4BAA4B,CAAC;IACvC,MAAM,EAAE,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"parameter-label.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Guardrails/components/parameter-label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,4BAA4B,CAAC;IACvC,MAAM,EAAE,IAAI,CAAC,4BAA4B,EAAE,iBAAiB,CAAC,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IAMvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAGD,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,YAAoB,EACpB,EAAE,GACH,EAAE,mBAAmB,2CA0BrB"}
|
|
@@ -1035,6 +1035,70 @@ function buildGuardrailCopy(_) {
|
|
|
1035
1035
|
})
|
|
1036
1036
|
}
|
|
1037
1037
|
}
|
|
1038
|
+
},
|
|
1039
|
+
classifier: {
|
|
1040
|
+
displayName: _({
|
|
1041
|
+
id: 'guardrails.definitions.classifier.display-name',
|
|
1042
|
+
message: 'Classifier'
|
|
1043
|
+
}),
|
|
1044
|
+
description: _({
|
|
1045
|
+
id: "guardrails.definitions.classifier.description",
|
|
1046
|
+
message: "Evaluate questions against the payload with a non-generative classifier. Pick curated questions across categories, add your own, and flag when any answer reaches that question's threshold."
|
|
1047
|
+
}),
|
|
1048
|
+
paramLabels: {
|
|
1049
|
+
selectedQuestions: _({
|
|
1050
|
+
id: 'guardrails.definitions.classifier.param.selectedQuestions.label',
|
|
1051
|
+
message: 'Predefined questions'
|
|
1052
|
+
}),
|
|
1053
|
+
questions: _({
|
|
1054
|
+
id: 'guardrails.definitions.classifier.param.questions.label',
|
|
1055
|
+
message: 'Your questions'
|
|
1056
|
+
}),
|
|
1057
|
+
model: _({
|
|
1058
|
+
id: 'guardrails.definitions.classifier.param.model.label',
|
|
1059
|
+
message: 'Model'
|
|
1060
|
+
})
|
|
1061
|
+
},
|
|
1062
|
+
paramTooltips: {
|
|
1063
|
+
selectedQuestions: _({
|
|
1064
|
+
id: 'guardrails.definitions.classifier.param.selectedQuestions.tooltip',
|
|
1065
|
+
message: 'Curated questions grouped by category. Pick any across categories; score questions also take a severity cutoff. Add your own questions below.'
|
|
1066
|
+
}),
|
|
1067
|
+
questions: _({
|
|
1068
|
+
id: 'guardrails.definitions.classifier.param.questions.tooltip',
|
|
1069
|
+
message: "Yes/no questions about the payload, where 'yes' means the payload should be flagged. Added on top of any predefined questions you selected. Optionally define what counts as yes and as no — the classifier grades against those definitions, which helps on judgment-style questions."
|
|
1070
|
+
})
|
|
1071
|
+
},
|
|
1072
|
+
categoryLabels: {
|
|
1073
|
+
pii: _({
|
|
1074
|
+
id: 'guardrails.definitions.classifier.category.pii',
|
|
1075
|
+
message: 'PII'
|
|
1076
|
+
}),
|
|
1077
|
+
harmful_content: _({
|
|
1078
|
+
id: 'guardrails.definitions.classifier.category.harmful_content',
|
|
1079
|
+
message: 'Harmful content'
|
|
1080
|
+
}),
|
|
1081
|
+
prompt_injection: _({
|
|
1082
|
+
id: 'guardrails.definitions.classifier.category.prompt_injection',
|
|
1083
|
+
message: 'Prompt injection'
|
|
1084
|
+
}),
|
|
1085
|
+
intellectual_property: _({
|
|
1086
|
+
id: 'guardrails.definitions.classifier.category.intellectual_property',
|
|
1087
|
+
message: 'Intellectual property'
|
|
1088
|
+
}),
|
|
1089
|
+
secrets_and_credentials: _({
|
|
1090
|
+
id: 'guardrails.definitions.classifier.category.secrets_and_credentials',
|
|
1091
|
+
message: 'Secrets & credentials'
|
|
1092
|
+
}),
|
|
1093
|
+
compliance_commitments: _({
|
|
1094
|
+
id: 'guardrails.definitions.classifier.category.compliance_commitments',
|
|
1095
|
+
message: 'Compliance & commitments'
|
|
1096
|
+
}),
|
|
1097
|
+
scope_and_conduct: _({
|
|
1098
|
+
id: 'guardrails.definitions.classifier.category.scope_and_conduct',
|
|
1099
|
+
message: 'Scope & conduct'
|
|
1100
|
+
})
|
|
1101
|
+
}
|
|
1038
1102
|
}
|
|
1039
1103
|
};
|
|
1040
1104
|
}
|
|
@@ -1045,7 +1109,8 @@ const CURATED_GUARDRAIL_VALIDATORS = Object.freeze([
|
|
|
1045
1109
|
'user_prompt_attacks',
|
|
1046
1110
|
'intellectual_property',
|
|
1047
1111
|
'llm_as_judge',
|
|
1048
|
-
'sentiment'
|
|
1112
|
+
'sentiment',
|
|
1113
|
+
'classifier'
|
|
1049
1114
|
]);
|
|
1050
1115
|
const GUARDRAIL_COPY_EN = buildGuardrailCopy((descriptor)=>descriptor.message);
|
|
1051
1116
|
function collectEnglishMessages() {
|
|
@@ -5,6 +5,7 @@ export interface GuardrailValidatorCopy {
|
|
|
5
5
|
paramLabels: Record<string, string>;
|
|
6
6
|
paramTooltips?: Record<string, string>;
|
|
7
7
|
optionLabels?: Record<string, Record<string, string>>;
|
|
8
|
+
categoryLabels?: Record<string, string>;
|
|
8
9
|
}
|
|
9
10
|
export type GuardrailCopyTable = Record<string, GuardrailValidatorCopy>;
|
|
10
11
|
export declare const CURATED_GUARDRAIL_VALIDATORS: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions-copy.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/definitions-copy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"definitions-copy.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Guardrails/definitions-copy.ts"],"names":[],"mappings":"AAoCA,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEpC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEvC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAKtD,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAGD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAqhCxE,eAAO,MAAM,4BAA4B,EAAE,SAAS,MAAM,EASxD,CAAC;AAMH,eAAO,MAAM,iBAAiB,EAAE,kBAE/B,CAAC;AAeF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvE,CAAC;AAOF,wBAAgB,0BAA0B,IAAI,kBAAkB,CAG/D"}
|
|
@@ -1004,6 +1004,70 @@ function buildGuardrailCopy(_) {
|
|
|
1004
1004
|
})
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
+
},
|
|
1008
|
+
classifier: {
|
|
1009
|
+
displayName: _({
|
|
1010
|
+
id: 'guardrails.definitions.classifier.display-name',
|
|
1011
|
+
message: 'Classifier'
|
|
1012
|
+
}),
|
|
1013
|
+
description: _({
|
|
1014
|
+
id: "guardrails.definitions.classifier.description",
|
|
1015
|
+
message: "Evaluate questions against the payload with a non-generative classifier. Pick curated questions across categories, add your own, and flag when any answer reaches that question's threshold."
|
|
1016
|
+
}),
|
|
1017
|
+
paramLabels: {
|
|
1018
|
+
selectedQuestions: _({
|
|
1019
|
+
id: 'guardrails.definitions.classifier.param.selectedQuestions.label',
|
|
1020
|
+
message: 'Predefined questions'
|
|
1021
|
+
}),
|
|
1022
|
+
questions: _({
|
|
1023
|
+
id: 'guardrails.definitions.classifier.param.questions.label',
|
|
1024
|
+
message: 'Your questions'
|
|
1025
|
+
}),
|
|
1026
|
+
model: _({
|
|
1027
|
+
id: 'guardrails.definitions.classifier.param.model.label',
|
|
1028
|
+
message: 'Model'
|
|
1029
|
+
})
|
|
1030
|
+
},
|
|
1031
|
+
paramTooltips: {
|
|
1032
|
+
selectedQuestions: _({
|
|
1033
|
+
id: 'guardrails.definitions.classifier.param.selectedQuestions.tooltip',
|
|
1034
|
+
message: 'Curated questions grouped by category. Pick any across categories; score questions also take a severity cutoff. Add your own questions below.'
|
|
1035
|
+
}),
|
|
1036
|
+
questions: _({
|
|
1037
|
+
id: 'guardrails.definitions.classifier.param.questions.tooltip',
|
|
1038
|
+
message: "Yes/no questions about the payload, where 'yes' means the payload should be flagged. Added on top of any predefined questions you selected. Optionally define what counts as yes and as no — the classifier grades against those definitions, which helps on judgment-style questions."
|
|
1039
|
+
})
|
|
1040
|
+
},
|
|
1041
|
+
categoryLabels: {
|
|
1042
|
+
pii: _({
|
|
1043
|
+
id: 'guardrails.definitions.classifier.category.pii',
|
|
1044
|
+
message: 'PII'
|
|
1045
|
+
}),
|
|
1046
|
+
harmful_content: _({
|
|
1047
|
+
id: 'guardrails.definitions.classifier.category.harmful_content',
|
|
1048
|
+
message: 'Harmful content'
|
|
1049
|
+
}),
|
|
1050
|
+
prompt_injection: _({
|
|
1051
|
+
id: 'guardrails.definitions.classifier.category.prompt_injection',
|
|
1052
|
+
message: 'Prompt injection'
|
|
1053
|
+
}),
|
|
1054
|
+
intellectual_property: _({
|
|
1055
|
+
id: 'guardrails.definitions.classifier.category.intellectual_property',
|
|
1056
|
+
message: 'Intellectual property'
|
|
1057
|
+
}),
|
|
1058
|
+
secrets_and_credentials: _({
|
|
1059
|
+
id: 'guardrails.definitions.classifier.category.secrets_and_credentials',
|
|
1060
|
+
message: 'Secrets & credentials'
|
|
1061
|
+
}),
|
|
1062
|
+
compliance_commitments: _({
|
|
1063
|
+
id: 'guardrails.definitions.classifier.category.compliance_commitments',
|
|
1064
|
+
message: 'Compliance & commitments'
|
|
1065
|
+
}),
|
|
1066
|
+
scope_and_conduct: _({
|
|
1067
|
+
id: 'guardrails.definitions.classifier.category.scope_and_conduct',
|
|
1068
|
+
message: 'Scope & conduct'
|
|
1069
|
+
})
|
|
1070
|
+
}
|
|
1007
1071
|
}
|
|
1008
1072
|
};
|
|
1009
1073
|
}
|
|
@@ -1014,7 +1078,8 @@ const CURATED_GUARDRAIL_VALIDATORS = Object.freeze([
|
|
|
1014
1078
|
'user_prompt_attacks',
|
|
1015
1079
|
'intellectual_property',
|
|
1016
1080
|
'llm_as_judge',
|
|
1017
|
-
'sentiment'
|
|
1081
|
+
'sentiment',
|
|
1082
|
+
'classifier'
|
|
1018
1083
|
]);
|
|
1019
1084
|
const GUARDRAIL_COPY_EN = buildGuardrailCopy((descriptor)=>descriptor.message);
|
|
1020
1085
|
function collectEnglishMessages() {
|