@gmickel/gno 0.21.0 → 0.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +34 -1
- package/src/pipeline/expansion.ts +27 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmickel/gno",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.2",
|
|
4
4
|
"description": "Local semantic search for your documents. Index Markdown, PDF, and Office files with hybrid BM25 + vector search.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"embeddings",
|
|
@@ -54,7 +54,40 @@
|
|
|
54
54
|
"eval:hybrid": "bun --bun evalite evals/hybrid.eval.ts",
|
|
55
55
|
"eval:hybrid:baseline": "bun scripts/hybrid-benchmark.ts --write",
|
|
56
56
|
"eval:hybrid:delta": "bun scripts/hybrid-benchmark.ts --delta",
|
|
57
|
+
"eval:retrieval-candidates": "bun scripts/retrieval-candidate-benchmark.ts",
|
|
58
|
+
"eval:retrieval-candidates:write": "bun scripts/retrieval-candidate-benchmark.ts --write",
|
|
57
59
|
"eval:watch": "bun --bun evalite watch",
|
|
60
|
+
"research:finetune:bootstrap": "bun research/finetune/scripts/bootstrap-promotion-fixtures.ts",
|
|
61
|
+
"research:finetune:autonomous:noop": "bun research/finetune/autonomous/scripts/noop-run.ts",
|
|
62
|
+
"research:finetune:autonomous:evaluate": "bun research/finetune/autonomous/scripts/evaluate-run.ts",
|
|
63
|
+
"research:finetune:autonomous:propose-mix-variants": "bun research/finetune/autonomous/scripts/propose-mix-variants.ts",
|
|
64
|
+
"research:finetune:autonomous:list-search-candidates": "bun research/finetune/autonomous/scripts/list-search-candidates.ts",
|
|
65
|
+
"research:finetune:autonomous:run-candidate": "bun research/finetune/autonomous/scripts/run-candidate.ts",
|
|
66
|
+
"research:finetune:autonomous:search": "bun research/finetune/autonomous/scripts/search.ts",
|
|
67
|
+
"research:finetune:autonomous:leaderboard": "bun research/finetune/autonomous/scripts/leaderboard.ts",
|
|
68
|
+
"research:finetune:autonomous:confirm-winner": "bun research/finetune/autonomous/scripts/confirm-winner.ts",
|
|
69
|
+
"research:finetune:autonomous:check-promotion-targets": "bun research/finetune/autonomous/scripts/check-promotion-targets.ts",
|
|
70
|
+
"research:finetune:validate": "bun research/finetune/scripts/validate-sandbox.ts",
|
|
71
|
+
"research:finetune:qmd-import": "bun research/finetune/scripts/import-qmd-training.ts",
|
|
72
|
+
"research:finetune:mlx:build-dataset": "bun research/finetune/scripts/build-mlx-dataset.ts",
|
|
73
|
+
"research:finetune:build-variant-dataset": "bun research/finetune/scripts/build-variant-dataset.ts",
|
|
74
|
+
"research:finetune:list-mix-variants": "bun research/finetune/scripts/list-mix-variants.ts",
|
|
75
|
+
"research:finetune:list-prompt-variants": "bun research/finetune/scripts/list-prompt-variants.ts",
|
|
76
|
+
"research:finetune:export-env": "bun research/finetune/scripts/setup-export-env.ts",
|
|
77
|
+
"research:finetune:export-gguf": "bun research/finetune/scripts/export-gguf.ts",
|
|
78
|
+
"research:finetune:smoke-gno-export": "bun research/finetune/scripts/smoke-gno-export.ts",
|
|
79
|
+
"research:finetune:select-best": "bun research/finetune/scripts/select-best-checkpoint.ts",
|
|
80
|
+
"research:finetune:fuse-best": "bun research/finetune/scripts/fuse-best-checkpoint.ts",
|
|
81
|
+
"research:finetune:benchmark-export": "bun research/finetune/scripts/benchmark-exported-model.ts",
|
|
82
|
+
"research:finetune:repeat-benchmark-compare": "bun research/finetune/scripts/repeat-benchmark-compare.ts",
|
|
83
|
+
"research:finetune:compare-runs": "bun research/finetune/scripts/compare-runs.ts",
|
|
84
|
+
"research:finetune:promotion-bundle": "bun research/finetune/scripts/generate-promotion-bundle.ts",
|
|
85
|
+
"research:finetune:finalize": "bun research/finetune/scripts/finalize-promoted-model.ts",
|
|
86
|
+
"research:finetune:promote": "bun research/finetune/scripts/promote-run.ts",
|
|
87
|
+
"research:finetune:plan-sweep": "bun research/finetune/scripts/plan-alternate-sweep.ts",
|
|
88
|
+
"research:finetune:mlx:train": "bun research/finetune/scripts/train-mlx.ts",
|
|
89
|
+
"research:finetune:mlx:fuse": "bun research/finetune/scripts/fuse-mlx.ts",
|
|
90
|
+
"research:finetune:mlx:smoke": "bun research/finetune/scripts/smoke-mlx.ts",
|
|
58
91
|
"reset": "bun run src/index.ts reset --confirm",
|
|
59
92
|
"docs:verify": "bun run scripts/docs-verify.ts",
|
|
60
93
|
"website:install": "cd website && bundle install",
|
|
@@ -421,6 +421,30 @@ function parseExpansionResult(output: string): ExpansionResult | null {
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
|
|
424
|
+
/**
|
|
425
|
+
* Build the exact expansion prompt used by production query expansion.
|
|
426
|
+
* Exported for benchmark/eval harnesses that need to inspect raw model output.
|
|
427
|
+
*/
|
|
428
|
+
export function buildExpansionPrompt(
|
|
429
|
+
query: string,
|
|
430
|
+
options: Pick<ExpansionOptions, "lang" | "intent"> = {}
|
|
431
|
+
): string {
|
|
432
|
+
const template = getPromptTemplate(options.lang);
|
|
433
|
+
return buildPrompt(query, template, options.intent);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Parse raw expansion output using the same schema + guardrails as production.
|
|
438
|
+
* Exported for benchmark/eval harnesses that need raw-model diagnostics.
|
|
439
|
+
*/
|
|
440
|
+
export function parseExpansionOutput(
|
|
441
|
+
output: string,
|
|
442
|
+
query: string
|
|
443
|
+
): ExpansionResult | null {
|
|
444
|
+
const parsed = parseExpansionResult(output);
|
|
445
|
+
return parsed ? applyExpansionGuardrails(query, parsed) : null;
|
|
446
|
+
}
|
|
447
|
+
|
|
424
448
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
425
449
|
// Expansion Function
|
|
426
450
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -448,8 +472,7 @@ export async function expandQuery(
|
|
|
448
472
|
const timeout = options.timeout ?? DEFAULT_TIMEOUT_MS;
|
|
449
473
|
|
|
450
474
|
// Build prompt
|
|
451
|
-
const
|
|
452
|
-
const prompt = buildPrompt(query, template, options.intent);
|
|
475
|
+
const prompt = buildExpansionPrompt(query, options);
|
|
453
476
|
|
|
454
477
|
// Run with timeout (clear timer to avoid resource leak)
|
|
455
478
|
let timeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -484,11 +507,11 @@ export async function expandQuery(
|
|
|
484
507
|
}
|
|
485
508
|
|
|
486
509
|
// Parse result
|
|
487
|
-
const parsed =
|
|
510
|
+
const parsed = parseExpansionOutput(result.value, query);
|
|
488
511
|
if (!parsed) {
|
|
489
512
|
return ok(null);
|
|
490
513
|
}
|
|
491
|
-
return ok(
|
|
514
|
+
return ok(parsed);
|
|
492
515
|
} catch {
|
|
493
516
|
if (timeoutId) {
|
|
494
517
|
clearTimeout(timeoutId);
|