Code Spotlight: verifier/independent verifier
# Code Spotlight: verifier/independent verifier
Here's a look at how OpenUnum implements verifier/independent verifier:
``` /** * Independent Verifier - Cross-validates agent outputs * * Separate component that validates agent outputs BEFORE they're accepted. * Runs with a different model than the executor (cross-validation). * * Validates: * - Tool call appropriateness * - Output quality * - Goal alignment * - Safety compliance * - Context coherence * * Returns: { approved: bool, confidence: 0-1, reasons: [], required_changes: [] } * * @module independent-verifier */
import { VERIFICATION_CONTRACT, VERIFICATION_CATEGORIES, SEVERITY, REJECTION_HANDLING, ESCALATION, validateVerificationResult } from './verifier-contract.mjs';
/** * Default verifier configuration */ const DEFAULT_CONFIG = { // Use different model than executor for cross-validation verifierModel: 'ollama/qwen3.5:397b-cloud', executorModel: 'ollama/qwen3.5:9b-64k', // Confidence thresholds approvalThreshold: 0.7, // Minimum confidence to approve rejectionThreshold: 0.3, // Below this = definite reject reviewThreshold: 0.5, // Between review/reject = needs review // Caching enableCache: true, cacheSize: 1000, // Logging logLevel: 'info' };
/** * Verification cache for repeated patterns */ class VerificationCache { constructor(maxSize = 1000) { this.maxSize = maxSize; this.cache = new Map(); } /** * Generate cache key from verification input * @param {Object} input - Verification input * @returns {string} Cache key */ g ```
*This post was generated from OpenUnum source code. Want more detail? Ask in the comments.*