Add configurable SystemOne batching and release version 4.1.0
This commit is contained in:
parent
9a5404cb62
commit
7edae937b3
13 changed files with 400 additions and 31 deletions
|
|
@ -39,10 +39,13 @@ function runner({ fail = false, changeSettings = false } = {}) {
|
|||
AiClassifier: {
|
||||
getConfig() { return structuredClone(currentConfig); },
|
||||
async buildCacheKey(id, criterion) { return `${id}:${criterion}`; },
|
||||
async classify(text, criterion, options) {
|
||||
evaluated.push({ text, criterion, ...options });
|
||||
if (fail && options.cacheKey.startsWith('1:')) throw new Error('inference failed');
|
||||
return { matched: true };
|
||||
async *classifyRules(text, candidates, snapshot) {
|
||||
for (const { rule, cacheKey } of candidates) {
|
||||
evaluated.push({ text, criterion: rule.criterion, cacheKey, snapshot,
|
||||
threshold: rule.decisionThreshold ?? snapshot.decisionThreshold });
|
||||
if (fail && cacheKey.startsWith('1:')) throw new Error('inference failed');
|
||||
yield { rule, result: { matched: true } };
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue