@babav/knowledge-core-client 0.39.0 → 0.41.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 CHANGED
@@ -212,6 +212,39 @@ export interface Corpus {
212
212
  description: string | null;
213
213
  custom_metadata: Record<string, unknown>;
214
214
  }
215
+ /** Build-time knob bundle that DEFINES an index. Defaults are today's blessed config, so a
216
+ * profile created with no params is the blessed profile. Change any knob => different vectors
217
+ * => a different physical collection. Embedding/indexing/chunking is SYSTEM-level, never a
218
+ * query knob — this is the build-side counterpart to an Agent, not an agent. */
219
+ export interface IngestionProfileParams {
220
+ chunker: string;
221
+ chunk_child_max_tokens: number;
222
+ chunk_parent_max_tokens: number;
223
+ contextualize: boolean;
224
+ embedding_provider: string;
225
+ embedding_model: string;
226
+ embedding_dimensions: number;
227
+ distance: string;
228
+ sparse: boolean;
229
+ quantization: string;
230
+ hnsw_m: number | null;
231
+ hnsw_ef_construct: number | null;
232
+ }
233
+ export interface IngestionProfile {
234
+ id: UUID;
235
+ tenant_id: UUID;
236
+ name: string;
237
+ params: IngestionProfileParams;
238
+ fingerprint: string;
239
+ is_default: boolean;
240
+ }
241
+ /** Fields settable when creating/updating a profile. `params` may be partial on create
242
+ * (omitted knobs take the blessed default). The owning tenant is the key's — never in the body. */
243
+ export interface IngestionProfileWrite {
244
+ name?: string;
245
+ params?: Partial<IngestionProfileParams>;
246
+ is_default?: boolean;
247
+ }
215
248
  export interface Folder {
216
249
  id: UUID;
217
250
  corpus_id: UUID;
@@ -948,6 +981,27 @@ export declare class KnowledgeCoreClient extends HttpBase {
948
981
  * capabilities (`supports_reasoning`), and mode↔model dependencies. */
949
982
  modelOptions: () => Promise<ModelOptions>;
950
983
  };
984
+ /** Ingestion profiles — the build-side config object (counterpart to `agents`): a tenant-owned,
985
+ * named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike an agent
986
+ * (chosen per query), a profile binds at the TENANT/COLLECTION level — the tenant's one
987
+ * `is_default` profile governs how ALL its documents are ingested; swapping it re-indexes.
988
+ * A corpus's content is a RESULT of ingestion, so a corpus never selects a profile. */
989
+ profiles: {
990
+ /** List this tenant's ingestion profiles. */
991
+ list: (q?: {
992
+ limit?: number;
993
+ cursor?: string;
994
+ }) => Promise<Page<IngestionProfile>>;
995
+ listAll: () => Promise<IngestionProfile[]>;
996
+ get: (id: UUID) => Promise<IngestionProfile>;
997
+ /** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
998
+ create: (b: IngestionProfileWrite & {
999
+ name: string;
1000
+ }) => Promise<IngestionProfile>;
1001
+ update: (id: UUID, b: IngestionProfileWrite) => Promise<IngestionProfile>;
1002
+ /** Delete a profile. 409 if any corpus still references it. */
1003
+ delete: (id: UUID) => Promise<void>;
1004
+ };
951
1005
  analytics: {
952
1006
  /** Query-volume time series for a corpus (the denominator for everything). */
953
1007
  corpusUsage: (corpusId: UUID, q?: {
package/dist/index.js CHANGED
@@ -467,6 +467,22 @@ export class KnowledgeCoreClient extends HttpBase {
467
467
  * capabilities (`supports_reasoning`), and mode↔model dependencies. */
468
468
  modelOptions: () => this.request("GET", "/v1/agents/model-options"),
469
469
  };
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. */
475
+ profiles = {
476
+ /** List this tenant's ingestion profiles. */
477
+ list: (q) => this.request("GET", "/v1/profiles", { query: q }),
478
+ listAll: () => this.pageAll("/v1/profiles"),
479
+ get: (id) => this.request("GET", `/v1/profiles/${id}`),
480
+ /** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
481
+ create: (b) => this.request("POST", "/v1/profiles", { json: b }),
482
+ update: (id, b) => this.request("PATCH", `/v1/profiles/${id}`, { json: b }),
483
+ /** Delete a profile. 409 if any corpus still references it. */
484
+ delete: (id) => this.request("DELETE", `/v1/profiles/${id}`),
485
+ };
470
486
  // --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
471
487
  analytics = {
472
488
  /** 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.39.0",
3
+ "version": "0.41.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
+ // NB: the ingestion profile is TENANT-level (governs the whole collection), never per-corpus.
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;
@@ -1092,6 +1129,26 @@ export class KnowledgeCoreClient extends HttpBase {
1092
1129
  modelOptions: () => this.request<ModelOptions>("GET", "/v1/agents/model-options"),
1093
1130
  };
1094
1131
 
1132
+ /** Ingestion profiles — the build-side config object (counterpart to `agents`): a tenant-owned,
1133
+ * named bundle of pipeline config (chunking + embedding + sparse + quant). Unlike an agent
1134
+ * (chosen per query), a profile binds at the TENANT/COLLECTION level — the tenant's one
1135
+ * `is_default` profile governs how ALL its documents are ingested; swapping it re-indexes.
1136
+ * A corpus's content is a RESULT of ingestion, so a corpus never selects a profile. */
1137
+ profiles = {
1138
+ /** List this tenant's ingestion profiles. */
1139
+ list: (q?: { limit?: number; cursor?: string }) =>
1140
+ this.request<Page<IngestionProfile>>("GET", "/v1/profiles", { query: q }),
1141
+ listAll: () => this.pageAll<IngestionProfile>("/v1/profiles"),
1142
+ get: (id: UUID) => this.request<IngestionProfile>("GET", `/v1/profiles/${id}`),
1143
+ /** Create a profile owned by this tenant. Omit `params` for the blessed profile (all defaults). */
1144
+ create: (b: IngestionProfileWrite & { name: string }) =>
1145
+ this.request<IngestionProfile>("POST", "/v1/profiles", { json: b }),
1146
+ update: (id: UUID, b: IngestionProfileWrite) =>
1147
+ this.request<IngestionProfile>("PATCH", `/v1/profiles/${id}`, { json: b }),
1148
+ /** Delete a profile. 409 if any corpus still references it. */
1149
+ delete: (id: UUID) => this.request<void>("DELETE", `/v1/profiles/${id}`),
1150
+ };
1151
+
1095
1152
  // --- retrieval analytics (read-only, tenant-scoped, aggregate-on-read) ---
1096
1153
  analytics = {
1097
1154
  /** Query-volume time series for a corpus (the denominator for everything). */