@babav/knowledge-core-client 0.40.0 → 0.42.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 +32 -9
- package/dist/index.js +11 -6
- package/package.json +1 -1
- package/src/index.ts +26 -9
package/dist/index.d.ts
CHANGED
|
@@ -211,7 +211,6 @@ export interface Corpus {
|
|
|
211
211
|
name: string;
|
|
212
212
|
description: string | null;
|
|
213
213
|
custom_metadata: Record<string, unknown>;
|
|
214
|
-
profile_id: UUID | null;
|
|
215
214
|
}
|
|
216
215
|
/** Build-time knob bundle that DEFINES an index. Defaults are today's blessed config, so a
|
|
217
216
|
* profile created with no params is the blessed profile. Change any knob => different vectors
|
|
@@ -246,6 +245,27 @@ export interface IngestionProfileWrite {
|
|
|
246
245
|
params?: Partial<IngestionProfileParams>;
|
|
247
246
|
is_default?: boolean;
|
|
248
247
|
}
|
|
248
|
+
/** Config catalog for a profile UI (GET /v1/profiles/model-options) — build-side mirror of the
|
|
249
|
+
* query model-options. `embedding_models` maps id → { provider, dimensions, label }; `fields`
|
|
250
|
+
* gives each param its supported list / default / bounds; `standard_params` is the blessed default. */
|
|
251
|
+
export interface IngestionProfileOptions {
|
|
252
|
+
embedding_models: Record<string, {
|
|
253
|
+
provider: string;
|
|
254
|
+
dimensions: number;
|
|
255
|
+
label: string;
|
|
256
|
+
}>;
|
|
257
|
+
chunkers: Record<string, {
|
|
258
|
+
label: string;
|
|
259
|
+
}>;
|
|
260
|
+
distances: string[];
|
|
261
|
+
quantizations: string[];
|
|
262
|
+
fields: Record<string, {
|
|
263
|
+
supported?: string[];
|
|
264
|
+
default?: unknown;
|
|
265
|
+
min?: number;
|
|
266
|
+
}>;
|
|
267
|
+
standard_params: IngestionProfileParams;
|
|
268
|
+
}
|
|
249
269
|
export interface Folder {
|
|
250
270
|
id: UUID;
|
|
251
271
|
corpus_id: UUID;
|
|
@@ -715,7 +735,6 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
715
735
|
name: string;
|
|
716
736
|
description?: string;
|
|
717
737
|
custom_metadata?: Record<string, unknown>;
|
|
718
|
-
profile_id?: UUID;
|
|
719
738
|
}) => Promise<Corpus>;
|
|
720
739
|
list: (q?: {
|
|
721
740
|
limit?: number;
|
|
@@ -729,13 +748,11 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
729
748
|
cursor?: string;
|
|
730
749
|
}) => Promise<Page<Corpus>>;
|
|
731
750
|
get: (id: UUID) => Promise<Corpus>;
|
|
732
|
-
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key).
|
|
733
|
-
* reassigns the ingestion profile (does NOT re-index; applies on next (re)ingest). */
|
|
751
|
+
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key). */
|
|
734
752
|
update: (id: UUID, b: {
|
|
735
753
|
name?: string;
|
|
736
754
|
description?: string;
|
|
737
755
|
custom_metadata?: Record<string, unknown>;
|
|
738
|
-
profile_id?: UUID | null;
|
|
739
756
|
}) => Promise<Corpus>;
|
|
740
757
|
delete: (id: UUID, confirmName: string) => Promise<void>;
|
|
741
758
|
listFolders: (id: UUID) => Promise<Folder[]>;
|
|
@@ -985,9 +1002,11 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
985
1002
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
986
1003
|
modelOptions: () => Promise<ModelOptions>;
|
|
987
1004
|
};
|
|
988
|
-
/** Ingestion profiles — the build-side config object (counterpart to `agents`)
|
|
989
|
-
*
|
|
990
|
-
*
|
|
1005
|
+
/** Ingestion profiles — the build-side config object (counterpart to `agents`): a tenant-owned,
|
|
1006
|
+
* named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike an agent
|
|
1007
|
+
* (chosen per query), a profile binds at the TENANT/COLLECTION level — the tenant's one
|
|
1008
|
+
* `is_default` profile governs how ALL its documents are ingested; swapping it re-indexes.
|
|
1009
|
+
* A corpus's content is a RESULT of ingestion, so a corpus never selects a profile. */
|
|
991
1010
|
profiles: {
|
|
992
1011
|
/** List this tenant's ingestion profiles. */
|
|
993
1012
|
list: (q?: {
|
|
@@ -1001,8 +1020,12 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
1001
1020
|
name: string;
|
|
1002
1021
|
}) => Promise<IngestionProfile>;
|
|
1003
1022
|
update: (id: UUID, b: IngestionProfileWrite) => Promise<IngestionProfile>;
|
|
1004
|
-
/** Delete a profile. 409
|
|
1023
|
+
/** Delete a profile. 409 when it's the tenant's active (default) profile. */
|
|
1005
1024
|
delete: (id: UUID) => Promise<void>;
|
|
1025
|
+
/** The config catalog for a profile UI: supported embedding models (+ provider/dims),
|
|
1026
|
+
* chunkers, distances, quantizations, per-field defaults/bounds, and the standard params.
|
|
1027
|
+
* Build-side mirror of `agents.modelOptions()`. */
|
|
1028
|
+
modelOptions: () => Promise<IngestionProfileOptions>;
|
|
1006
1029
|
};
|
|
1007
1030
|
analytics: {
|
|
1008
1031
|
/** Query-volume time series for a corpus (the denominator for everything). */
|
package/dist/index.js
CHANGED
|
@@ -268,8 +268,7 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
268
268
|
/** Filter corpora by custom_metadata using the same metadata filter as documents. */
|
|
269
269
|
search: (b) => this.request("POST", "/v1/corpora/search", { json: b }),
|
|
270
270
|
get: (id) => this.request("GET", `/v1/corpora/${id}`),
|
|
271
|
-
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key).
|
|
272
|
-
* reassigns the ingestion profile (does NOT re-index; applies on next (re)ingest). */
|
|
271
|
+
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key). */
|
|
273
272
|
update: (id, b) => this.request("PATCH", `/v1/corpora/${id}`, { json: b }),
|
|
274
273
|
delete: (id, confirmName) => this.request("DELETE", `/v1/corpora/${id}`, { query: { confirm: confirmName } }),
|
|
275
274
|
listFolders: (id) => this.pageAll(`/v1/corpora/${id}/folders`),
|
|
@@ -468,9 +467,11 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
468
467
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
469
468
|
modelOptions: () => this.request("GET", "/v1/agents/model-options"),
|
|
470
469
|
};
|
|
471
|
-
/** Ingestion profiles — the build-side config object (counterpart to `agents`)
|
|
472
|
-
*
|
|
473
|
-
*
|
|
470
|
+
/** Ingestion profiles — the build-side config object (counterpart to `agents`): a tenant-owned,
|
|
471
|
+
* named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike an agent
|
|
472
|
+
* (chosen per query), a profile binds at the TENANT/COLLECTION level — the tenant's one
|
|
473
|
+
* `is_default` profile governs how ALL its documents are ingested; swapping it re-indexes.
|
|
474
|
+
* A corpus's content is a RESULT of ingestion, so a corpus never selects a profile. */
|
|
474
475
|
profiles = {
|
|
475
476
|
/** List this tenant's ingestion profiles. */
|
|
476
477
|
list: (q) => this.request("GET", "/v1/profiles", { query: q }),
|
|
@@ -479,8 +480,12 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
479
480
|
/** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
|
|
480
481
|
create: (b) => this.request("POST", "/v1/profiles", { json: b }),
|
|
481
482
|
update: (id, b) => this.request("PATCH", `/v1/profiles/${id}`, { json: b }),
|
|
482
|
-
/** Delete a profile. 409
|
|
483
|
+
/** Delete a profile. 409 when it's the tenant's active (default) profile. */
|
|
483
484
|
delete: (id) => this.request("DELETE", `/v1/profiles/${id}`),
|
|
485
|
+
/** The config catalog for a profile UI: supported embedding models (+ provider/dims),
|
|
486
|
+
* chunkers, distances, quantizations, per-field defaults/bounds, and the standard params.
|
|
487
|
+
* Build-side mirror of `agents.modelOptions()`. */
|
|
488
|
+
modelOptions: () => this.request("GET", "/v1/profiles/model-options"),
|
|
484
489
|
};
|
|
485
490
|
// --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
|
|
486
491
|
analytics = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.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
|
@@ -244,7 +244,7 @@ export interface Corpus {
|
|
|
244
244
|
name: string;
|
|
245
245
|
description: string | null;
|
|
246
246
|
custom_metadata: Record<string, unknown>;
|
|
247
|
-
|
|
247
|
+
// NB: the ingestion profile is TENANT-level (governs the whole collection), never per-corpus.
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/** Build-time knob bundle that DEFINES an index. Defaults are today's blessed config, so a
|
|
@@ -282,6 +282,18 @@ export interface IngestionProfileWrite {
|
|
|
282
282
|
params?: Partial<IngestionProfileParams>;
|
|
283
283
|
is_default?: boolean;
|
|
284
284
|
}
|
|
285
|
+
|
|
286
|
+
/** Config catalog for a profile UI (GET /v1/profiles/model-options) — build-side mirror of the
|
|
287
|
+
* query model-options. `embedding_models` maps id → { provider, dimensions, label }; `fields`
|
|
288
|
+
* gives each param its supported list / default / bounds; `standard_params` is the blessed default. */
|
|
289
|
+
export interface IngestionProfileOptions {
|
|
290
|
+
embedding_models: Record<string, { provider: string; dimensions: number; label: string }>;
|
|
291
|
+
chunkers: Record<string, { label: string }>;
|
|
292
|
+
distances: string[];
|
|
293
|
+
quantizations: string[];
|
|
294
|
+
fields: Record<string, { supported?: string[]; default?: unknown; min?: number }>;
|
|
295
|
+
standard_params: IngestionProfileParams;
|
|
296
|
+
}
|
|
285
297
|
export interface Folder {
|
|
286
298
|
id: UUID;
|
|
287
299
|
corpus_id: UUID;
|
|
@@ -856,7 +868,7 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
856
868
|
|
|
857
869
|
// --- corpora ---
|
|
858
870
|
corpora = {
|
|
859
|
-
create: (b: { name: string; description?: string; custom_metadata?: Record<string, unknown
|
|
871
|
+
create: (b: { name: string; description?: string; custom_metadata?: Record<string, unknown> }) =>
|
|
860
872
|
this.request<Corpus>("POST", "/v1/corpora", { json: b }),
|
|
861
873
|
list: (q?: { limit?: number; cursor?: string }) => this.request<Page<Corpus>>("GET", "/v1/corpora", { query: q }),
|
|
862
874
|
listAll: () => this.pageAll<Corpus>("/v1/corpora"),
|
|
@@ -864,9 +876,8 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
864
876
|
search: (b: { filter?: MetadataFilter; limit?: number; cursor?: string }) =>
|
|
865
877
|
this.request<Page<Corpus>>("POST", "/v1/corpora/search", { json: b }),
|
|
866
878
|
get: (id: UUID) => this.request<Corpus>("GET", `/v1/corpora/${id}`),
|
|
867
|
-
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key).
|
|
868
|
-
|
|
869
|
-
update: (id: UUID, b: { name?: string; description?: string; custom_metadata?: Record<string, unknown>; profile_id?: UUID | null }) =>
|
|
879
|
+
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key). */
|
|
880
|
+
update: (id: UUID, b: { name?: string; description?: string; custom_metadata?: Record<string, unknown> }) =>
|
|
870
881
|
this.request<Corpus>("PATCH", `/v1/corpora/${id}`, { json: b }),
|
|
871
882
|
delete: (id: UUID, confirmName: string) => this.request<void>("DELETE", `/v1/corpora/${id}`, { query: { confirm: confirmName } }),
|
|
872
883
|
listFolders: (id: UUID) => this.pageAll<Folder>(`/v1/corpora/${id}/folders`),
|
|
@@ -1130,9 +1141,11 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1130
1141
|
modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
|
|
1131
1142
|
};
|
|
1132
1143
|
|
|
1133
|
-
/** Ingestion profiles — the build-side config object (counterpart to `agents`)
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1144
|
+
/** Ingestion profiles — the build-side config object (counterpart to `agents`): a tenant-owned,
|
|
1145
|
+
* named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike an agent
|
|
1146
|
+
* (chosen per query), a profile binds at the TENANT/COLLECTION level — the tenant's one
|
|
1147
|
+
* `is_default` profile governs how ALL its documents are ingested; swapping it re-indexes.
|
|
1148
|
+
* A corpus's content is a RESULT of ingestion, so a corpus never selects a profile. */
|
|
1136
1149
|
profiles = {
|
|
1137
1150
|
/** List this tenant's ingestion profiles. */
|
|
1138
1151
|
list: (q?: { limit?: number; cursor?: string }) =>
|
|
@@ -1144,8 +1157,12 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1144
1157
|
this.request<IngestionProfile>("POST", "/v1/profiles", { json: b }),
|
|
1145
1158
|
update: (id: UUID, b: IngestionProfileWrite) =>
|
|
1146
1159
|
this.request<IngestionProfile>("PATCH", `/v1/profiles/${id}`, { json: b }),
|
|
1147
|
-
/** Delete a profile. 409
|
|
1160
|
+
/** Delete a profile. 409 when it's the tenant's active (default) profile. */
|
|
1148
1161
|
delete: (id: UUID) => this.request<void>("DELETE", `/v1/profiles/${id}`),
|
|
1162
|
+
/** The config catalog for a profile UI: supported embedding models (+ provider/dims),
|
|
1163
|
+
* chunkers, distances, quantizations, per-field defaults/bounds, and the standard params.
|
|
1164
|
+
* Build-side mirror of `agents.modelOptions()`. */
|
|
1165
|
+
modelOptions: () => this.request<IngestionProfileOptions>("GET", "/v1/profiles/model-options"),
|
|
1149
1166
|
};
|
|
1150
1167
|
|
|
1151
1168
|
// --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
|