@vectorize-io/hindsight-client 0.4.13 → 0.4.15
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/generated/sdk.gen.d.ts +11 -1
- package/dist/generated/sdk.gen.d.ts.map +1 -1
- package/dist/generated/sdk.gen.js +15 -1
- package/dist/generated/sdk.gen.js.map +1 -1
- package/dist/generated/types.gen.d.ts +150 -3
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/src/index.d.ts +73 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +77 -8
- package/dist/src/index.js.map +1 -1
- package/generated/sdk.gen.ts +24 -0
- package/generated/types.gen.ts +163 -3
- package/package.json +1 -1
- package/src/index.ts +124 -8
package/src/index.ts
CHANGED
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
FileRetainResponse,
|
|
40
40
|
ListMemoryUnitsResponse,
|
|
41
41
|
BankProfileResponse,
|
|
42
|
+
BankConfigResponse,
|
|
42
43
|
CreateBankRequest,
|
|
43
44
|
Budget,
|
|
44
45
|
} from '../generated/types.gen';
|
|
@@ -80,6 +81,7 @@ export interface MemoryItemInput {
|
|
|
80
81
|
document_id?: string;
|
|
81
82
|
entities?: EntityInput[];
|
|
82
83
|
tags?: string[];
|
|
84
|
+
observation_scopes?: "per_tag" | "combined" | "all_combinations" | string[][];
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
export class HindsightClient {
|
|
@@ -187,6 +189,7 @@ export class HindsightClient {
|
|
|
187
189
|
document_id: item.document_id,
|
|
188
190
|
entities: item.entities,
|
|
189
191
|
tags: item.tags,
|
|
192
|
+
observation_scopes: item.observation_scopes,
|
|
190
193
|
timestamp:
|
|
191
194
|
item.timestamp instanceof Date
|
|
192
195
|
? item.timestamp.toISOString()
|
|
@@ -283,7 +286,7 @@ export class HindsightClient {
|
|
|
283
286
|
trace: options?.trace,
|
|
284
287
|
query_timestamp: options?.queryTimestamp,
|
|
285
288
|
include: {
|
|
286
|
-
entities: options?.includeEntities ? { max_tokens: options?.maxEntityTokens ?? 500 } : undefined,
|
|
289
|
+
entities: options?.includeEntities === false ? null : options?.includeEntities ? { max_tokens: options?.maxEntityTokens ?? 500 } : undefined,
|
|
287
290
|
chunks: options?.includeChunks ? { max_tokens: options?.maxChunkTokens ?? 8192 } : undefined,
|
|
288
291
|
source_facts: options?.includeSourceFacts ? { max_tokens: options?.maxSourceFactsTokens ?? 4096 } : undefined,
|
|
289
292
|
},
|
|
@@ -347,25 +350,73 @@ export class HindsightClient {
|
|
|
347
350
|
}
|
|
348
351
|
|
|
349
352
|
/**
|
|
350
|
-
* Create or update a bank with disposition and
|
|
353
|
+
* Create or update a bank with disposition, missions, and operational configuration.
|
|
351
354
|
*/
|
|
352
355
|
async createBank(
|
|
353
356
|
bankId: string,
|
|
354
|
-
options: {
|
|
357
|
+
options: {
|
|
358
|
+
/** @deprecated Display label only. */
|
|
359
|
+
name?: string;
|
|
360
|
+
/** @deprecated Use reflectMission instead. */
|
|
361
|
+
mission?: string;
|
|
362
|
+
/** Mission/context for Reflect operations. */
|
|
363
|
+
reflectMission?: string;
|
|
364
|
+
/** @deprecated Alias for mission. */
|
|
365
|
+
background?: string;
|
|
366
|
+
/** @deprecated Use dispositionSkepticism, dispositionLiteralism, dispositionEmpathy instead. */
|
|
367
|
+
disposition?: { skepticism: number; literalism: number; empathy: number };
|
|
368
|
+
/** @deprecated Use updateBankConfig({ dispositionSkepticism }) instead. */
|
|
369
|
+
dispositionSkepticism?: number;
|
|
370
|
+
/** @deprecated Use updateBankConfig({ dispositionLiteralism }) instead. */
|
|
371
|
+
dispositionLiteralism?: number;
|
|
372
|
+
/** @deprecated Use updateBankConfig({ dispositionEmpathy }) instead. */
|
|
373
|
+
dispositionEmpathy?: number;
|
|
374
|
+
/** Steers what gets extracted during retain(). Injected alongside built-in rules. */
|
|
375
|
+
retainMission?: string;
|
|
376
|
+
/** Fact extraction mode: 'concise' (default), 'verbose', or 'custom'. */
|
|
377
|
+
retainExtractionMode?: string;
|
|
378
|
+
/** Custom extraction prompt (only active when retainExtractionMode is 'custom'). */
|
|
379
|
+
retainCustomInstructions?: string;
|
|
380
|
+
/** Maximum token size for each content chunk during retain. */
|
|
381
|
+
retainChunkSize?: number;
|
|
382
|
+
/** Toggle automatic observation consolidation after retain(). */
|
|
383
|
+
enableObservations?: boolean;
|
|
384
|
+
/** Controls what gets synthesised into observations. Replaces built-in rules. */
|
|
385
|
+
observationsMission?: string;
|
|
386
|
+
} = {}
|
|
355
387
|
): Promise<BankProfileResponse> {
|
|
356
388
|
const response = await sdk.createOrUpdateBank({
|
|
357
389
|
client: this.client,
|
|
358
390
|
path: { bank_id: bankId },
|
|
359
391
|
body: {
|
|
360
392
|
name: options.name,
|
|
393
|
+
mission: options.mission,
|
|
394
|
+
reflect_mission: options.reflectMission,
|
|
361
395
|
background: options.background,
|
|
362
396
|
disposition: options.disposition,
|
|
397
|
+
disposition_skepticism: options.dispositionSkepticism,
|
|
398
|
+
disposition_literalism: options.dispositionLiteralism,
|
|
399
|
+
disposition_empathy: options.dispositionEmpathy,
|
|
400
|
+
retain_mission: options.retainMission,
|
|
401
|
+
retain_extraction_mode: options.retainExtractionMode,
|
|
402
|
+
retain_custom_instructions: options.retainCustomInstructions,
|
|
403
|
+
retain_chunk_size: options.retainChunkSize,
|
|
404
|
+
enable_observations: options.enableObservations,
|
|
405
|
+
observations_mission: options.observationsMission,
|
|
363
406
|
},
|
|
364
407
|
});
|
|
365
408
|
|
|
366
409
|
return this.validateResponse(response, 'createBank');
|
|
367
410
|
}
|
|
368
411
|
|
|
412
|
+
/**
|
|
413
|
+
* Set or update the reflect mission for a memory bank.
|
|
414
|
+
* @deprecated Use createBank({ reflectMission: '...' }) instead.
|
|
415
|
+
*/
|
|
416
|
+
async setMission(bankId: string, mission: string): Promise<BankProfileResponse> {
|
|
417
|
+
return this.createBank(bankId, { reflectMission: mission });
|
|
418
|
+
}
|
|
419
|
+
|
|
369
420
|
/**
|
|
370
421
|
* Get a bank's profile.
|
|
371
422
|
*/
|
|
@@ -378,17 +429,81 @@ export class HindsightClient {
|
|
|
378
429
|
return this.validateResponse(response, 'getBankProfile');
|
|
379
430
|
}
|
|
380
431
|
|
|
432
|
+
|
|
381
433
|
/**
|
|
382
|
-
*
|
|
434
|
+
* Get the resolved configuration for a bank, including any bank-level overrides.
|
|
435
|
+
*
|
|
436
|
+
* Can be disabled on the server by setting `HINDSIGHT_API_ENABLE_BANK_CONFIG_API=false`.
|
|
383
437
|
*/
|
|
384
|
-
async
|
|
385
|
-
const response = await sdk.
|
|
438
|
+
async getBankConfig(bankId: string): Promise<BankConfigResponse> {
|
|
439
|
+
const response = await sdk.getBankConfig({
|
|
440
|
+
client: this.client,
|
|
441
|
+
path: { bank_id: bankId },
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
return this.validateResponse(response, 'getBankConfig');
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Update configuration overrides for a bank.
|
|
449
|
+
*
|
|
450
|
+
* Can be disabled on the server by setting `HINDSIGHT_API_ENABLE_BANK_CONFIG_API=false`.
|
|
451
|
+
*
|
|
452
|
+
* @param bankId - The memory bank ID
|
|
453
|
+
* @param options - Fields to override
|
|
454
|
+
*/
|
|
455
|
+
async updateBankConfig(
|
|
456
|
+
bankId: string,
|
|
457
|
+
options: {
|
|
458
|
+
reflectMission?: string;
|
|
459
|
+
retainMission?: string;
|
|
460
|
+
retainExtractionMode?: string;
|
|
461
|
+
retainCustomInstructions?: string;
|
|
462
|
+
retainChunkSize?: number;
|
|
463
|
+
enableObservations?: boolean;
|
|
464
|
+
observationsMission?: string;
|
|
465
|
+
/** How skeptical vs trusting (1=trusting, 5=skeptical). */
|
|
466
|
+
dispositionSkepticism?: number;
|
|
467
|
+
/** How literally to interpret information (1=flexible, 5=literal). */
|
|
468
|
+
dispositionLiteralism?: number;
|
|
469
|
+
/** How much to consider emotional context (1=detached, 5=empathetic). */
|
|
470
|
+
dispositionEmpathy?: number;
|
|
471
|
+
},
|
|
472
|
+
): Promise<BankConfigResponse> {
|
|
473
|
+
const updates: Record<string, unknown> = {};
|
|
474
|
+
if (options.reflectMission !== undefined) updates.reflect_mission = options.reflectMission;
|
|
475
|
+
if (options.retainMission !== undefined) updates.retain_mission = options.retainMission;
|
|
476
|
+
if (options.retainExtractionMode !== undefined) updates.retain_extraction_mode = options.retainExtractionMode;
|
|
477
|
+
if (options.retainCustomInstructions !== undefined)
|
|
478
|
+
updates.retain_custom_instructions = options.retainCustomInstructions;
|
|
479
|
+
if (options.retainChunkSize !== undefined) updates.retain_chunk_size = options.retainChunkSize;
|
|
480
|
+
if (options.enableObservations !== undefined) updates.enable_observations = options.enableObservations;
|
|
481
|
+
if (options.observationsMission !== undefined) updates.observations_mission = options.observationsMission;
|
|
482
|
+
if (options.dispositionSkepticism !== undefined) updates.disposition_skepticism = options.dispositionSkepticism;
|
|
483
|
+
if (options.dispositionLiteralism !== undefined) updates.disposition_literalism = options.dispositionLiteralism;
|
|
484
|
+
if (options.dispositionEmpathy !== undefined) updates.disposition_empathy = options.dispositionEmpathy;
|
|
485
|
+
|
|
486
|
+
const response = await sdk.updateBankConfig({
|
|
487
|
+
client: this.client,
|
|
488
|
+
path: { bank_id: bankId },
|
|
489
|
+
body: { updates },
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
return this.validateResponse(response, 'updateBankConfig');
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Reset all bank-level configuration overrides, reverting to server defaults.
|
|
497
|
+
*
|
|
498
|
+
* Can be disabled on the server by setting `HINDSIGHT_API_ENABLE_BANK_CONFIG_API=false`.
|
|
499
|
+
*/
|
|
500
|
+
async resetBankConfig(bankId: string): Promise<BankConfigResponse> {
|
|
501
|
+
const response = await sdk.resetBankConfig({
|
|
386
502
|
client: this.client,
|
|
387
503
|
path: { bank_id: bankId },
|
|
388
|
-
body: { mission },
|
|
389
504
|
});
|
|
390
505
|
|
|
391
|
-
return this.validateResponse(response, '
|
|
506
|
+
return this.validateResponse(response, 'resetBankConfig');
|
|
392
507
|
}
|
|
393
508
|
|
|
394
509
|
/**
|
|
@@ -623,6 +738,7 @@ export type {
|
|
|
623
738
|
FileRetainResponse,
|
|
624
739
|
ListMemoryUnitsResponse,
|
|
625
740
|
BankProfileResponse,
|
|
741
|
+
BankConfigResponse,
|
|
626
742
|
CreateBankRequest,
|
|
627
743
|
Budget,
|
|
628
744
|
};
|