llm-guard
Version:
A TypeScript library for validating and securing LLM prompts
19 lines (18 loc) • 540 B
TypeScript
import { BaseGuard } from './base';
import { GuardResult } from '../types';
export declare class RelevanceGuard extends BaseGuard {
private minLength;
private maxLength;
private minWords;
private maxWords;
private commonFillerWords;
constructor(enabled?: boolean, options?: {
minLength?: number;
maxLength?: number;
minWords?: number;
maxWords?: number;
});
private calculateRelevanceScore;
private findRepeatedPhrases;
validate(text: string): Promise<GuardResult>;
}