@babav/knowledge-core-client 0.58.0 → 0.60.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 +51 -0
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/index.ts +54 -0
package/dist/index.d.ts
CHANGED
|
@@ -79,6 +79,7 @@ export interface VisualOverrides {
|
|
|
79
79
|
claims_check_model?: string;
|
|
80
80
|
vision_judge_model?: string;
|
|
81
81
|
image_gen_model?: string;
|
|
82
|
+
html_advisory_judge?: boolean;
|
|
82
83
|
}
|
|
83
84
|
/** Per-request visual control. Absent => mode resolves from the profile default. All visual
|
|
84
85
|
* PROCESSING is server-side; the client only displays the result. */
|
|
@@ -544,6 +545,7 @@ export interface QueryProfile {
|
|
|
544
545
|
visual_image_gen_model: string | null;
|
|
545
546
|
visual_max_revisions: number | null;
|
|
546
547
|
visual_combine_generation_and_concept: boolean | null;
|
|
548
|
+
visual_html_advisory_judge: boolean | null;
|
|
547
549
|
concept_model_mode: string | null;
|
|
548
550
|
scoring_status: "no_score" | "queued" | "running" | "scored" | null;
|
|
549
551
|
scoring_progress_done: number | null;
|
|
@@ -686,6 +688,45 @@ export interface CitationArm {
|
|
|
686
688
|
n_questions: number | null;
|
|
687
689
|
note: string | null;
|
|
688
690
|
}
|
|
691
|
+
/** Per-model cost split within a stage. `actual_usd` is cache-discounted (matches the bill);
|
|
692
|
+
* `representative_usd` is the as-if-uncached headline. */
|
|
693
|
+
export interface CostByModel {
|
|
694
|
+
calls: number;
|
|
695
|
+
representative_usd: number;
|
|
696
|
+
actual_usd: number;
|
|
697
|
+
avg_actual_usd_per_query: number;
|
|
698
|
+
}
|
|
699
|
+
/** Cost of one pipeline stage (generate | rewrite | decompose | multi_query | inspect | citation |
|
|
700
|
+
* groundedness | title | embedding | visual_concept | visual_vet | visual_proposer | visual_claims |
|
|
701
|
+
* visual_vision_judge), split by model. */
|
|
702
|
+
export interface CostByStage {
|
|
703
|
+
calls: number;
|
|
704
|
+
representative_usd: number;
|
|
705
|
+
actual_usd: number;
|
|
706
|
+
avg_actual_usd_per_query: number;
|
|
707
|
+
by_model: Record<string, CostByModel>;
|
|
708
|
+
}
|
|
709
|
+
/** Per-profile cost analytics (GET /v1/query-profiles/{id}/cost). By default reflects the profile's
|
|
710
|
+
* CURRENT config only (`config_fingerprint`); `current_config_pending` is true right after a
|
|
711
|
+
* cost-impacting change, before any query has run under the new config (so totals are 0 until then).
|
|
712
|
+
* `by_stage` covers the whole text + visual pipeline. `breakdown_capped` => the stage/model split was
|
|
713
|
+
* computed from the most recent `breakdown_from_n` queries (top-line totals are exact regardless). */
|
|
714
|
+
export interface CostSummary {
|
|
715
|
+
query_profile_id: string | null;
|
|
716
|
+
config_fingerprint: string | null;
|
|
717
|
+
all_configs: boolean;
|
|
718
|
+
current_config_pending: boolean;
|
|
719
|
+
since_days: number;
|
|
720
|
+
price_sheet_version: string;
|
|
721
|
+
n_queries: number;
|
|
722
|
+
total_actual_usd: number;
|
|
723
|
+
total_representative_usd: number;
|
|
724
|
+
avg_actual_usd_per_query: number;
|
|
725
|
+
avg_representative_usd_per_query: number;
|
|
726
|
+
breakdown_from_n: number;
|
|
727
|
+
breakdown_capped: boolean;
|
|
728
|
+
by_stage: Record<string, CostByStage>;
|
|
729
|
+
}
|
|
689
730
|
/** Citation-benchmark leaderboard (GET /v1/benchmark/citations) — per configuration: citation
|
|
690
731
|
* precision + yield + cost + latency. Native citations (~1.0 by construction) vs post-hoc (lower
|
|
691
732
|
* ceiling); each arm's `mechanism` says which. `arms` empty if no citation benchmark has run. */
|
|
@@ -1136,6 +1177,16 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
1136
1177
|
}) => Promise<QueryProfile>;
|
|
1137
1178
|
update: (id: UUID, b: QueryProfileWrite) => Promise<QueryProfile>;
|
|
1138
1179
|
delete: (id: UUID) => Promise<void>;
|
|
1180
|
+
/** Per-profile COST analytics (GET /v1/query-profiles/{id}/cost): per-query averages + totals,
|
|
1181
|
+
* broken down by stage and model, over the last `sinceDays` (default 30). By default only the
|
|
1182
|
+
* profile's CURRENT config is counted (so the numbers reflect the live config; a cost-impacting
|
|
1183
|
+
* change auto-resets — `current_config_pending` is true until the first query under the new config).
|
|
1184
|
+
* `allConfigs: true` aggregates every config the profile has run under. `actual_usd` matches the
|
|
1185
|
+
* provider bill (cache-discounted); `representative_usd` is the as-if-uncached headline. */
|
|
1186
|
+
cost: (id: UUID, opts?: {
|
|
1187
|
+
sinceDays?: number;
|
|
1188
|
+
allConfigs?: boolean;
|
|
1189
|
+
}) => Promise<CostSummary>;
|
|
1139
1190
|
/** The model catalog for an query-profile-config UI: supported models + default per field, per-model
|
|
1140
1191
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
1141
1192
|
modelOptions: () => Promise<ModelOptions>;
|
package/dist/index.js
CHANGED
|
@@ -465,6 +465,13 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
465
465
|
create: (b) => this.request("POST", "/v1/query-profiles", { json: b }),
|
|
466
466
|
update: (id, b) => this.request("PATCH", `/v1/query-profiles/${id}`, { json: b }),
|
|
467
467
|
delete: (id) => this.request("DELETE", `/v1/query-profiles/${id}`),
|
|
468
|
+
/** Per-profile COST analytics (GET /v1/query-profiles/{id}/cost): per-query averages + totals,
|
|
469
|
+
* broken down by stage and model, over the last `sinceDays` (default 30). By default only the
|
|
470
|
+
* profile's CURRENT config is counted (so the numbers reflect the live config; a cost-impacting
|
|
471
|
+
* change auto-resets — `current_config_pending` is true until the first query under the new config).
|
|
472
|
+
* `allConfigs: true` aggregates every config the profile has run under. `actual_usd` matches the
|
|
473
|
+
* provider bill (cache-discounted); `representative_usd` is the as-if-uncached headline. */
|
|
474
|
+
cost: (id, opts) => this.request("GET", `/v1/query-profiles/${id}/cost`, { query: { since_days: opts?.sinceDays, all_configs: opts?.allConfigs } }),
|
|
468
475
|
/** The model catalog for an query-profile-config UI: supported models + default per field, per-model
|
|
469
476
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
470
477
|
modelOptions: () => this.request("GET", "/v1/query-profiles/model-options"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.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
|
@@ -101,6 +101,7 @@ export interface VisualOverrides {
|
|
|
101
101
|
claims_check_model?: string;
|
|
102
102
|
vision_judge_model?: string;
|
|
103
103
|
image_gen_model?: string; // scenic image generator (profile field: visual_image_gen_model)
|
|
104
|
+
html_advisory_judge?: boolean; // measure-only vision judge on shipped HTML figures (profile: visual_html_advisory_judge)
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
/** Per-request visual control. Absent => mode resolves from the profile default. All visual
|
|
@@ -511,6 +512,11 @@ export interface QueryProfile {
|
|
|
511
512
|
visual_image_gen_model: string | null; // Vertex Gemini image-gen model (scenic register)
|
|
512
513
|
visual_max_revisions: number | null;
|
|
513
514
|
visual_combine_generation_and_concept: boolean | null;
|
|
515
|
+
// Measure-only vision judge on shipped conceptual (HTML) figures (null => on). When on, every
|
|
516
|
+
// shipped HTML figure is scored by the vision judge OFF the critical path — it's logged/counted
|
|
517
|
+
// server-side to reveal how often a figure would be flagged, but NEVER revises or drops it (zero
|
|
518
|
+
// added latency). A pure quality-telemetry knob; it does not change what the client receives.
|
|
519
|
+
visual_html_advisory_judge: boolean | null;
|
|
514
520
|
concept_model_mode: string | null; // "reasoning" | "standard"; overrules gen mode when combining
|
|
515
521
|
// --- score-my-profile status/progress (READ-only; not settable) ---------------------------------
|
|
516
522
|
// Durable on the profile so a client can kick scoring, leave, and see the status/result on any later
|
|
@@ -651,6 +657,45 @@ export interface CitationArm {
|
|
|
651
657
|
n_questions: number | null;
|
|
652
658
|
note: string | null;
|
|
653
659
|
}
|
|
660
|
+
/** Per-model cost split within a stage. `actual_usd` is cache-discounted (matches the bill);
|
|
661
|
+
* `representative_usd` is the as-if-uncached headline. */
|
|
662
|
+
export interface CostByModel {
|
|
663
|
+
calls: number;
|
|
664
|
+
representative_usd: number;
|
|
665
|
+
actual_usd: number;
|
|
666
|
+
avg_actual_usd_per_query: number;
|
|
667
|
+
}
|
|
668
|
+
/** Cost of one pipeline stage (generate | rewrite | decompose | multi_query | inspect | citation |
|
|
669
|
+
* groundedness | title | embedding | visual_concept | visual_vet | visual_proposer | visual_claims |
|
|
670
|
+
* visual_vision_judge), split by model. */
|
|
671
|
+
export interface CostByStage {
|
|
672
|
+
calls: number;
|
|
673
|
+
representative_usd: number;
|
|
674
|
+
actual_usd: number;
|
|
675
|
+
avg_actual_usd_per_query: number;
|
|
676
|
+
by_model: Record<string, CostByModel>;
|
|
677
|
+
}
|
|
678
|
+
/** Per-profile cost analytics (GET /v1/query-profiles/{id}/cost). By default reflects the profile's
|
|
679
|
+
* CURRENT config only (`config_fingerprint`); `current_config_pending` is true right after a
|
|
680
|
+
* cost-impacting change, before any query has run under the new config (so totals are 0 until then).
|
|
681
|
+
* `by_stage` covers the whole text + visual pipeline. `breakdown_capped` => the stage/model split was
|
|
682
|
+
* computed from the most recent `breakdown_from_n` queries (top-line totals are exact regardless). */
|
|
683
|
+
export interface CostSummary {
|
|
684
|
+
query_profile_id: string | null;
|
|
685
|
+
config_fingerprint: string | null; // null => aggregated across all configs (all_configs=true) or none yet
|
|
686
|
+
all_configs: boolean;
|
|
687
|
+
current_config_pending: boolean;
|
|
688
|
+
since_days: number;
|
|
689
|
+
price_sheet_version: string;
|
|
690
|
+
n_queries: number;
|
|
691
|
+
total_actual_usd: number;
|
|
692
|
+
total_representative_usd: number;
|
|
693
|
+
avg_actual_usd_per_query: number;
|
|
694
|
+
avg_representative_usd_per_query: number;
|
|
695
|
+
breakdown_from_n: number;
|
|
696
|
+
breakdown_capped: boolean;
|
|
697
|
+
by_stage: Record<string, CostByStage>;
|
|
698
|
+
}
|
|
654
699
|
/** Citation-benchmark leaderboard (GET /v1/benchmark/citations) — per configuration: citation
|
|
655
700
|
* precision + yield + cost + latency. Native citations (~1.0 by construction) vs post-hoc (lower
|
|
656
701
|
* ceiling); each arm's `mechanism` says which. `arms` empty if no citation benchmark has run. */
|
|
@@ -1279,6 +1324,15 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1279
1324
|
create: (b: QueryProfileWrite & { name: string }) => this.request<QueryProfile>("POST", "/v1/query-profiles", { json: b }),
|
|
1280
1325
|
update: (id: UUID, b: QueryProfileWrite) => this.request<QueryProfile>("PATCH", `/v1/query-profiles/${id}`, { json: b }),
|
|
1281
1326
|
delete: (id: UUID) => this.request<void>("DELETE", `/v1/query-profiles/${id}`),
|
|
1327
|
+
/** Per-profile COST analytics (GET /v1/query-profiles/{id}/cost): per-query averages + totals,
|
|
1328
|
+
* broken down by stage and model, over the last `sinceDays` (default 30). By default only the
|
|
1329
|
+
* profile's CURRENT config is counted (so the numbers reflect the live config; a cost-impacting
|
|
1330
|
+
* change auto-resets — `current_config_pending` is true until the first query under the new config).
|
|
1331
|
+
* `allConfigs: true` aggregates every config the profile has run under. `actual_usd` matches the
|
|
1332
|
+
* provider bill (cache-discounted); `representative_usd` is the as-if-uncached headline. */
|
|
1333
|
+
cost: (id: UUID, opts?: { sinceDays?: number; allConfigs?: boolean }) =>
|
|
1334
|
+
this.request<CostSummary>("GET", `/v1/query-profiles/${id}/cost`,
|
|
1335
|
+
{ query: { since_days: opts?.sinceDays, all_configs: opts?.allConfigs } }),
|
|
1282
1336
|
/** The model catalog for an query-profile-config UI: supported models + default per field, per-model
|
|
1283
1337
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
1284
1338
|
modelOptions: () => this.request<ModelOptions>("GET", "/v1/query-profiles/model-options"),
|