@babav/knowledge-core-client 0.48.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 +45 -11
- package/dist/index.js +11 -6
- package/package.json +1 -1
- package/src/index.ts +54 -11
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;
|
|
@@ -1057,25 +1087,29 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
1057
1087
|
eval_version?: string;
|
|
1058
1088
|
}) => Promise<QueryProfile>;
|
|
1059
1089
|
};
|
|
1060
|
-
/** Query-profile benchmark
|
|
1061
|
-
* (
|
|
1062
|
-
* Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
1090
|
+
/** Query-profile benchmark leaderboard — top-N FULL-eval-set-scored profiles per eval version, per
|
|
1091
|
+
* category (quality | quality_cost | quality_latency). One tier only (the full eval-set); every row
|
|
1092
|
+
* is a full score. Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
1063
1093
|
benchmark: {
|
|
1064
1094
|
leaderboard: (q?: {
|
|
1065
1095
|
eval_version?: string;
|
|
1066
|
-
tier?: BenchmarkTier;
|
|
1067
1096
|
category?: BenchmarkCategory;
|
|
1068
1097
|
limit?: number;
|
|
1069
1098
|
}) => Promise<Leaderboard>;
|
|
1070
|
-
/**
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
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>;
|
|
1106
|
+
/** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
|
|
1107
|
+
* tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
|
|
1108
|
+
* populates the leaderboard. Runs in the background — returns 202 immediately. */
|
|
1073
1109
|
sweep: (b?: {
|
|
1074
|
-
scale?: "full" | "scoped";
|
|
1075
1110
|
concurrency?: number;
|
|
1076
1111
|
}) => Promise<{
|
|
1077
1112
|
status: string;
|
|
1078
|
-
scale: string;
|
|
1079
1113
|
concurrency: number | null;
|
|
1080
1114
|
}>;
|
|
1081
1115
|
};
|
package/dist/index.js
CHANGED
|
@@ -477,14 +477,19 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
477
477
|
* defaults to the current one. Pair with `benchmark.leaderboard` (pick a row -> its config_hash). */
|
|
478
478
|
createFromLeaderboard: (b) => this.request("POST", "/v1/query-profiles/from-leaderboard", { json: b }),
|
|
479
479
|
};
|
|
480
|
-
/** Query-profile benchmark
|
|
481
|
-
* (
|
|
482
|
-
* Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
480
|
+
/** Query-profile benchmark leaderboard — top-N FULL-eval-set-scored profiles per eval version, per
|
|
481
|
+
* category (quality | quality_cost | quality_latency). One tier only (the full eval-set); every row
|
|
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
|
-
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
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 }),
|
|
490
|
+
/** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
|
|
491
|
+
* tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
|
|
492
|
+
* populates the leaderboard. Runs in the background — returns 202 immediately. */
|
|
488
493
|
sweep: (b) => this.request("POST", "/v1/benchmark/sweep", { query: b }),
|
|
489
494
|
};
|
|
490
495
|
/** Ingestion profiles — the build-side config object (counterpart to query profiles): a tenant-owned,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "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,
|
|
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;
|
|
@@ -1193,17 +1230,23 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1193
1230
|
this.request<QueryProfile>("POST", "/v1/query-profiles/from-leaderboard", { json: b }),
|
|
1194
1231
|
};
|
|
1195
1232
|
|
|
1196
|
-
/** Query-profile benchmark
|
|
1197
|
-
* (
|
|
1198
|
-
* Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
1233
|
+
/** Query-profile benchmark leaderboard — top-N FULL-eval-set-scored profiles per eval version, per
|
|
1234
|
+
* category (quality | quality_cost | quality_latency). One tier only (the full eval-set); every row
|
|
1235
|
+
* is a full score. Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
1199
1236
|
benchmark = {
|
|
1200
|
-
leaderboard: (q?: { eval_version?: string;
|
|
1237
|
+
leaderboard: (q?: { eval_version?: string; category?: BenchmarkCategory; limit?: number }) =>
|
|
1201
1238
|
this.request<Leaderboard>("GET", "/v1/benchmark/leaderboard", { query: q }),
|
|
1202
|
-
/**
|
|
1203
|
-
*
|
|
1204
|
-
*
|
|
1205
|
-
|
|
1206
|
-
|
|
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 }),
|
|
1245
|
+
/** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
|
|
1246
|
+
* tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
|
|
1247
|
+
* populates the leaderboard. Runs in the background — returns 202 immediately. */
|
|
1248
|
+
sweep: (b?: { concurrency?: number }) =>
|
|
1249
|
+
this.request<{ status: string; concurrency: number | null }>(
|
|
1207
1250
|
"POST", "/v1/benchmark/sweep", { query: b }),
|
|
1208
1251
|
};
|
|
1209
1252
|
|