import { InputGuardrail } from "../types.js"; //#region src/guardrails/builtins/language-whitelist.d.ts /** * Stable language codes the built-in detector recognises. * * @stable */ type DetectedLanguage = 'en' | 'ru' | 'uk' | 'de' | 'fr' | 'es' | 'it' | 'pt' | 'pl' | 'cs' | 'unknown'; /** * Options for `languageWhitelist(...)`. * * @stable */ interface LanguageWhitelistOptions { readonly allowed: ReadonlyArray; /** * Override the built-in detector. Useful when the deployment ships * a more accurate detector (e.g. CLD3 via FFI). */ readonly detect?: (text: string) => DetectedLanguage; /** Action on rejection. Defaults to `'block'`. */ readonly action?: 'block' | 'warn'; /** Override guardrail name. */ readonly name?: string; /** * Treat `'unknown'` as accepted. Defaults to `true` so the * guardrail does not over-block multilingual input. */ readonly acceptUnknown?: boolean; } /** * Construct the language-whitelist guardrail. * * @stable */ declare function languageWhitelist(opts: LanguageWhitelistOptions): InputGuardrail; /** * Default language detector. The detector scores text by: * * - The proportion of ASCII vs Cyrillic / extended-Latin * characters; tells English / Russian / Ukrainian apart from * Latin-but-not-English families. * - A small, well-known stopword list per language; the language * with the highest stopword hit count wins. * * The detector returns `'unknown'` when no signal exceeds a * conservative threshold. Operators who need higher accuracy should * override `detect`. * * @stable */ declare function detectLanguage(text: string): DetectedLanguage; //#endregion export { DetectedLanguage, LanguageWhitelistOptions, detectLanguage, languageWhitelist }; //# sourceMappingURL=language-whitelist.d.ts.map