@dooor-ai/toolkit
Version:
Guards, Evals & Observability for AI applications - works seamlessly with LangChain/LangGraph
36 lines (35 loc) • 750 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Guard = void 0;
/**
* Abstract base class for all guards
*/
class Guard {
constructor(config = {}) {
this.config = {
threshold: 0.8,
blockOnDetection: true,
enabled: true,
...config,
};
}
/**
* Check if this guard is enabled
*/
isEnabled() {
return this.config.enabled ?? true;
}
/**
* Check if guard should block on detection
*/
shouldBlock() {
return this.config.blockOnDetection ?? true;
}
/**
* Get the threshold
*/
getThreshold() {
return this.config.threshold ?? 0.8;
}
}
exports.Guard = Guard;