/** * Intent Classifier * * Analyzes AI/agent intent to determine what it's trying to accomplish, * not just the literal action. Uses pattern matching and optionally LLM-based * classification to detect potentially risky intents. */ import type { ModelClient } from '@artemiskit/core'; import type { GuardrailResult, IntentClassification, ViolationSeverity } from './types'; /** * Intent category definition */ export interface IntentCategory { name: string; description: string; riskLevel: ViolationSeverity; patterns?: RegExp[]; keywords?: string[]; examples?: string[]; action?: 'allow' | 'warn' | 'block'; } /** * Intent classifier configuration */ export interface IntentClassifierConfig { /** Pre-defined intent categories */ categories?: IntentCategory[]; /** Use LLM for classification */ useLLM?: boolean; /** LLM client for classification */ llmClient?: ModelClient; /** Minimum confidence threshold */ confidenceThreshold?: number; /** Block unknown intents */ blockUnknown?: boolean; /** Block high-risk intents */ blockHighRisk?: boolean; } /** * Intent Classifier * * Analyzes text to determine the underlying intent and assess risk. */ export declare class IntentClassifier { private config; private categories; constructor(config?: IntentClassifierConfig); /** * Classify the intent of a given text */ classify(text: string): Promise; /** * Create a guardrail function from this classifier */ asGuardrail(): (content: string, context?: Record) => Promise; /** * Validate content and return guardrail result */ validate(text: string): Promise; /** * Add a custom intent category */ addCategory(category: IntentCategory): void; /** * Remove an intent category */ removeCategory(name: string): void; /** * Get all categories */ getCategories(): IntentCategory[]; /** * Classify using LLM (for more nuanced understanding) */ private classifyWithLLM; } /** * Create a default intent classifier */ export declare function createIntentClassifier(config?: IntentClassifierConfig): IntentClassifier; //# sourceMappingURL=intent-classifier.d.ts.map