Add human-led conversation learning loop
This commit is contained in:
1 parent
bc42c55555
commit
687abab82b
52 files changed
+2112
-53
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import Database from 'better-sqlite3';
|
||||
import path from 'node:path';
|
||||
import { ConversationLearningRepository } from '../src/database/conversation-learning-repository.js';
|
||||
import { runConversationLearningEvaluation } from '../src/services/conversation-learning-evaluator.js';
|
||||
|
||||
const argument = (name: string): string | undefined => {
|
||||
const index = process.argv.indexOf(name);
|
||||
return index >= 0 ? process.argv[index + 1] : undefined;
|
||||
};
|
||||
const databasePath = argument('--db');
|
||||
const policyVersion = argument('--policy') ?? 'baseline-v1';
|
||||
if (!databasePath) throw new Error('Usage: npm run learning:eval -- --db <sqlite-path> [--policy <version>]');
|
||||
const db = new Database(path.resolve(process.cwd(), databasePath), { readonly: false, fileMustExist: true });
|
||||
try {
|
||||
const run = runConversationLearningEvaluation(new ConversationLearningRepository(db), policyVersion);
|
||||
process.stdout.write(`${JSON.stringify(run, null, 2)}\n`);
|
||||
if (run.status === 'failed') process.exitCode = 1;
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
Reference in new issue
Block a user