ai-sdk-guardrails 1.0.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.
@@ -0,0 +1,46 @@
1
+ import { A as AIResult, O as OutputGuardrail } from '../index-CWIb12lh.cjs';
2
+ import 'ai';
3
+
4
+ declare function extractContent(result: AIResult): {
5
+ text: string;
6
+ object: unknown;
7
+ usage?: {
8
+ promptTokens?: number;
9
+ completionTokens?: number;
10
+ totalTokens?: number;
11
+ };
12
+ finishReason?: string;
13
+ generationTimeMs?: number;
14
+ reasoning?: string;
15
+ };
16
+ declare const lengthLimit: (maxLength: number) => OutputGuardrail;
17
+ declare const blockedContent: (words: string[]) => OutputGuardrail;
18
+ declare const outputLengthLimit: (maxLength: number) => OutputGuardrail;
19
+ declare const blockedOutputContent: (words: string[]) => OutputGuardrail;
20
+ declare const jsonValidation: () => OutputGuardrail;
21
+ declare const confidenceThreshold: (minConfidence: number) => OutputGuardrail;
22
+ declare const toxicityFilter: (threshold?: number) => OutputGuardrail;
23
+ declare const customValidation: (name: string, validator: (output: {
24
+ text?: string;
25
+ object?: unknown;
26
+ usage?: {
27
+ promptTokens?: number;
28
+ completionTokens?: number;
29
+ totalTokens?: number;
30
+ };
31
+ finishReason?: string;
32
+ generationTimeMs?: number;
33
+ }) => boolean, message: string) => OutputGuardrail;
34
+ declare const schemaValidation: (schema: {
35
+ parse: (obj: unknown) => unknown;
36
+ }) => OutputGuardrail;
37
+ declare const tokenUsageLimit: (maxTokens: number) => OutputGuardrail;
38
+ declare const performanceMonitor: (maxGenerationTimeMs: number) => OutputGuardrail;
39
+ declare const hallucinationDetector: (confidenceThreshold?: number) => OutputGuardrail;
40
+ declare const biasDetector: () => OutputGuardrail;
41
+ declare const factualAccuracyChecker: (requireSources?: boolean) => OutputGuardrail;
42
+ declare const privacyLeakageDetector: () => OutputGuardrail;
43
+ declare const contentConsistencyChecker: (referenceContent?: string) => OutputGuardrail;
44
+ declare const complianceChecker: (regulations?: string[]) => OutputGuardrail;
45
+
46
+ export { biasDetector, blockedContent, blockedOutputContent, complianceChecker, confidenceThreshold, contentConsistencyChecker, customValidation, extractContent, factualAccuracyChecker, hallucinationDetector, jsonValidation, lengthLimit, outputLengthLimit, performanceMonitor, privacyLeakageDetector, schemaValidation, tokenUsageLimit, toxicityFilter };
@@ -0,0 +1,46 @@
1
+ import { A as AIResult, O as OutputGuardrail } from '../index-CWIb12lh.js';
2
+ import 'ai';
3
+
4
+ declare function extractContent(result: AIResult): {
5
+ text: string;
6
+ object: unknown;
7
+ usage?: {
8
+ promptTokens?: number;
9
+ completionTokens?: number;
10
+ totalTokens?: number;
11
+ };
12
+ finishReason?: string;
13
+ generationTimeMs?: number;
14
+ reasoning?: string;
15
+ };
16
+ declare const lengthLimit: (maxLength: number) => OutputGuardrail;
17
+ declare const blockedContent: (words: string[]) => OutputGuardrail;
18
+ declare const outputLengthLimit: (maxLength: number) => OutputGuardrail;
19
+ declare const blockedOutputContent: (words: string[]) => OutputGuardrail;
20
+ declare const jsonValidation: () => OutputGuardrail;
21
+ declare const confidenceThreshold: (minConfidence: number) => OutputGuardrail;
22
+ declare const toxicityFilter: (threshold?: number) => OutputGuardrail;
23
+ declare const customValidation: (name: string, validator: (output: {
24
+ text?: string;
25
+ object?: unknown;
26
+ usage?: {
27
+ promptTokens?: number;
28
+ completionTokens?: number;
29
+ totalTokens?: number;
30
+ };
31
+ finishReason?: string;
32
+ generationTimeMs?: number;
33
+ }) => boolean, message: string) => OutputGuardrail;
34
+ declare const schemaValidation: (schema: {
35
+ parse: (obj: unknown) => unknown;
36
+ }) => OutputGuardrail;
37
+ declare const tokenUsageLimit: (maxTokens: number) => OutputGuardrail;
38
+ declare const performanceMonitor: (maxGenerationTimeMs: number) => OutputGuardrail;
39
+ declare const hallucinationDetector: (confidenceThreshold?: number) => OutputGuardrail;
40
+ declare const biasDetector: () => OutputGuardrail;
41
+ declare const factualAccuracyChecker: (requireSources?: boolean) => OutputGuardrail;
42
+ declare const privacyLeakageDetector: () => OutputGuardrail;
43
+ declare const contentConsistencyChecker: (referenceContent?: string) => OutputGuardrail;
44
+ declare const complianceChecker: (regulations?: string[]) => OutputGuardrail;
45
+
46
+ export { biasDetector, blockedContent, blockedOutputContent, complianceChecker, confidenceThreshold, contentConsistencyChecker, customValidation, extractContent, factualAccuracyChecker, hallucinationDetector, jsonValidation, lengthLimit, outputLengthLimit, performanceMonitor, privacyLeakageDetector, schemaValidation, tokenUsageLimit, toxicityFilter };