@babav/knowledge-core-client 0.45.0 → 0.46.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 +53 -1
- package/dist/index.js +10 -0
- package/package.json +1 -1
- package/src/index.ts +53 -1
package/dist/index.d.ts
CHANGED
|
@@ -552,7 +552,7 @@ export type QueryProfileWrite = Partial<Omit<QueryProfile, "id" | "tenant_id">>;
|
|
|
552
552
|
export interface ModelOptions {
|
|
553
553
|
models: Record<string, {
|
|
554
554
|
label: string;
|
|
555
|
-
provider: "anthropic" | "vertex";
|
|
555
|
+
provider: "anthropic" | "vertex" | "moonshot";
|
|
556
556
|
kind: "text" | "vision";
|
|
557
557
|
supports_reasoning: boolean;
|
|
558
558
|
}>;
|
|
@@ -568,6 +568,43 @@ export interface ModelOptions {
|
|
|
568
568
|
values: string[];
|
|
569
569
|
}>;
|
|
570
570
|
}
|
|
571
|
+
export type BenchmarkTier = "client_quick" | "screening" | "full";
|
|
572
|
+
export type BenchmarkCategory = "quality" | "quality_cost" | "quality_latency";
|
|
573
|
+
/** A query profile's benchmark score. `cache_hit=false` + `scoring_status="queued"` means scoring was
|
|
574
|
+
* enqueued (poll again / check the leaderboard). */
|
|
575
|
+
export interface BenchmarkScore {
|
|
576
|
+
cache_hit: boolean;
|
|
577
|
+
config_hash: string;
|
|
578
|
+
eval_version: string | null;
|
|
579
|
+
scoring_status: "unscored" | "queued" | "running" | "scored" | "failed" | "stale";
|
|
580
|
+
composite_q: number | null;
|
|
581
|
+
sub_scores: Record<string, unknown>;
|
|
582
|
+
per_language: Record<string, number>;
|
|
583
|
+
gates: Record<string, unknown>;
|
|
584
|
+
prod_cost_per_query_usd: number | null;
|
|
585
|
+
p50_ms: number | null;
|
|
586
|
+
p95_ms: number | null;
|
|
587
|
+
percentile: number | null;
|
|
588
|
+
job_id: string | null;
|
|
589
|
+
}
|
|
590
|
+
export interface LeaderboardEntry {
|
|
591
|
+
rank: number;
|
|
592
|
+
config_hash: string;
|
|
593
|
+
generation_model: string | null;
|
|
594
|
+
composite_q: number | null;
|
|
595
|
+
prod_cost_per_query_usd: number | null;
|
|
596
|
+
p50_ms: number | null;
|
|
597
|
+
p95_ms: number | null;
|
|
598
|
+
sub_scores: Record<string, unknown>;
|
|
599
|
+
per_language: Record<string, number>;
|
|
600
|
+
config: Record<string, unknown> | null;
|
|
601
|
+
}
|
|
602
|
+
export interface Leaderboard {
|
|
603
|
+
eval_version: string;
|
|
604
|
+
tier: BenchmarkTier;
|
|
605
|
+
category: BenchmarkCategory;
|
|
606
|
+
entries: LeaderboardEntry[];
|
|
607
|
+
}
|
|
571
608
|
export interface Tenant {
|
|
572
609
|
id: UUID;
|
|
573
610
|
name: string;
|
|
@@ -1007,6 +1044,21 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
1007
1044
|
/** The model catalog for an query-profile-config UI: supported models + default per field, per-model
|
|
1008
1045
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
1009
1046
|
modelOptions: () => Promise<ModelOptions>;
|
|
1047
|
+
/** Benchmark this query profile against the eval-set (cache-first on config hash; a miss queues
|
|
1048
|
+
* scoring). Returns the score (quality composite + sub-scores + gates + cost + latency) or a
|
|
1049
|
+
* queued status. See also `benchmark.leaderboard`. */
|
|
1050
|
+
benchmark: (id: UUID) => Promise<BenchmarkScore>;
|
|
1051
|
+
};
|
|
1052
|
+
/** Query-profile benchmark leaderboards — top-N system-swept profiles per eval version, per tier
|
|
1053
|
+
* (client_quick | screening | full) and per category (quality | quality_cost | quality_latency).
|
|
1054
|
+
* Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
1055
|
+
benchmark: {
|
|
1056
|
+
leaderboard: (q?: {
|
|
1057
|
+
eval_version?: string;
|
|
1058
|
+
tier?: BenchmarkTier;
|
|
1059
|
+
category?: BenchmarkCategory;
|
|
1060
|
+
limit?: number;
|
|
1061
|
+
}) => Promise<Leaderboard>;
|
|
1010
1062
|
};
|
|
1011
1063
|
/** Ingestion profiles — the build-side config object (counterpart to query profiles): a tenant-owned,
|
|
1012
1064
|
* named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike a query profile
|
package/dist/index.js
CHANGED
|
@@ -468,6 +468,16 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
468
468
|
/** The model catalog for an query-profile-config UI: supported models + default per field, per-model
|
|
469
469
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
470
470
|
modelOptions: () => this.request("GET", "/v1/query-profiles/model-options"),
|
|
471
|
+
/** Benchmark this query profile against the eval-set (cache-first on config hash; a miss queues
|
|
472
|
+
* scoring). Returns the score (quality composite + sub-scores + gates + cost + latency) or a
|
|
473
|
+
* queued status. See also `benchmark.leaderboard`. */
|
|
474
|
+
benchmark: (id) => this.request("POST", `/v1/query-profiles/${id}/benchmark`),
|
|
475
|
+
};
|
|
476
|
+
/** Query-profile benchmark leaderboards — top-N system-swept profiles per eval version, per tier
|
|
477
|
+
* (client_quick | screening | full) and per category (quality | quality_cost | quality_latency).
|
|
478
|
+
* Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
479
|
+
benchmark = {
|
|
480
|
+
leaderboard: (q) => this.request("GET", "/v1/benchmark/leaderboard", { query: q }),
|
|
471
481
|
};
|
|
472
482
|
/** Ingestion profiles — the build-side config object (counterpart to query profiles): a tenant-owned,
|
|
473
483
|
* named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike a query profile
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.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
|
@@ -519,10 +519,50 @@ export type QueryProfileWrite = Partial<Omit<QueryProfile, "id" | "tenant_id">>;
|
|
|
519
519
|
* `modes` says which model field governs each mode (reasoning is valid only if that model's
|
|
520
520
|
* supports_reasoning is true). KC provides the data; the UI decides presentation. */
|
|
521
521
|
export interface ModelOptions {
|
|
522
|
-
models: Record<string, { label: string; provider: "anthropic" | "vertex"; kind: "text" | "vision"; supports_reasoning: boolean }>;
|
|
522
|
+
models: Record<string, { label: string; provider: "anthropic" | "vertex" | "moonshot"; kind: "text" | "vision"; supports_reasoning: boolean }>;
|
|
523
523
|
fields: Record<string, { supported: string[]; default: string; applies_when?: string; applies_to?: string[]; note?: string }>;
|
|
524
524
|
modes: Record<string, { depends_on: string; values: string[] }>;
|
|
525
525
|
}
|
|
526
|
+
|
|
527
|
+
// ---- benchmark (score-my-profile + leaderboards) --------------------------
|
|
528
|
+
export type BenchmarkTier = "client_quick" | "screening" | "full";
|
|
529
|
+
export type BenchmarkCategory = "quality" | "quality_cost" | "quality_latency";
|
|
530
|
+
|
|
531
|
+
/** A query profile's benchmark score. `cache_hit=false` + `scoring_status="queued"` means scoring was
|
|
532
|
+
* enqueued (poll again / check the leaderboard). */
|
|
533
|
+
export interface BenchmarkScore {
|
|
534
|
+
cache_hit: boolean;
|
|
535
|
+
config_hash: string;
|
|
536
|
+
eval_version: string | null;
|
|
537
|
+
scoring_status: "unscored" | "queued" | "running" | "scored" | "failed" | "stale";
|
|
538
|
+
composite_q: number | null;
|
|
539
|
+
sub_scores: Record<string, unknown>;
|
|
540
|
+
per_language: Record<string, number>;
|
|
541
|
+
gates: Record<string, unknown>;
|
|
542
|
+
prod_cost_per_query_usd: number | null;
|
|
543
|
+
p50_ms: number | null;
|
|
544
|
+
p95_ms: number | null;
|
|
545
|
+
percentile: number | null;
|
|
546
|
+
job_id: string | null;
|
|
547
|
+
}
|
|
548
|
+
export interface LeaderboardEntry {
|
|
549
|
+
rank: number;
|
|
550
|
+
config_hash: string;
|
|
551
|
+
generation_model: string | null;
|
|
552
|
+
composite_q: number | null;
|
|
553
|
+
prod_cost_per_query_usd: number | null;
|
|
554
|
+
p50_ms: number | null;
|
|
555
|
+
p95_ms: number | null;
|
|
556
|
+
sub_scores: Record<string, unknown>;
|
|
557
|
+
per_language: Record<string, number>;
|
|
558
|
+
config: Record<string, unknown> | null;
|
|
559
|
+
}
|
|
560
|
+
export interface Leaderboard {
|
|
561
|
+
eval_version: string;
|
|
562
|
+
tier: BenchmarkTier;
|
|
563
|
+
category: BenchmarkCategory;
|
|
564
|
+
entries: LeaderboardEntry[];
|
|
565
|
+
}
|
|
526
566
|
export interface Tenant {
|
|
527
567
|
id: UUID;
|
|
528
568
|
name: string;
|
|
@@ -1142,6 +1182,18 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1142
1182
|
/** The model catalog for an query-profile-config UI: supported models + default per field, per-model
|
|
1143
1183
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
1144
1184
|
modelOptions: () => this.request<ModelOptions>("GET", "/v1/query-profiles/model-options"),
|
|
1185
|
+
/** Benchmark this query profile against the eval-set (cache-first on config hash; a miss queues
|
|
1186
|
+
* scoring). Returns the score (quality composite + sub-scores + gates + cost + latency) or a
|
|
1187
|
+
* queued status. See also `benchmark.leaderboard`. */
|
|
1188
|
+
benchmark: (id: UUID) => this.request<BenchmarkScore>("POST", `/v1/query-profiles/${id}/benchmark`),
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
/** Query-profile benchmark leaderboards — top-N system-swept profiles per eval version, per tier
|
|
1192
|
+
* (client_quick | screening | full) and per category (quality | quality_cost | quality_latency).
|
|
1193
|
+
* Tenant-anonymous (keyed by config hash); never a customer config. */
|
|
1194
|
+
benchmark = {
|
|
1195
|
+
leaderboard: (q?: { eval_version?: string; tier?: BenchmarkTier; category?: BenchmarkCategory; limit?: number }) =>
|
|
1196
|
+
this.request<Leaderboard>("GET", "/v1/benchmark/leaderboard", { query: q }),
|
|
1145
1197
|
};
|
|
1146
1198
|
|
|
1147
1199
|
/** Ingestion profiles — the build-side config object (counterpart to query profiles): a tenant-owned,
|