@vectorize-io/hindsight-client 0.4.21 → 0.5.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.mts +505 -18
- package/dist/index.d.ts +505 -18
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -0
- package/dist/index.mjs.map +1 -1
- package/generated/sdk.gen.ts +50 -0
- package/generated/types.gen.ts +509 -16
- package/package.json +1 -1
- package/src/index.ts +53 -0
package/dist/index.mjs
CHANGED
|
@@ -871,10 +871,12 @@ __export(sdk_gen_exports, {
|
|
|
871
871
|
deleteDocument: () => deleteDocument,
|
|
872
872
|
deleteMentalModel: () => deleteMentalModel,
|
|
873
873
|
deleteWebhook: () => deleteWebhook,
|
|
874
|
+
exportBankTemplate: () => exportBankTemplate,
|
|
874
875
|
fileRetain: () => fileRetain,
|
|
875
876
|
getAgentStats: () => getAgentStats,
|
|
876
877
|
getBankConfig: () => getBankConfig,
|
|
877
878
|
getBankProfile: () => getBankProfile,
|
|
879
|
+
getBankTemplateSchema: () => getBankTemplateSchema,
|
|
878
880
|
getChunk: () => getChunk,
|
|
879
881
|
getDirective: () => getDirective,
|
|
880
882
|
getDocument: () => getDocument,
|
|
@@ -887,6 +889,7 @@ __export(sdk_gen_exports, {
|
|
|
887
889
|
getOperationStatus: () => getOperationStatus,
|
|
888
890
|
getVersion: () => getVersion,
|
|
889
891
|
healthEndpointHealthGet: () => healthEndpointHealthGet,
|
|
892
|
+
importBankTemplate: () => importBankTemplate,
|
|
890
893
|
listAuditLogs: () => listAuditLogs,
|
|
891
894
|
listBanks: () => listBanks,
|
|
892
895
|
listDirectives: () => listDirectives,
|
|
@@ -1076,6 +1079,9 @@ var createOrUpdateBank = (options) => (options.client ?? client).put({
|
|
|
1076
1079
|
...options.headers
|
|
1077
1080
|
}
|
|
1078
1081
|
});
|
|
1082
|
+
var importBankTemplate = (options) => (options.client ?? client).post({ url: "/v1/default/banks/{bank_id}/import", ...options });
|
|
1083
|
+
var exportBankTemplate = (options) => (options.client ?? client).get({ url: "/v1/default/banks/{bank_id}/export", ...options });
|
|
1084
|
+
var getBankTemplateSchema = (options) => (options?.client ?? client).get({ url: "/v1/bank-template-schema", ...options });
|
|
1079
1085
|
var clearObservations = (options) => (options.client ?? client).delete({ url: "/v1/default/banks/{bank_id}/observations", ...options });
|
|
1080
1086
|
var recoverConsolidation = (options) => (options.client ?? client).post({ url: "/v1/default/banks/{bank_id}/consolidation/recover", ...options });
|
|
1081
1087
|
var clearMemoryObservations = (options) => (options.client ?? client).delete({
|
|
@@ -1194,6 +1200,9 @@ var HindsightClient = class {
|
|
|
1194
1200
|
if (options?.tags) {
|
|
1195
1201
|
item.tags = options.tags;
|
|
1196
1202
|
}
|
|
1203
|
+
if (options?.updateMode) {
|
|
1204
|
+
item.update_mode = options.updateMode;
|
|
1205
|
+
}
|
|
1197
1206
|
const response = await retainMemories({
|
|
1198
1207
|
client: this.client,
|
|
1199
1208
|
path: { bank_id: bankId },
|
|
@@ -1214,6 +1223,7 @@ var HindsightClient = class {
|
|
|
1214
1223
|
tags: item.tags,
|
|
1215
1224
|
observation_scopes: item.observation_scopes,
|
|
1216
1225
|
strategy: item.strategy,
|
|
1226
|
+
update_mode: item.update_mode,
|
|
1217
1227
|
timestamp: item.timestamp instanceof Date ? item.timestamp.toISOString() : item.timestamp
|
|
1218
1228
|
}));
|
|
1219
1229
|
const itemsWithDocId = processedItems.map((item) => ({
|
|
@@ -1577,11 +1587,42 @@ var HindsightClient = class {
|
|
|
1577
1587
|
return this.validateResponse(response, "getMentalModelHistory");
|
|
1578
1588
|
}
|
|
1579
1589
|
};
|
|
1590
|
+
function recallResponseToPromptString(response) {
|
|
1591
|
+
const chunksMap = response.chunks ?? {};
|
|
1592
|
+
const sections = [];
|
|
1593
|
+
const formattedFacts = (response.results ?? []).map((result) => {
|
|
1594
|
+
const obj = { text: result.text };
|
|
1595
|
+
if (result.context) obj.context = result.context;
|
|
1596
|
+
if (result.occurred_start) obj.occurred_start = result.occurred_start;
|
|
1597
|
+
if (result.occurred_end) obj.occurred_end = result.occurred_end;
|
|
1598
|
+
if (result.mentioned_at) obj.mentioned_at = result.mentioned_at;
|
|
1599
|
+
if (result.chunk_id && chunksMap[result.chunk_id]) {
|
|
1600
|
+
obj.source_chunk = chunksMap[result.chunk_id].text;
|
|
1601
|
+
}
|
|
1602
|
+
return obj;
|
|
1603
|
+
});
|
|
1604
|
+
sections.push("FACTS:\n" + JSON.stringify(formattedFacts, null, 2));
|
|
1605
|
+
const entities = response.entities;
|
|
1606
|
+
if (entities) {
|
|
1607
|
+
const entityParts = [];
|
|
1608
|
+
for (const [name, state] of Object.entries(entities)) {
|
|
1609
|
+
if (state.observations?.length) {
|
|
1610
|
+
entityParts.push(`## ${name}
|
|
1611
|
+
${state.observations[0].text}`);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
if (entityParts.length) {
|
|
1615
|
+
sections.push("ENTITIES:\n" + entityParts.join("\n\n"));
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
return sections.join("\n\n");
|
|
1619
|
+
}
|
|
1580
1620
|
export {
|
|
1581
1621
|
HindsightClient,
|
|
1582
1622
|
HindsightError,
|
|
1583
1623
|
createClient,
|
|
1584
1624
|
createConfig,
|
|
1625
|
+
recallResponseToPromptString,
|
|
1585
1626
|
sdk_gen_exports as sdk
|
|
1586
1627
|
};
|
|
1587
1628
|
//# sourceMappingURL=index.mjs.map
|