@vouchington/utils 0.10.0 → 0.10.1
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/ai-moderation.d.mts
CHANGED
|
@@ -8,10 +8,10 @@ export type ModerationInputPart = {
|
|
|
8
8
|
url: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
/** The fields of a moderation result this module reads. */
|
|
11
|
+
/** The fields of a moderation result this module reads. A null category counts as not flagged. */
|
|
12
12
|
export type ModerationResultLike = {
|
|
13
13
|
flagged: boolean;
|
|
14
|
-
categories: Record<string, boolean
|
|
14
|
+
categories: Readonly<Record<string, boolean | null>>;
|
|
15
15
|
};
|
|
16
16
|
export type MessageSafetyViolation = {
|
|
17
17
|
code: 'PROMPT_INJECTION';
|
package/dist/ai-moderation.mjs
CHANGED
|
@@ -7,7 +7,7 @@ export function buildModerationInput(texts, imageUrls = []) {
|
|
|
7
7
|
}
|
|
8
8
|
/** Names of the categories a result flagged. */
|
|
9
9
|
export function getFlaggedCategories(result) {
|
|
10
|
-
return Object.entries(result.categories).flatMap(([category, flagged]) => flagged ? [category] : []);
|
|
10
|
+
return Object.entries(result.categories).flatMap(([category, flagged]) => flagged === true ? [category] : []);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* A violation naming every category flagged by any result, else null. Results line up with the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vouchington/utils",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "Dependency-free runtime utilities for Vouchington-style applications.",
|
|
5
5
|
"homepage": "https://github.com/vouchington/vouchington-platform/tree/main/packages/utils#readme",
|
|
6
6
|
"bugs": {
|