@babav/knowledge-core-client 0.39.0 → 0.40.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 +57 -1
- package/dist/index.js +16 -1
- package/package.json +1 -1
- package/src/index.ts +59 -3
package/dist/index.d.ts
CHANGED
|
@@ -211,6 +211,40 @@ 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
|
+
}
|
|
216
|
+
/** Build-time knob bundle that DEFINES an index. Defaults are today's blessed config, so a
|
|
217
|
+
* profile created with no params is the blessed profile. Change any knob => different vectors
|
|
218
|
+
* => a different physical collection. Embedding/indexing/chunking is SYSTEM-level, never a
|
|
219
|
+
* query knob — this is the build-side counterpart to an Agent, not an agent. */
|
|
220
|
+
export interface IngestionProfileParams {
|
|
221
|
+
chunker: string;
|
|
222
|
+
chunk_child_max_tokens: number;
|
|
223
|
+
chunk_parent_max_tokens: number;
|
|
224
|
+
contextualize: boolean;
|
|
225
|
+
embedding_provider: string;
|
|
226
|
+
embedding_model: string;
|
|
227
|
+
embedding_dimensions: number;
|
|
228
|
+
distance: string;
|
|
229
|
+
sparse: boolean;
|
|
230
|
+
quantization: string;
|
|
231
|
+
hnsw_m: number | null;
|
|
232
|
+
hnsw_ef_construct: number | null;
|
|
233
|
+
}
|
|
234
|
+
export interface IngestionProfile {
|
|
235
|
+
id: UUID;
|
|
236
|
+
tenant_id: UUID;
|
|
237
|
+
name: string;
|
|
238
|
+
params: IngestionProfileParams;
|
|
239
|
+
fingerprint: string;
|
|
240
|
+
is_default: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** Fields settable when creating/updating a profile. `params` may be partial on create
|
|
243
|
+
* (omitted knobs take the blessed default). The owning tenant is the key's — never in the body. */
|
|
244
|
+
export interface IngestionProfileWrite {
|
|
245
|
+
name?: string;
|
|
246
|
+
params?: Partial<IngestionProfileParams>;
|
|
247
|
+
is_default?: boolean;
|
|
214
248
|
}
|
|
215
249
|
export interface Folder {
|
|
216
250
|
id: UUID;
|
|
@@ -681,6 +715,7 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
681
715
|
name: string;
|
|
682
716
|
description?: string;
|
|
683
717
|
custom_metadata?: Record<string, unknown>;
|
|
718
|
+
profile_id?: UUID;
|
|
684
719
|
}) => Promise<Corpus>;
|
|
685
720
|
list: (q?: {
|
|
686
721
|
limit?: number;
|
|
@@ -694,11 +729,13 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
694
729
|
cursor?: string;
|
|
695
730
|
}) => Promise<Page<Corpus>>;
|
|
696
731
|
get: (id: UUID) => Promise<Corpus>;
|
|
697
|
-
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key).
|
|
732
|
+
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key). `profile_id`
|
|
733
|
+
* reassigns the ingestion profile (does NOT re-index; applies on next (re)ingest). */
|
|
698
734
|
update: (id: UUID, b: {
|
|
699
735
|
name?: string;
|
|
700
736
|
description?: string;
|
|
701
737
|
custom_metadata?: Record<string, unknown>;
|
|
738
|
+
profile_id?: UUID | null;
|
|
702
739
|
}) => Promise<Corpus>;
|
|
703
740
|
delete: (id: UUID, confirmName: string) => Promise<void>;
|
|
704
741
|
listFolders: (id: UUID) => Promise<Folder[]>;
|
|
@@ -948,6 +985,25 @@ export declare class KnowledgeCoreClient extends HttpBase {
|
|
|
948
985
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
949
986
|
modelOptions: () => Promise<ModelOptions>;
|
|
950
987
|
};
|
|
988
|
+
/** Ingestion profiles — the build-side config object (counterpart to `agents`). A profile
|
|
989
|
+
* DEFINES an index (chunking + embedding + sparse + quant); its `fingerprint` is the physical
|
|
990
|
+
* collection identity. Attach one to a corpus via `corpora.create/update({ profile_id })`. */
|
|
991
|
+
profiles: {
|
|
992
|
+
/** List this tenant's ingestion profiles. */
|
|
993
|
+
list: (q?: {
|
|
994
|
+
limit?: number;
|
|
995
|
+
cursor?: string;
|
|
996
|
+
}) => Promise<Page<IngestionProfile>>;
|
|
997
|
+
listAll: () => Promise<IngestionProfile[]>;
|
|
998
|
+
get: (id: UUID) => Promise<IngestionProfile>;
|
|
999
|
+
/** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
|
|
1000
|
+
create: (b: IngestionProfileWrite & {
|
|
1001
|
+
name: string;
|
|
1002
|
+
}) => Promise<IngestionProfile>;
|
|
1003
|
+
update: (id: UUID, b: IngestionProfileWrite) => Promise<IngestionProfile>;
|
|
1004
|
+
/** Delete a profile. 409 if any corpus still references it. */
|
|
1005
|
+
delete: (id: UUID) => Promise<void>;
|
|
1006
|
+
};
|
|
951
1007
|
analytics: {
|
|
952
1008
|
/** Query-volume time series for a corpus (the denominator for everything). */
|
|
953
1009
|
corpusUsage: (corpusId: UUID, q?: {
|
package/dist/index.js
CHANGED
|
@@ -268,7 +268,8 @@ 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).
|
|
271
|
+
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key). `profile_id`
|
|
272
|
+
* reassigns the ingestion profile (does NOT re-index; applies on next (re)ingest). */
|
|
272
273
|
update: (id, b) => this.request("PATCH", `/v1/corpora/${id}`, { json: b }),
|
|
273
274
|
delete: (id, confirmName) => this.request("DELETE", `/v1/corpora/${id}`, { query: { confirm: confirmName } }),
|
|
274
275
|
listFolders: (id) => this.pageAll(`/v1/corpora/${id}/folders`),
|
|
@@ -467,6 +468,20 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
467
468
|
* capabilities (`supports_reasoning`), and mode↔model dependencies. */
|
|
468
469
|
modelOptions: () => this.request("GET", "/v1/agents/model-options"),
|
|
469
470
|
};
|
|
471
|
+
/** Ingestion profiles — the build-side config object (counterpart to `agents`). A profile
|
|
472
|
+
* DEFINES an index (chunking + embedding + sparse + quant); its `fingerprint` is the physical
|
|
473
|
+
* collection identity. Attach one to a corpus via `corpora.create/update({ profile_id })`. */
|
|
474
|
+
profiles = {
|
|
475
|
+
/** List this tenant's ingestion profiles. */
|
|
476
|
+
list: (q) => this.request("GET", "/v1/profiles", { query: q }),
|
|
477
|
+
listAll: () => this.pageAll("/v1/profiles"),
|
|
478
|
+
get: (id) => this.request("GET", `/v1/profiles/${id}`),
|
|
479
|
+
/** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
|
|
480
|
+
create: (b) => this.request("POST", "/v1/profiles", { json: b }),
|
|
481
|
+
update: (id, b) => this.request("PATCH", `/v1/profiles/${id}`, { json: b }),
|
|
482
|
+
/** Delete a profile. 409 if any corpus still references it. */
|
|
483
|
+
delete: (id) => this.request("DELETE", `/v1/profiles/${id}`),
|
|
484
|
+
};
|
|
470
485
|
// --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
|
|
471
486
|
analytics = {
|
|
472
487
|
/** Query-volume time series for a corpus (the denominator for everything). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babav/knowledge-core-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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,6 +244,43 @@ export interface Corpus {
|
|
|
244
244
|
name: string;
|
|
245
245
|
description: string | null;
|
|
246
246
|
custom_metadata: Record<string, unknown>;
|
|
247
|
+
profile_id: UUID | null; // ingestion profile the corpus is indexed under (null => tenant's blessed default)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Build-time knob bundle that DEFINES an index. Defaults are today's blessed config, so a
|
|
251
|
+
* profile created with no params is the blessed profile. Change any knob => different vectors
|
|
252
|
+
* => a different physical collection. Embedding/indexing/chunking is SYSTEM-level, never a
|
|
253
|
+
* query knob — this is the build-side counterpart to an Agent, not an agent. */
|
|
254
|
+
export interface IngestionProfileParams {
|
|
255
|
+
chunker: string; // "hybrid"
|
|
256
|
+
chunk_child_max_tokens: number;
|
|
257
|
+
chunk_parent_max_tokens: number;
|
|
258
|
+
contextualize: boolean;
|
|
259
|
+
embedding_provider: string; // "voyage_context" | "voyage" | "gemini"
|
|
260
|
+
embedding_model: string;
|
|
261
|
+
embedding_dimensions: number;
|
|
262
|
+
distance: string; // "cosine" | "dot" | "euclid"
|
|
263
|
+
sparse: boolean;
|
|
264
|
+
quantization: string; // "int8" | "none"
|
|
265
|
+
hnsw_m: number | null; // null => Qdrant default
|
|
266
|
+
hnsw_ef_construct: number | null; // null => Qdrant default
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface IngestionProfile {
|
|
270
|
+
id: UUID;
|
|
271
|
+
tenant_id: UUID; // owning tenant (every profile belongs to one; no globals)
|
|
272
|
+
name: string;
|
|
273
|
+
params: IngestionProfileParams;
|
|
274
|
+
fingerprint: string; // stable hash of params — the physical collection identity
|
|
275
|
+
is_default: boolean; // at most one blessed profile per tenant
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** Fields settable when creating/updating a profile. `params` may be partial on create
|
|
279
|
+
* (omitted knobs take the blessed default). The owning tenant is the key's — never in the body. */
|
|
280
|
+
export interface IngestionProfileWrite {
|
|
281
|
+
name?: string;
|
|
282
|
+
params?: Partial<IngestionProfileParams>;
|
|
283
|
+
is_default?: boolean;
|
|
247
284
|
}
|
|
248
285
|
export interface Folder {
|
|
249
286
|
id: UUID;
|
|
@@ -819,7 +856,7 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
819
856
|
|
|
820
857
|
// --- corpora ---
|
|
821
858
|
corpora = {
|
|
822
|
-
create: (b: { name: string; description?: string; custom_metadata?: Record<string, unknown
|
|
859
|
+
create: (b: { name: string; description?: string; custom_metadata?: Record<string, unknown>; profile_id?: UUID }) =>
|
|
823
860
|
this.request<Corpus>("POST", "/v1/corpora", { json: b }),
|
|
824
861
|
list: (q?: { limit?: number; cursor?: string }) => this.request<Page<Corpus>>("GET", "/v1/corpora", { query: q }),
|
|
825
862
|
listAll: () => this.pageAll<Corpus>("/v1/corpora"),
|
|
@@ -827,8 +864,9 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
827
864
|
search: (b: { filter?: MetadataFilter; limit?: number; cursor?: string }) =>
|
|
828
865
|
this.request<Page<Corpus>>("POST", "/v1/corpora/search", { json: b }),
|
|
829
866
|
get: (id: UUID) => this.request<Corpus>("GET", `/v1/corpora/${id}`),
|
|
830
|
-
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key).
|
|
831
|
-
|
|
867
|
+
/** `custom_metadata` merges (provided keys upsert, a null value deletes a key). `profile_id`
|
|
868
|
+
* reassigns the ingestion profile (does NOT re-index; applies on next (re)ingest). */
|
|
869
|
+
update: (id: UUID, b: { name?: string; description?: string; custom_metadata?: Record<string, unknown>; profile_id?: UUID | null }) =>
|
|
832
870
|
this.request<Corpus>("PATCH", `/v1/corpora/${id}`, { json: b }),
|
|
833
871
|
delete: (id: UUID, confirmName: string) => this.request<void>("DELETE", `/v1/corpora/${id}`, { query: { confirm: confirmName } }),
|
|
834
872
|
listFolders: (id: UUID) => this.pageAll<Folder>(`/v1/corpora/${id}/folders`),
|
|
@@ -1092,6 +1130,24 @@ export class KnowledgeCoreClient extends HttpBase {
|
|
|
1092
1130
|
modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
|
|
1093
1131
|
};
|
|
1094
1132
|
|
|
1133
|
+
/** Ingestion profiles — the build-side config object (counterpart to `agents`). A profile
|
|
1134
|
+
* DEFINES an index (chunking + embedding + sparse + quant); its `fingerprint` is the physical
|
|
1135
|
+
* collection identity. Attach one to a corpus via `corpora.create/update({ profile_id })`. */
|
|
1136
|
+
profiles = {
|
|
1137
|
+
/** List this tenant's ingestion profiles. */
|
|
1138
|
+
list: (q?: { limit?: number; cursor?: string }) =>
|
|
1139
|
+
this.request<Page<IngestionProfile>>("GET", "/v1/profiles", { query: q }),
|
|
1140
|
+
listAll: () => this.pageAll<IngestionProfile>("/v1/profiles"),
|
|
1141
|
+
get: (id: UUID) => this.request<IngestionProfile>("GET", `/v1/profiles/${id}`),
|
|
1142
|
+
/** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
|
|
1143
|
+
create: (b: IngestionProfileWrite & { name: string }) =>
|
|
1144
|
+
this.request<IngestionProfile>("POST", "/v1/profiles", { json: b }),
|
|
1145
|
+
update: (id: UUID, b: IngestionProfileWrite) =>
|
|
1146
|
+
this.request<IngestionProfile>("PATCH", `/v1/profiles/${id}`, { json: b }),
|
|
1147
|
+
/** Delete a profile. 409 if any corpus still references it. */
|
|
1148
|
+
delete: (id: UUID) => this.request<void>("DELETE", `/v1/profiles/${id}`),
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1095
1151
|
// --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
|
|
1096
1152
|
analytics = {
|
|
1097
1153
|
/** Query-volume time series for a corpus (the denominator for everything). */
|