@babav/knowledge-core-client 0.49.0 → 0.51.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 +46 -3
- package/dist/index.js +5 -0
- package/package.json +1 -1
- package/src/index.ts +49 -3
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,16 +540,23 @@ 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
|
|
551
|
-
* supports_reasoning is true)
|
|
558
|
+
* supports_reasoning is true); `rerankers` gives the supported values for a profile's `reranker_provider`
|
|
559
|
+
* field + the system default. KC provides the data; the UI decides presentation. */
|
|
552
560
|
export interface ModelOptions {
|
|
553
561
|
models: Record<string, {
|
|
554
562
|
label: string;
|
|
@@ -567,6 +575,11 @@ export interface ModelOptions {
|
|
|
567
575
|
depends_on: string;
|
|
568
576
|
values: string[];
|
|
569
577
|
}>;
|
|
578
|
+
/** Supported `reranker_provider` values (null on a profile => system default). */
|
|
579
|
+
rerankers: {
|
|
580
|
+
supported: string[];
|
|
581
|
+
default: string;
|
|
582
|
+
};
|
|
570
583
|
}
|
|
571
584
|
export type BenchmarkTier = "client_quick" | "screening" | "full";
|
|
572
585
|
export type BenchmarkCategory = "quality" | "quality_cost" | "quality_latency";
|
|
@@ -605,6 +618,29 @@ export interface Leaderboard {
|
|
|
605
618
|
category: BenchmarkCategory;
|
|
606
619
|
entries: LeaderboardEntry[];
|
|
607
620
|
}
|
|
621
|
+
/** One reranker measured on a head. `contextual` is the self-hosted GPU baseline (delta 0); each other
|
|
622
|
+
* provider was measured varying ONLY reranker_provider on the same head + same full-150 eval-set.
|
|
623
|
+
* p50_ms/p95_ms/cost are that cell's measured end-to-end query figures. */
|
|
624
|
+
export interface RerankerCell {
|
|
625
|
+
provider: string;
|
|
626
|
+
composite_q: number | null;
|
|
627
|
+
delta_vs_contextual: number | null;
|
|
628
|
+
p50_ms: number | null;
|
|
629
|
+
p95_ms: number | null;
|
|
630
|
+
prod_cost_per_query_usd: number | null;
|
|
631
|
+
}
|
|
632
|
+
/** A head = the top query profile of one generation model; `cells` = [contextual, ...tested rerankers]. */
|
|
633
|
+
export interface RerankerHead {
|
|
634
|
+
generation_model: string;
|
|
635
|
+
config_hash: string;
|
|
636
|
+
cells: RerankerCell[];
|
|
637
|
+
}
|
|
638
|
+
/** Reranker comparison matrix (GET /v1/benchmark/rerankers) — system-level R&D result: per head,
|
|
639
|
+
* contextual vs each tested non-GPU reranker. `heads` is empty if no reranker benchmark has run. */
|
|
640
|
+
export interface RerankerComparison {
|
|
641
|
+
eval_version: string;
|
|
642
|
+
heads: RerankerHead[];
|
|
643
|
+
}
|
|
608
644
|
export interface Tenant {
|
|
609
645
|
id: UUID;
|
|
610
646
|
name: string;
|
|
@@ -1066,6 +1102,13 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
1066
1102
|
category?: BenchmarkCategory;
|
|
1067
1103
|
limit?: number;
|
|
1068
1104
|
}) => Promise<Leaderboard>;
|
|
1105
|
+
/** Reranker comparison matrix — per head (the top query profile of each benchmarked generation
|
|
1106
|
+
* model), the self-hosted contextual GPU reranker vs each tested non-GPU reranker (Voyage, …),
|
|
1107
|
+
* with quality (full-150 composite_q + delta) and measured end-to-end latency/cost. Read-only,
|
|
1108
|
+
* tenant-anonymous. `heads` is empty when no reranker benchmark has run for the eval version. */
|
|
1109
|
+
rerankers: (q?: {
|
|
1110
|
+
eval_version?: string;
|
|
1111
|
+
}) => Promise<RerankerComparison>;
|
|
1069
1112
|
/** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
|
|
1070
1113
|
* tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
|
|
1071
1114
|
* 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.
|
|
3
|
+
"version": "0.51.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,22 +507,36 @@ 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);
|
|
519
531
|
* `modes` says which model field governs each mode (reasoning is valid only if that model's
|
|
520
|
-
* supports_reasoning is true)
|
|
532
|
+
* supports_reasoning is true); `rerankers` gives the supported values for a profile's `reranker_provider`
|
|
533
|
+
* field + the system default. KC provides the data; the UI decides presentation. */
|
|
521
534
|
export interface ModelOptions {
|
|
522
535
|
models: Record<string, { label: string; provider: "anthropic" | "vertex" | "moonshot"; kind: "text" | "vision"; supports_reasoning: boolean }>;
|
|
523
536
|
fields: Record<string, { supported: string[]; default: string; applies_when?: string; applies_to?: string[]; note?: string }>;
|
|
524
537
|
modes: Record<string, { depends_on: string; values: string[] }>;
|
|
538
|
+
/** Supported `reranker_provider` values (null on a profile => system default). */
|
|
539
|
+
rerankers: { supported: string[]; default: string };
|
|
525
540
|
}
|
|
526
541
|
|
|
527
542
|
// ---- benchmark (score-my-profile + leaderboards) --------------------------
|
|
@@ -563,6 +578,31 @@ export interface Leaderboard {
|
|
|
563
578
|
category: BenchmarkCategory;
|
|
564
579
|
entries: LeaderboardEntry[];
|
|
565
580
|
}
|
|
581
|
+
|
|
582
|
+
/** One reranker measured on a head. `contextual` is the self-hosted GPU baseline (delta 0); each other
|
|
583
|
+
* provider was measured varying ONLY reranker_provider on the same head + same full-150 eval-set.
|
|
584
|
+
* p50_ms/p95_ms/cost are that cell's measured end-to-end query figures. */
|
|
585
|
+
export interface RerankerCell {
|
|
586
|
+
provider: string; // contextual | voyage | cohere | ...
|
|
587
|
+
composite_q: number | null;
|
|
588
|
+
delta_vs_contextual: number | null;
|
|
589
|
+
p50_ms: number | null;
|
|
590
|
+
p95_ms: number | null;
|
|
591
|
+
prod_cost_per_query_usd: number | null;
|
|
592
|
+
}
|
|
593
|
+
/** A head = the top query profile of one generation model; `cells` = [contextual, ...tested rerankers]. */
|
|
594
|
+
export interface RerankerHead {
|
|
595
|
+
generation_model: string;
|
|
596
|
+
config_hash: string;
|
|
597
|
+
cells: RerankerCell[];
|
|
598
|
+
}
|
|
599
|
+
/** Reranker comparison matrix (GET /v1/benchmark/rerankers) — system-level R&D result: per head,
|
|
600
|
+
* contextual vs each tested non-GPU reranker. `heads` is empty if no reranker benchmark has run. */
|
|
601
|
+
export interface RerankerComparison {
|
|
602
|
+
eval_version: string;
|
|
603
|
+
heads: RerankerHead[];
|
|
604
|
+
}
|
|
605
|
+
|
|
566
606
|
export interface Tenant {
|
|
567
607
|
id: UUID;
|
|
568
608
|
name: string;
|
|
@@ -1199,6 +1239,12 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1199
1239
|
benchmark = {
|
|
1200
1240
|
leaderboard: (q?: { eval_version?: string; category?: BenchmarkCategory; limit?: number }) =>
|
|
1201
1241
|
this.request<Leaderboard>("GET", "/v1/benchmark/leaderboard", { query: q }),
|
|
1242
|
+
/** Reranker comparison matrix — per head (the top query profile of each benchmarked generation
|
|
1243
|
+
* model), the self-hosted contextual GPU reranker vs each tested non-GPU reranker (Voyage, …),
|
|
1244
|
+
* with quality (full-150 composite_q + delta) and measured end-to-end latency/cost. Read-only,
|
|
1245
|
+
* tenant-anonymous. `heads` is empty when no reranker benchmark has run for the eval version. */
|
|
1246
|
+
rerankers: (q?: { eval_version?: string }) =>
|
|
1247
|
+
this.request<RerankerComparison>("GET", "/v1/benchmark/rerankers", { query: q }),
|
|
1202
1248
|
/** Kick the sweep as the BENCHMARK TENANT (this client's own key — no admin key). The benchmark
|
|
1203
1249
|
* tenant owns the bench corpora + eval-set; the sweep FULL-scores the sensible config set and
|
|
1204
1250
|
* populates the leaderboard. Runs in the background — returns 202 immediately. */
|