@babav/knowledge-core-client 0.49.0 → 0.50.0

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/dist/index.d.ts CHANGED
@@ -520,6 +520,7 @@ export interface QueryProfile {
520
520
  top_k_reranked_chunks: number | null;
521
521
  sibling_window: number | null;
522
522
  rerank_instruction: string | null;
523
+ reranker_provider: string | null;
523
524
  max_subqueries: number | null;
524
525
  max_reasoning_rounds: number | null;
525
526
  decomposition_model: string | null;
@@ -539,12 +540,18 @@ export interface QueryProfile {
539
540
  visual_max_revisions: number | null;
540
541
  visual_combine_generation_and_concept: boolean | null;
541
542
  concept_model_mode: string | null;
543
+ scoring_status: "unscored" | "queued" | "running" | "scored" | "failed" | "stale" | null;
544
+ scoring_progress_done: number | null;
545
+ scoring_progress_total: number | null;
546
+ scoring_updated_at: string | null;
547
+ score_composite_q: number | null;
548
+ score_scored_at: string | null;
542
549
  }
543
550
  /** Fields settable when creating/updating a query profile. All optional except `name` on create
544
551
  * (null/omit => server default); model fields must be one of
545
552
  * `profiles.modelOptions().fields[field].supported`. The owning tenant is the caller's key —
546
- * it is never part of the body. */
547
- export type QueryProfileWrite = Partial<Omit<QueryProfile, "id" | "tenant_id">>;
553
+ * it is never part of the body. The score-my-profile status/score fields are read-only (server-set). */
554
+ export type QueryProfileWrite = Partial<Omit<QueryProfile, "id" | "tenant_id" | "scoring_status" | "scoring_progress_done" | "scoring_progress_total" | "scoring_updated_at" | "score_composite_q" | "score_scored_at">>;
548
555
  /** Model catalog for the query-profile-config UI (GET /v1/query-profiles/model-options). `models` maps id → its
549
556
  * capabilities; `fields` gives each profile model-field its supported ids + default (+ usage metadata);
550
557
  * `modes` says which model field governs each mode (reasoning is valid only if that model's
@@ -605,6 +612,29 @@ export interface Leaderboard {
605
612
  category: BenchmarkCategory;
606
613
  entries: LeaderboardEntry[];
607
614
  }
615
+ /** One reranker measured on a head. `contextual` is the self-hosted GPU baseline (delta 0); each other
616
+ * provider was measured varying ONLY reranker_provider on the same head + same full-150 eval-set.
617
+ * p50_ms/p95_ms/cost are that cell's measured end-to-end query figures. */
618
+ export interface RerankerCell {
619
+ provider: string;
620
+ composite_q: number | null;
621
+ delta_vs_contextual: number | null;
622
+ p50_ms: number | null;
623
+ p95_ms: number | null;
624
+ prod_cost_per_query_usd: number | null;
625
+ }
626
+ /** A head = the top query profile of one generation model; `cells` = [contextual, ...tested rerankers]. */
627
+ export interface RerankerHead {
628
+ generation_model: string;
629
+ config_hash: string;
630
+ cells: RerankerCell[];
631
+ }
632
+ /** Reranker comparison matrix (GET /v1/benchmark/rerankers) — system-level R&D result: per head,
633
+ * contextual vs each tested non-GPU reranker. `heads` is empty if no reranker benchmark has run. */
634
+ export interface RerankerComparison {
635
+ eval_version: string;
636
+ heads: RerankerHead[];
637
+ }
608
638
  export interface Tenant {
609
639
  id: UUID;
610
640
  name: string;
@@ -1066,6 +1096,13 @@ export declare class KnowledgeCoreClient extends HttpBase {
1066
1096
  category?: BenchmarkCategory;
1067
1097
  limit?: number;
1068
1098
  }) => Promise<Leaderboard>;
1099
+ /** Reranker comparison matrix — per head (the top query profile of each benchmarked generation
1100
+ * model), the self-hosted contextual GPU reranker vs each tested non-GPU reranker (Voyage, …),
1101
+ * with quality (full-150 composite_q + delta) and measured end-to-end latency/cost. Read-only,
1102
+ * tenant-anonymous. `heads` is empty when no reranker benchmark has run for the eval version. */
1103
+ rerankers: (q?: {
1104
+ eval_version?: string;
1105
+ }) => Promise<RerankerComparison>;
1069
1106
  /** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
1070
1107
  * tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
1071
1108
  * populates the leaderboard. Runs in the background — returns 202 immediately. */
package/dist/index.js CHANGED
@@ -482,6 +482,11 @@ export class KnowledgeCoreClient extends HttpBase {
482
482
  * is a full score. Tenant-anonymous (keyed by config hash); never a customer config. */
483
483
  benchmark = {
484
484
  leaderboard: (q) => this.request("GET", "/v1/benchmark/leaderboard", { query: q }),
485
+ /** Reranker comparison matrix — per head (the top query profile of each benchmarked generation
486
+ * model), the self-hosted contextual GPU reranker vs each tested non-GPU reranker (Voyage, …),
487
+ * with quality (full-150 composite_q + delta) and measured end-to-end latency/cost. Read-only,
488
+ * tenant-anonymous. `heads` is empty when no reranker benchmark has run for the eval version. */
489
+ rerankers: (q) => this.request("GET", "/v1/benchmark/rerankers", { query: q }),
485
490
  /** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
486
491
  * tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
487
492
  * populates the leaderboard. Runs in the background — returns 202 immediately. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babav/knowledge-core-client",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "description": "TypeScript client for the Babav Knowledge Core API (Deno + Node 18+, zero deps). Includes the babav.visual grammar TYPES at the ./visual subpath (types only; all visual rendering is server-side).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -486,6 +486,7 @@ export interface QueryProfile {
486
486
  top_k_reranked_chunks: number | null;
487
487
  sibling_window: number | null;
488
488
  rerank_instruction: string | null;
489
+ reranker_provider: string | null; // contextual | voyage | cohere | none (null => system default = contextual)
489
490
  max_subqueries: number | null;
490
491
  max_reasoning_rounds: number | null;
491
492
  decomposition_model: string | null;
@@ -506,13 +507,24 @@ export interface QueryProfile {
506
507
  visual_max_revisions: number | null;
507
508
  visual_combine_generation_and_concept: boolean | null;
508
509
  concept_model_mode: string | null; // "reasoning" | "standard"; overrules gen mode when combining
510
+ // --- score-my-profile status/progress (READ-only; not settable) ---------------------------------
511
+ // Durable on the profile so a client can kick scoring, leave, and see the status/result on any later
512
+ // read. score_composite_q/score_scored_at are the cached score for the CURRENT eval version.
513
+ scoring_status: "unscored" | "queued" | "running" | "scored" | "failed" | "stale" | null;
514
+ scoring_progress_done: number | null;
515
+ scoring_progress_total: number | null;
516
+ scoring_updated_at: string | null; // ISO timestamp; heartbeat while running
517
+ score_composite_q: number | null;
518
+ score_scored_at: string | null;
509
519
  }
510
520
 
511
521
  /** Fields settable when creating/updating a query profile. All optional except `name` on create
512
522
  * (null/omit => server default); model fields must be one of
513
523
  * `profiles.modelOptions().fields[field].supported`. The owning tenant is the caller's key —
514
- * it is never part of the body. */
515
- export type QueryProfileWrite = Partial<Omit<QueryProfile, "id" | "tenant_id">>;
524
+ * it is never part of the body. The score-my-profile status/score fields are read-only (server-set). */
525
+ export type QueryProfileWrite = Partial<Omit<QueryProfile,
526
+ "id" | "tenant_id" | "scoring_status" | "scoring_progress_done" | "scoring_progress_total"
527
+ | "scoring_updated_at" | "score_composite_q" | "score_scored_at">>;
516
528
 
517
529
  /** Model catalog for the query-profile-config UI (GET /v1/query-profiles/model-options). `models` maps id → its
518
530
  * capabilities; `fields` gives each profile model-field its supported ids + default (+ usage metadata);
@@ -563,6 +575,31 @@ export interface Leaderboard {
563
575
  category: BenchmarkCategory;
564
576
  entries: LeaderboardEntry[];
565
577
  }
578
+
579
+ /** One reranker measured on a head. `contextual` is the self-hosted GPU baseline (delta 0); each other
580
+ * provider was measured varying ONLY reranker_provider on the same head + same full-150 eval-set.
581
+ * p50_ms/p95_ms/cost are that cell's measured end-to-end query figures. */
582
+ export interface RerankerCell {
583
+ provider: string; // contextual | voyage | cohere | ...
584
+ composite_q: number | null;
585
+ delta_vs_contextual: number | null;
586
+ p50_ms: number | null;
587
+ p95_ms: number | null;
588
+ prod_cost_per_query_usd: number | null;
589
+ }
590
+ /** A head = the top query profile of one generation model; `cells` = [contextual, ...tested rerankers]. */
591
+ export interface RerankerHead {
592
+ generation_model: string;
593
+ config_hash: string;
594
+ cells: RerankerCell[];
595
+ }
596
+ /** Reranker comparison matrix (GET /v1/benchmark/rerankers) — system-level R&D result: per head,
597
+ * contextual vs each tested non-GPU reranker. `heads` is empty if no reranker benchmark has run. */
598
+ export interface RerankerComparison {
599
+ eval_version: string;
600
+ heads: RerankerHead[];
601
+ }
602
+
566
603
  export interface Tenant {
567
604
  id: UUID;
568
605
  name: string;
@@ -1199,6 +1236,12 @@ export class KnowledgeCoreClient extends HttpBase {
1199
1236
  benchmark = {
1200
1237
  leaderboard: (q?: { eval_version?: string; category?: BenchmarkCategory; limit?: number }) =>
1201
1238
  this.request<Leaderboard>("GET", "/v1/benchmark/leaderboard", { query: q }),
1239
+ /** Reranker comparison matrix — per head (the top query profile of each benchmarked generation
1240
+ * model), the self-hosted contextual GPU reranker vs each tested non-GPU reranker (Voyage, …),
1241
+ * with quality (full-150 composite_q + delta) and measured end-to-end latency/cost. Read-only,
1242
+ * tenant-anonymous. `heads` is empty when no reranker benchmark has run for the eval version. */
1243
+ rerankers: (q?: { eval_version?: string }) =>
1244
+ this.request<RerankerComparison>("GET", "/v1/benchmark/rerankers", { query: q }),
1202
1245
  /** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
1203
1246
  * tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
1204
1247
  * populates the leaderboard. Runs in the background — returns 202 immediately. */