UNPKG

@ai2070/l0

Version:

L0: The Missing Reliability Substrate for AI

37 lines 1.1 kB
export function runAsyncGuardrailCheck(engine, context, onComplete) { if (context.delta && context.delta.length < 1000) { const quickContext = { ...context, content: context.delta, }; const quickResult = engine.check(quickContext); if (quickResult.violations.length > 0) { return quickResult; } if (context.content.length < 5000) { return engine.check(context); } } setImmediate(() => { try { const result = engine.check(context); onComplete(result); } catch { onComplete({ violations: [], shouldHalt: false, shouldRetry: false }); } }); return undefined; } export function runGuardrailCheckAsync(engine, context, onComplete) { setImmediate(() => { try { const result = engine.check(context); onComplete(result); } catch { onComplete({ violations: [], shouldHalt: false, shouldRetry: false }); } }); } //# sourceMappingURL=async.js.map