@vectorize-io/hindsight-client 0.2.1 → 0.3.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/generated/sdk.gen.d.ts +15 -3
- package/dist/generated/sdk.gen.d.ts.map +1 -1
- package/dist/generated/sdk.gen.js +17 -3
- package/dist/generated/sdk.gen.js.map +1 -1
- package/dist/generated/types.gen.d.ts +246 -0
- package/dist/generated/types.gen.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +18 -10
- package/dist/src/index.js.map +1 -1
- package/generated/sdk.gen.ts +36 -2
- package/generated/types.gen.ts +258 -0
- package/package.json +2 -2
- package/src/index.ts +21 -12
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,EACT,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,sBAAsB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,WA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E,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GACzE,OAAO,CAAC,uBAAuB,CAAC;IAenC;;OAEG;IACG,UAAU,CACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,GAAG,CAAA;KAAE,GACnE,OAAO,CAAC,mBAAmB,CAAC;IAc/B;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAQrE;AAGD,YAAY,EACR,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,GACT,CAAC;AAGF,OAAO,KAAK,GAAG,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACjE,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -71,6 +71,15 @@ class HindsightClient {
|
|
|
71
71
|
: undefined,
|
|
72
72
|
}));
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates the API response and throws an error if the request failed.
|
|
76
|
+
*/
|
|
77
|
+
validateResponse(response, operation) {
|
|
78
|
+
if (!response.data) {
|
|
79
|
+
throw new Error(`${operation} failed: ${JSON.stringify(response.error || 'Unknown error')}`);
|
|
80
|
+
}
|
|
81
|
+
return response.data;
|
|
82
|
+
}
|
|
74
83
|
/**
|
|
75
84
|
* Retain a single memory for a bank.
|
|
76
85
|
*/
|
|
@@ -99,7 +108,7 @@ class HindsightClient {
|
|
|
99
108
|
path: { bank_id: bankId },
|
|
100
109
|
body: { items: [item], async: options?.async },
|
|
101
110
|
});
|
|
102
|
-
return response
|
|
111
|
+
return this.validateResponse(response, 'retain');
|
|
103
112
|
}
|
|
104
113
|
/**
|
|
105
114
|
* Retain multiple memories in batch.
|
|
@@ -111,6 +120,7 @@ class HindsightClient {
|
|
|
111
120
|
metadata: item.metadata,
|
|
112
121
|
document_id: item.document_id,
|
|
113
122
|
entities: item.entities,
|
|
123
|
+
tags: item.tags,
|
|
114
124
|
timestamp: item.timestamp instanceof Date
|
|
115
125
|
? item.timestamp.toISOString()
|
|
116
126
|
: item.timestamp,
|
|
@@ -125,10 +135,11 @@ class HindsightClient {
|
|
|
125
135
|
path: { bank_id: bankId },
|
|
126
136
|
body: {
|
|
127
137
|
items: itemsWithDocId,
|
|
138
|
+
document_tags: options?.documentTags,
|
|
128
139
|
async: options?.async,
|
|
129
140
|
},
|
|
130
141
|
});
|
|
131
|
-
return response
|
|
142
|
+
return this.validateResponse(response, 'retainBatch');
|
|
132
143
|
}
|
|
133
144
|
/**
|
|
134
145
|
* Recall memories with a natural language query.
|
|
@@ -150,10 +161,7 @@ class HindsightClient {
|
|
|
150
161
|
},
|
|
151
162
|
},
|
|
152
163
|
});
|
|
153
|
-
|
|
154
|
-
throw new Error(`API returned no data: ${JSON.stringify(response.error || 'Unknown error')}`);
|
|
155
|
-
}
|
|
156
|
-
return response.data;
|
|
164
|
+
return this.validateResponse(response, 'recall');
|
|
157
165
|
}
|
|
158
166
|
/**
|
|
159
167
|
* Reflect and generate a contextual answer using the bank's identity and memories.
|
|
@@ -168,7 +176,7 @@ class HindsightClient {
|
|
|
168
176
|
budget: options?.budget || 'low',
|
|
169
177
|
},
|
|
170
178
|
});
|
|
171
|
-
return response
|
|
179
|
+
return this.validateResponse(response, 'reflect');
|
|
172
180
|
}
|
|
173
181
|
/**
|
|
174
182
|
* List memories with pagination.
|
|
@@ -184,7 +192,7 @@ class HindsightClient {
|
|
|
184
192
|
q: options?.q,
|
|
185
193
|
},
|
|
186
194
|
});
|
|
187
|
-
return response
|
|
195
|
+
return this.validateResponse(response, 'listMemories');
|
|
188
196
|
}
|
|
189
197
|
/**
|
|
190
198
|
* Create or update a bank with disposition and background.
|
|
@@ -199,7 +207,7 @@ class HindsightClient {
|
|
|
199
207
|
disposition: options.disposition,
|
|
200
208
|
},
|
|
201
209
|
});
|
|
202
|
-
return response
|
|
210
|
+
return this.validateResponse(response, 'createBank');
|
|
203
211
|
}
|
|
204
212
|
/**
|
|
205
213
|
* Get a bank's profile.
|
|
@@ -209,7 +217,7 @@ class HindsightClient {
|
|
|
209
217
|
client: this.client,
|
|
210
218
|
path: { bank_id: bankId },
|
|
211
219
|
});
|
|
212
|
-
return response
|
|
220
|
+
return this.validateResponse(response, 'getBankProfile');
|
|
213
221
|
}
|
|
214
222
|
}
|
|
215
223
|
exports.HindsightClient = HindsightClient;
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAiE;AAEjE,0DAA4C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAiE;AAEjE,0DAA4C;AAsC5C,MAAa,eAAe;IAGxB,YAAY,OAA+B;QACvC,IAAI,CAAC,MAAM,GAAG,IAAA,qBAAY,EACtB,IAAA,qBAAY,EAAC;YACT,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,MAAM;gBACnB,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,OAAO,CAAC,MAAM,EAAE,EAAE;gBAC/C,CAAC,CAAC,SAAS;SAClB,CAAC,CACL,CAAC;IACN,CAAC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AE,gBAAgB,CAAC,CAAC;IAC7D,CAAC;CACJ;AA9ND,0CA8NC;AAiBD,yDAAyD;AACzD,4DAA4C;AAC5C,8CAAiE;AAAxD,sGAAA,YAAY,OAAA;AAAE,sGAAA,YAAY,OAAA"}
|
package/generated/sdk.gen.ts
CHANGED
|
@@ -39,6 +39,9 @@ import type {
|
|
|
39
39
|
GetGraphData,
|
|
40
40
|
GetGraphErrors,
|
|
41
41
|
GetGraphResponses,
|
|
42
|
+
GetMemoryData,
|
|
43
|
+
GetMemoryErrors,
|
|
44
|
+
GetMemoryResponses,
|
|
42
45
|
HealthEndpointHealthGetData,
|
|
43
46
|
HealthEndpointHealthGetResponses,
|
|
44
47
|
ListBanksData,
|
|
@@ -56,6 +59,9 @@ import type {
|
|
|
56
59
|
ListOperationsData,
|
|
57
60
|
ListOperationsErrors,
|
|
58
61
|
ListOperationsResponses,
|
|
62
|
+
ListTagsData,
|
|
63
|
+
ListTagsErrors,
|
|
64
|
+
ListTagsResponses,
|
|
59
65
|
MetricsEndpointMetricsGetData,
|
|
60
66
|
MetricsEndpointMetricsGetResponses,
|
|
61
67
|
RecallMemoriesData,
|
|
@@ -123,7 +129,7 @@ export const metricsEndpointMetricsGet = <ThrowOnError extends boolean = false>(
|
|
|
123
129
|
/**
|
|
124
130
|
* Get memory graph data
|
|
125
131
|
*
|
|
126
|
-
* Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion).
|
|
132
|
+
* Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion).
|
|
127
133
|
*/
|
|
128
134
|
export const getGraph = <ThrowOnError extends boolean = false>(
|
|
129
135
|
options: Options<GetGraphData, ThrowOnError>,
|
|
@@ -148,6 +154,20 @@ export const listMemories = <ThrowOnError extends boolean = false>(
|
|
|
148
154
|
ThrowOnError
|
|
149
155
|
>({ url: "/v1/default/banks/{bank_id}/memories/list", ...options });
|
|
150
156
|
|
|
157
|
+
/**
|
|
158
|
+
* Get memory unit
|
|
159
|
+
*
|
|
160
|
+
* Get a single memory unit by ID with all its metadata including entities and tags.
|
|
161
|
+
*/
|
|
162
|
+
export const getMemory = <ThrowOnError extends boolean = false>(
|
|
163
|
+
options: Options<GetMemoryData, ThrowOnError>,
|
|
164
|
+
) =>
|
|
165
|
+
(options.client ?? client).get<
|
|
166
|
+
GetMemoryResponses,
|
|
167
|
+
GetMemoryErrors,
|
|
168
|
+
ThrowOnError
|
|
169
|
+
>({ url: "/v1/default/banks/{bank_id}/memories/{memory_id}", ...options });
|
|
170
|
+
|
|
151
171
|
/**
|
|
152
172
|
* Recall memory
|
|
153
173
|
*
|
|
@@ -236,7 +256,7 @@ export const getAgentStats = <ThrowOnError extends boolean = false>(
|
|
|
236
256
|
/**
|
|
237
257
|
* List entities
|
|
238
258
|
*
|
|
239
|
-
* List all entities (people, organizations, etc.) known by the bank, ordered by mention count.
|
|
259
|
+
* List all entities (people, organizations, etc.) known by the bank, ordered by mention count. Supports pagination.
|
|
240
260
|
*/
|
|
241
261
|
export const listEntities = <ThrowOnError extends boolean = false>(
|
|
242
262
|
options: Options<ListEntitiesData, ThrowOnError>,
|
|
@@ -329,6 +349,20 @@ export const getDocument = <ThrowOnError extends boolean = false>(
|
|
|
329
349
|
ThrowOnError
|
|
330
350
|
>({ url: "/v1/default/banks/{bank_id}/documents/{document_id}", ...options });
|
|
331
351
|
|
|
352
|
+
/**
|
|
353
|
+
* List tags
|
|
354
|
+
*
|
|
355
|
+
* List all unique tags in a memory bank with usage counts. Supports wildcard search using '*' (e.g., 'user:*', '*-fred', 'tag*-2'). Case-insensitive.
|
|
356
|
+
*/
|
|
357
|
+
export const listTags = <ThrowOnError extends boolean = false>(
|
|
358
|
+
options: Options<ListTagsData, ThrowOnError>,
|
|
359
|
+
) =>
|
|
360
|
+
(options.client ?? client).get<
|
|
361
|
+
ListTagsResponses,
|
|
362
|
+
ListTagsErrors,
|
|
363
|
+
ThrowOnError
|
|
364
|
+
>({ url: "/v1/default/banks/{bank_id}/tags", ...options });
|
|
365
|
+
|
|
332
366
|
/**
|
|
333
367
|
* Get chunk details
|
|
334
368
|
*
|
package/generated/types.gen.ts
CHANGED
|
@@ -377,6 +377,12 @@ export type DocumentResponse = {
|
|
|
377
377
|
* Memory Unit Count
|
|
378
378
|
*/
|
|
379
379
|
memory_unit_count: number;
|
|
380
|
+
/**
|
|
381
|
+
* Tags
|
|
382
|
+
*
|
|
383
|
+
* Tags associated with this document
|
|
384
|
+
*/
|
|
385
|
+
tags?: Array<string>;
|
|
380
386
|
};
|
|
381
387
|
|
|
382
388
|
/**
|
|
@@ -495,6 +501,18 @@ export type EntityListResponse = {
|
|
|
495
501
|
* Items
|
|
496
502
|
*/
|
|
497
503
|
items: Array<EntityListItem>;
|
|
504
|
+
/**
|
|
505
|
+
* Total
|
|
506
|
+
*/
|
|
507
|
+
total: number;
|
|
508
|
+
/**
|
|
509
|
+
* Limit
|
|
510
|
+
*/
|
|
511
|
+
limit: number;
|
|
512
|
+
/**
|
|
513
|
+
* Offset
|
|
514
|
+
*/
|
|
515
|
+
offset: number;
|
|
498
516
|
};
|
|
499
517
|
|
|
500
518
|
/**
|
|
@@ -570,6 +588,10 @@ export type GraphDataResponse = {
|
|
|
570
588
|
* Total Units
|
|
571
589
|
*/
|
|
572
590
|
total_units: number;
|
|
591
|
+
/**
|
|
592
|
+
* Limit
|
|
593
|
+
*/
|
|
594
|
+
limit: number;
|
|
573
595
|
};
|
|
574
596
|
|
|
575
597
|
/**
|
|
@@ -650,6 +672,30 @@ export type ListMemoryUnitsResponse = {
|
|
|
650
672
|
offset: number;
|
|
651
673
|
};
|
|
652
674
|
|
|
675
|
+
/**
|
|
676
|
+
* ListTagsResponse
|
|
677
|
+
*
|
|
678
|
+
* Response model for list tags endpoint.
|
|
679
|
+
*/
|
|
680
|
+
export type ListTagsResponse = {
|
|
681
|
+
/**
|
|
682
|
+
* Items
|
|
683
|
+
*/
|
|
684
|
+
items: Array<TagItem>;
|
|
685
|
+
/**
|
|
686
|
+
* Total
|
|
687
|
+
*/
|
|
688
|
+
total: number;
|
|
689
|
+
/**
|
|
690
|
+
* Limit
|
|
691
|
+
*/
|
|
692
|
+
limit: number;
|
|
693
|
+
/**
|
|
694
|
+
* Offset
|
|
695
|
+
*/
|
|
696
|
+
offset: number;
|
|
697
|
+
};
|
|
698
|
+
|
|
653
699
|
/**
|
|
654
700
|
* MemoryItem
|
|
655
701
|
*
|
|
@@ -686,6 +732,12 @@ export type MemoryItem = {
|
|
|
686
732
|
* Optional entities to combine with auto-extracted entities.
|
|
687
733
|
*/
|
|
688
734
|
entities?: Array<EntityInput> | null;
|
|
735
|
+
/**
|
|
736
|
+
* Tags
|
|
737
|
+
*
|
|
738
|
+
* Optional tags for visibility scoping. Memories with tags can be filtered during recall.
|
|
739
|
+
*/
|
|
740
|
+
tags?: Array<string> | null;
|
|
689
741
|
};
|
|
690
742
|
|
|
691
743
|
/**
|
|
@@ -775,6 +827,18 @@ export type RecallRequest = {
|
|
|
775
827
|
* Options for including additional data (entities are included by default)
|
|
776
828
|
*/
|
|
777
829
|
include?: IncludeOptions;
|
|
830
|
+
/**
|
|
831
|
+
* Tags
|
|
832
|
+
*
|
|
833
|
+
* Filter memories by tags. If not specified, all memories are returned.
|
|
834
|
+
*/
|
|
835
|
+
tags?: Array<string> | null;
|
|
836
|
+
/**
|
|
837
|
+
* Tags Match
|
|
838
|
+
*
|
|
839
|
+
* How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged).
|
|
840
|
+
*/
|
|
841
|
+
tags_match?: "any" | "all" | "any_strict" | "all_strict";
|
|
778
842
|
};
|
|
779
843
|
|
|
780
844
|
/**
|
|
@@ -863,6 +927,10 @@ export type RecallResult = {
|
|
|
863
927
|
* Chunk Id
|
|
864
928
|
*/
|
|
865
929
|
chunk_id?: string | null;
|
|
930
|
+
/**
|
|
931
|
+
* Tags
|
|
932
|
+
*/
|
|
933
|
+
tags?: Array<string> | null;
|
|
866
934
|
};
|
|
867
935
|
|
|
868
936
|
/**
|
|
@@ -942,6 +1010,18 @@ export type ReflectRequest = {
|
|
|
942
1010
|
response_schema?: {
|
|
943
1011
|
[key: string]: unknown;
|
|
944
1012
|
} | null;
|
|
1013
|
+
/**
|
|
1014
|
+
* Tags
|
|
1015
|
+
*
|
|
1016
|
+
* Filter memories by tags during reflection. If not specified, all memories are considered.
|
|
1017
|
+
*/
|
|
1018
|
+
tags?: Array<string> | null;
|
|
1019
|
+
/**
|
|
1020
|
+
* Tags Match
|
|
1021
|
+
*
|
|
1022
|
+
* How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged).
|
|
1023
|
+
*/
|
|
1024
|
+
tags_match?: "any" | "all" | "any_strict" | "all_strict";
|
|
945
1025
|
};
|
|
946
1026
|
|
|
947
1027
|
/**
|
|
@@ -966,6 +1046,10 @@ export type ReflectResponse = {
|
|
|
966
1046
|
structured_output?: {
|
|
967
1047
|
[key: string]: unknown;
|
|
968
1048
|
} | null;
|
|
1049
|
+
/**
|
|
1050
|
+
* Token usage metrics for LLM calls during reflection.
|
|
1051
|
+
*/
|
|
1052
|
+
usage?: TokenUsage | null;
|
|
969
1053
|
};
|
|
970
1054
|
|
|
971
1055
|
/**
|
|
@@ -984,6 +1068,12 @@ export type RetainRequest = {
|
|
|
984
1068
|
* If true, process asynchronously in background. If false, wait for completion (default: false)
|
|
985
1069
|
*/
|
|
986
1070
|
async?: boolean;
|
|
1071
|
+
/**
|
|
1072
|
+
* Document Tags
|
|
1073
|
+
*
|
|
1074
|
+
* Tags applied to all items in this request. These are merged with any item-level tags.
|
|
1075
|
+
*/
|
|
1076
|
+
document_tags?: Array<string> | null;
|
|
987
1077
|
};
|
|
988
1078
|
|
|
989
1079
|
/**
|
|
@@ -1010,6 +1100,65 @@ export type RetainResponse = {
|
|
|
1010
1100
|
* Whether the operation was processed asynchronously
|
|
1011
1101
|
*/
|
|
1012
1102
|
async: boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* Operation Id
|
|
1105
|
+
*
|
|
1106
|
+
* Operation ID for tracking async operations. Use GET /v1/default/banks/{bank_id}/operations to list operations and find this ID. Only present when async=true.
|
|
1107
|
+
*/
|
|
1108
|
+
operation_id?: string | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* Token usage metrics for LLM calls during fact extraction (only present for synchronous operations)
|
|
1111
|
+
*/
|
|
1112
|
+
usage?: TokenUsage | null;
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* TagItem
|
|
1117
|
+
*
|
|
1118
|
+
* Single tag with usage count.
|
|
1119
|
+
*/
|
|
1120
|
+
export type TagItem = {
|
|
1121
|
+
/**
|
|
1122
|
+
* Tag
|
|
1123
|
+
*
|
|
1124
|
+
* The tag value
|
|
1125
|
+
*/
|
|
1126
|
+
tag: string;
|
|
1127
|
+
/**
|
|
1128
|
+
* Count
|
|
1129
|
+
*
|
|
1130
|
+
* Number of memories with this tag
|
|
1131
|
+
*/
|
|
1132
|
+
count: number;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* TokenUsage
|
|
1137
|
+
*
|
|
1138
|
+
* Token usage metrics for LLM calls.
|
|
1139
|
+
*
|
|
1140
|
+
* Tracks input/output tokens for a single request to enable
|
|
1141
|
+
* per-request cost tracking and monitoring.
|
|
1142
|
+
*/
|
|
1143
|
+
export type TokenUsage = {
|
|
1144
|
+
/**
|
|
1145
|
+
* Input Tokens
|
|
1146
|
+
*
|
|
1147
|
+
* Number of input/prompt tokens consumed
|
|
1148
|
+
*/
|
|
1149
|
+
input_tokens?: number;
|
|
1150
|
+
/**
|
|
1151
|
+
* Output Tokens
|
|
1152
|
+
*
|
|
1153
|
+
* Number of output/completion tokens generated
|
|
1154
|
+
*/
|
|
1155
|
+
output_tokens?: number;
|
|
1156
|
+
/**
|
|
1157
|
+
* Total Tokens
|
|
1158
|
+
*
|
|
1159
|
+
* Total tokens (input + output)
|
|
1160
|
+
*/
|
|
1161
|
+
total_tokens?: number;
|
|
1013
1162
|
};
|
|
1014
1163
|
|
|
1015
1164
|
/**
|
|
@@ -1086,6 +1235,10 @@ export type GetGraphData = {
|
|
|
1086
1235
|
* Type
|
|
1087
1236
|
*/
|
|
1088
1237
|
type?: string | null;
|
|
1238
|
+
/**
|
|
1239
|
+
* Limit
|
|
1240
|
+
*/
|
|
1241
|
+
limit?: number;
|
|
1089
1242
|
};
|
|
1090
1243
|
url: "/v1/default/banks/{bank_id}/graph";
|
|
1091
1244
|
};
|
|
@@ -1162,6 +1315,44 @@ export type ListMemoriesResponses = {
|
|
|
1162
1315
|
export type ListMemoriesResponse =
|
|
1163
1316
|
ListMemoriesResponses[keyof ListMemoriesResponses];
|
|
1164
1317
|
|
|
1318
|
+
export type GetMemoryData = {
|
|
1319
|
+
body?: never;
|
|
1320
|
+
headers?: {
|
|
1321
|
+
/**
|
|
1322
|
+
* Authorization
|
|
1323
|
+
*/
|
|
1324
|
+
authorization?: string | null;
|
|
1325
|
+
};
|
|
1326
|
+
path: {
|
|
1327
|
+
/**
|
|
1328
|
+
* Bank Id
|
|
1329
|
+
*/
|
|
1330
|
+
bank_id: string;
|
|
1331
|
+
/**
|
|
1332
|
+
* Memory Id
|
|
1333
|
+
*/
|
|
1334
|
+
memory_id: string;
|
|
1335
|
+
};
|
|
1336
|
+
query?: never;
|
|
1337
|
+
url: "/v1/default/banks/{bank_id}/memories/{memory_id}";
|
|
1338
|
+
};
|
|
1339
|
+
|
|
1340
|
+
export type GetMemoryErrors = {
|
|
1341
|
+
/**
|
|
1342
|
+
* Validation Error
|
|
1343
|
+
*/
|
|
1344
|
+
422: HttpValidationError;
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
export type GetMemoryError = GetMemoryErrors[keyof GetMemoryErrors];
|
|
1348
|
+
|
|
1349
|
+
export type GetMemoryResponses = {
|
|
1350
|
+
/**
|
|
1351
|
+
* Successful Response
|
|
1352
|
+
*/
|
|
1353
|
+
200: unknown;
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1165
1356
|
export type RecallMemoriesData = {
|
|
1166
1357
|
body: RecallRequest;
|
|
1167
1358
|
headers?: {
|
|
@@ -1269,6 +1460,12 @@ export type ListBanksResponse = ListBanksResponses[keyof ListBanksResponses];
|
|
|
1269
1460
|
|
|
1270
1461
|
export type GetAgentStatsData = {
|
|
1271
1462
|
body?: never;
|
|
1463
|
+
headers?: {
|
|
1464
|
+
/**
|
|
1465
|
+
* Authorization
|
|
1466
|
+
*/
|
|
1467
|
+
authorization?: string | null;
|
|
1468
|
+
};
|
|
1272
1469
|
path: {
|
|
1273
1470
|
/**
|
|
1274
1471
|
* Bank Id
|
|
@@ -1319,6 +1516,12 @@ export type ListEntitiesData = {
|
|
|
1319
1516
|
* Maximum number of entities to return
|
|
1320
1517
|
*/
|
|
1321
1518
|
limit?: number;
|
|
1519
|
+
/**
|
|
1520
|
+
* Offset
|
|
1521
|
+
*
|
|
1522
|
+
* Offset for pagination
|
|
1523
|
+
*/
|
|
1524
|
+
offset?: number;
|
|
1322
1525
|
};
|
|
1323
1526
|
url: "/v1/default/banks/{bank_id}/entities";
|
|
1324
1527
|
};
|
|
@@ -1557,6 +1760,61 @@ export type GetDocumentResponses = {
|
|
|
1557
1760
|
export type GetDocumentResponse =
|
|
1558
1761
|
GetDocumentResponses[keyof GetDocumentResponses];
|
|
1559
1762
|
|
|
1763
|
+
export type ListTagsData = {
|
|
1764
|
+
body?: never;
|
|
1765
|
+
headers?: {
|
|
1766
|
+
/**
|
|
1767
|
+
* Authorization
|
|
1768
|
+
*/
|
|
1769
|
+
authorization?: string | null;
|
|
1770
|
+
};
|
|
1771
|
+
path: {
|
|
1772
|
+
/**
|
|
1773
|
+
* Bank Id
|
|
1774
|
+
*/
|
|
1775
|
+
bank_id: string;
|
|
1776
|
+
};
|
|
1777
|
+
query?: {
|
|
1778
|
+
/**
|
|
1779
|
+
* Q
|
|
1780
|
+
*
|
|
1781
|
+
* Wildcard pattern to filter tags (e.g., 'user:*' for user:alice, '*-admin' for role-admin). Use '*' as wildcard. Case-insensitive.
|
|
1782
|
+
*/
|
|
1783
|
+
q?: string | null;
|
|
1784
|
+
/**
|
|
1785
|
+
* Limit
|
|
1786
|
+
*
|
|
1787
|
+
* Maximum number of tags to return
|
|
1788
|
+
*/
|
|
1789
|
+
limit?: number;
|
|
1790
|
+
/**
|
|
1791
|
+
* Offset
|
|
1792
|
+
*
|
|
1793
|
+
* Offset for pagination
|
|
1794
|
+
*/
|
|
1795
|
+
offset?: number;
|
|
1796
|
+
};
|
|
1797
|
+
url: "/v1/default/banks/{bank_id}/tags";
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
export type ListTagsErrors = {
|
|
1801
|
+
/**
|
|
1802
|
+
* Validation Error
|
|
1803
|
+
*/
|
|
1804
|
+
422: HttpValidationError;
|
|
1805
|
+
};
|
|
1806
|
+
|
|
1807
|
+
export type ListTagsError = ListTagsErrors[keyof ListTagsErrors];
|
|
1808
|
+
|
|
1809
|
+
export type ListTagsResponses = {
|
|
1810
|
+
/**
|
|
1811
|
+
* Successful Response
|
|
1812
|
+
*/
|
|
1813
|
+
200: ListTagsResponse;
|
|
1814
|
+
};
|
|
1815
|
+
|
|
1816
|
+
export type ListTagsResponse2 = ListTagsResponses[keyof ListTagsResponses];
|
|
1817
|
+
|
|
1560
1818
|
export type GetChunkData = {
|
|
1561
1819
|
body?: never;
|
|
1562
1820
|
headers?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vectorize-io/hindsight-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "TypeScript client for Hindsight - Semantic memory system with personality-driven thinking",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "hindsight-clients/typescript"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@hey-api/openapi-ts": "
|
|
29
|
+
"@hey-api/openapi-ts": "0.88.0",
|
|
30
30
|
"@types/jest": "^29.0.0",
|
|
31
31
|
"@types/node": "^20.0.0",
|
|
32
32
|
"jest": "^29.0.0",
|
package/src/index.ts
CHANGED
|
@@ -62,6 +62,7 @@ export interface MemoryItemInput {
|
|
|
62
62
|
metadata?: Record<string, string>;
|
|
63
63
|
document_id?: string;
|
|
64
64
|
entities?: EntityInput[];
|
|
65
|
+
tags?: string[];
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
export class HindsightClient {
|
|
@@ -78,6 +79,16 @@ export class HindsightClient {
|
|
|
78
79
|
);
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Validates the API response and throws an error if the request failed.
|
|
84
|
+
*/
|
|
85
|
+
private validateResponse<T>(response: { data?: T; error?: unknown }, operation: string): T {
|
|
86
|
+
if (!response.data) {
|
|
87
|
+
throw new Error(`${operation} failed: ${JSON.stringify(response.error || 'Unknown error')}`);
|
|
88
|
+
}
|
|
89
|
+
return response.data;
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
/**
|
|
82
93
|
* Retain a single memory for a bank.
|
|
83
94
|
*/
|
|
@@ -126,19 +137,20 @@ export class HindsightClient {
|
|
|
126
137
|
body: { items: [item], async: options?.async },
|
|
127
138
|
});
|
|
128
139
|
|
|
129
|
-
return response
|
|
140
|
+
return this.validateResponse(response, 'retain');
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
/**
|
|
133
144
|
* Retain multiple memories in batch.
|
|
134
145
|
*/
|
|
135
|
-
async retainBatch(bankId: string, items: MemoryItemInput[], options?: { documentId?: string; async?: boolean }): Promise<RetainResponse> {
|
|
146
|
+
async retainBatch(bankId: string, items: MemoryItemInput[], options?: { documentId?: string; documentTags?: string[]; async?: boolean }): Promise<RetainResponse> {
|
|
136
147
|
const processedItems = items.map((item) => ({
|
|
137
148
|
content: item.content,
|
|
138
149
|
context: item.context,
|
|
139
150
|
metadata: item.metadata,
|
|
140
151
|
document_id: item.document_id,
|
|
141
152
|
entities: item.entities,
|
|
153
|
+
tags: item.tags,
|
|
142
154
|
timestamp:
|
|
143
155
|
item.timestamp instanceof Date
|
|
144
156
|
? item.timestamp.toISOString()
|
|
@@ -156,11 +168,12 @@ export class HindsightClient {
|
|
|
156
168
|
path: { bank_id: bankId },
|
|
157
169
|
body: {
|
|
158
170
|
items: itemsWithDocId,
|
|
171
|
+
document_tags: options?.documentTags,
|
|
159
172
|
async: options?.async,
|
|
160
173
|
},
|
|
161
174
|
});
|
|
162
175
|
|
|
163
|
-
return response
|
|
176
|
+
return this.validateResponse(response, 'retainBatch');
|
|
164
177
|
}
|
|
165
178
|
|
|
166
179
|
/**
|
|
@@ -198,11 +211,7 @@ export class HindsightClient {
|
|
|
198
211
|
},
|
|
199
212
|
});
|
|
200
213
|
|
|
201
|
-
|
|
202
|
-
throw new Error(`API returned no data: ${JSON.stringify(response.error || 'Unknown error')}`);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return response.data;
|
|
214
|
+
return this.validateResponse(response, 'recall');
|
|
206
215
|
}
|
|
207
216
|
|
|
208
217
|
/**
|
|
@@ -223,7 +232,7 @@ export class HindsightClient {
|
|
|
223
232
|
},
|
|
224
233
|
});
|
|
225
234
|
|
|
226
|
-
return response
|
|
235
|
+
return this.validateResponse(response, 'reflect');
|
|
227
236
|
}
|
|
228
237
|
|
|
229
238
|
/**
|
|
@@ -244,7 +253,7 @@ export class HindsightClient {
|
|
|
244
253
|
},
|
|
245
254
|
});
|
|
246
255
|
|
|
247
|
-
return response
|
|
256
|
+
return this.validateResponse(response, 'listMemories');
|
|
248
257
|
}
|
|
249
258
|
|
|
250
259
|
/**
|
|
@@ -264,7 +273,7 @@ export class HindsightClient {
|
|
|
264
273
|
},
|
|
265
274
|
});
|
|
266
275
|
|
|
267
|
-
return response
|
|
276
|
+
return this.validateResponse(response, 'createBank');
|
|
268
277
|
}
|
|
269
278
|
|
|
270
279
|
/**
|
|
@@ -276,7 +285,7 @@ export class HindsightClient {
|
|
|
276
285
|
path: { bank_id: bankId },
|
|
277
286
|
});
|
|
278
287
|
|
|
279
|
-
return response
|
|
288
|
+
return this.validateResponse(response, 'getBankProfile');
|
|
280
289
|
}
|
|
281
290
|
}
|
|
282
291
|
|