@nebula-ai/sdk 1.1.15 → 1.1.17
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 +112 -49
- package/dist/index.d.ts +112 -49
- package/dist/index.js +355 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +333 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ declare enum GraphSearchResultType {
|
|
|
6
6
|
interface Chunk {
|
|
7
7
|
id: string;
|
|
8
8
|
content: string;
|
|
9
|
-
metadata: Record<string,
|
|
9
|
+
metadata: Record<string, unknown>;
|
|
10
10
|
role?: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -17,33 +17,49 @@ interface StructuredChunk {
|
|
|
17
17
|
text: string;
|
|
18
18
|
role: 'user' | 'assistant' | 'system';
|
|
19
19
|
}
|
|
20
|
-
interface
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
interface TextContentPart {
|
|
21
|
+
type: 'text';
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
interface FileContentPart {
|
|
25
|
+
type?: 'image' | 'audio' | 'document' | 'file';
|
|
26
|
+
data: string;
|
|
27
|
+
media_type: string;
|
|
28
|
+
filename?: string;
|
|
29
|
+
duration_seconds?: number;
|
|
28
30
|
}
|
|
29
|
-
interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
interface S3FileReferencePart {
|
|
32
|
+
type: 's3_ref';
|
|
33
|
+
s3_key: string;
|
|
34
|
+
bucket?: string;
|
|
35
|
+
media_type: string;
|
|
36
|
+
filename?: string;
|
|
37
|
+
size_bytes?: number;
|
|
38
|
+
}
|
|
39
|
+
type MultimodalContentPart = TextContentPart | FileContentPart | S3FileReferencePart;
|
|
40
|
+
interface Memory$1 {
|
|
41
|
+
collection_id?: string;
|
|
42
|
+
content?: string | string[] | MultimodalContentPart[] | Array<{
|
|
43
|
+
content: string | MultimodalContentPart[];
|
|
33
44
|
role: string;
|
|
34
|
-
metadata?: Record<string,
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
35
46
|
authority?: number;
|
|
36
47
|
}>;
|
|
37
48
|
role?: string;
|
|
49
|
+
id?: string;
|
|
38
50
|
memory_id?: string;
|
|
39
|
-
metadata: Record<string,
|
|
51
|
+
metadata: Record<string, unknown>;
|
|
40
52
|
authority?: number;
|
|
53
|
+
chunks?: Chunk[];
|
|
54
|
+
collection_ids?: string[];
|
|
55
|
+
created_at?: string;
|
|
56
|
+
updated_at?: string;
|
|
41
57
|
}
|
|
42
58
|
interface Collection {
|
|
43
59
|
id: string;
|
|
44
60
|
name: string;
|
|
45
61
|
description?: string;
|
|
46
|
-
metadata: Record<string,
|
|
62
|
+
metadata: Record<string, unknown>;
|
|
47
63
|
created_at?: string;
|
|
48
64
|
updated_at?: string;
|
|
49
65
|
memory_count: number;
|
|
@@ -52,13 +68,14 @@ interface Collection {
|
|
|
52
68
|
interface SearchResult {
|
|
53
69
|
id: string;
|
|
54
70
|
score: number;
|
|
55
|
-
metadata: Record<string,
|
|
71
|
+
metadata: Record<string, unknown>;
|
|
56
72
|
source?: string;
|
|
57
73
|
timestamp?: string;
|
|
58
74
|
display_name?: string;
|
|
59
75
|
source_role?: string;
|
|
60
76
|
memory_id?: string;
|
|
61
77
|
owner_id?: string;
|
|
78
|
+
engram_id?: string;
|
|
62
79
|
content?: string;
|
|
63
80
|
graph_result_type?: GraphSearchResultType;
|
|
64
81
|
graph_entity?: GraphEntityResult;
|
|
@@ -70,7 +87,7 @@ interface GraphEntityResult {
|
|
|
70
87
|
id?: string;
|
|
71
88
|
name: string;
|
|
72
89
|
description: string;
|
|
73
|
-
metadata: Record<string,
|
|
90
|
+
metadata: Record<string, unknown>;
|
|
74
91
|
}
|
|
75
92
|
interface GraphRelationshipResult {
|
|
76
93
|
id?: string;
|
|
@@ -80,17 +97,17 @@ interface GraphRelationshipResult {
|
|
|
80
97
|
subject_id?: string;
|
|
81
98
|
object_id?: string;
|
|
82
99
|
description?: string;
|
|
83
|
-
metadata: Record<string,
|
|
100
|
+
metadata: Record<string, unknown>;
|
|
84
101
|
}
|
|
85
102
|
interface GraphCommunityResult {
|
|
86
103
|
id?: string;
|
|
87
104
|
name: string;
|
|
88
105
|
summary: string;
|
|
89
|
-
metadata: Record<string,
|
|
106
|
+
metadata: Record<string, unknown>;
|
|
90
107
|
}
|
|
91
108
|
interface SearchOptions {
|
|
92
109
|
limit: number;
|
|
93
|
-
filters?: Record<string,
|
|
110
|
+
filters?: Record<string, unknown>;
|
|
94
111
|
search_mode?: 'fast' | 'super';
|
|
95
112
|
}
|
|
96
113
|
interface RecallFocus {
|
|
@@ -105,7 +122,7 @@ interface ActivatedEntity {
|
|
|
105
122
|
activation_score: number;
|
|
106
123
|
activation_reason?: string;
|
|
107
124
|
traversal_depth: number;
|
|
108
|
-
profile?: Record<string,
|
|
125
|
+
profile?: Record<string, unknown>;
|
|
109
126
|
}
|
|
110
127
|
interface ActivatedFact {
|
|
111
128
|
fact_id: string;
|
|
@@ -129,9 +146,9 @@ interface GroundedUtterance {
|
|
|
129
146
|
timestamp?: string;
|
|
130
147
|
display_name?: string;
|
|
131
148
|
supporting_fact_ids: string[];
|
|
132
|
-
metadata?: Record<string,
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
133
150
|
}
|
|
134
|
-
interface
|
|
151
|
+
interface MemoryResponse {
|
|
135
152
|
query: string;
|
|
136
153
|
entities: ActivatedEntity[];
|
|
137
154
|
facts: ActivatedFact[];
|
|
@@ -150,8 +167,8 @@ interface NebulaClientConfig {
|
|
|
150
167
|
}
|
|
151
168
|
declare class NebulaException extends Error {
|
|
152
169
|
statusCode?: number | undefined;
|
|
153
|
-
details?:
|
|
154
|
-
constructor(message: string, statusCode?: number | undefined, details?:
|
|
170
|
+
details?: unknown | undefined;
|
|
171
|
+
constructor(message: string, statusCode?: number | undefined, details?: unknown | undefined);
|
|
155
172
|
}
|
|
156
173
|
declare class NebulaClientException extends NebulaException {
|
|
157
174
|
cause?: Error | undefined;
|
|
@@ -164,8 +181,8 @@ declare class NebulaRateLimitException extends NebulaException {
|
|
|
164
181
|
constructor(message?: string);
|
|
165
182
|
}
|
|
166
183
|
declare class NebulaValidationException extends NebulaException {
|
|
167
|
-
details?:
|
|
168
|
-
constructor(message?: string, details?:
|
|
184
|
+
details?: unknown | undefined;
|
|
185
|
+
constructor(message?: string, details?: unknown | undefined);
|
|
169
186
|
}
|
|
170
187
|
declare class NebulaCollectionNotFoundException extends NebulaException {
|
|
171
188
|
constructor(message?: string);
|
|
@@ -182,7 +199,8 @@ declare class Nebula {
|
|
|
182
199
|
private apiKey;
|
|
183
200
|
private baseUrl;
|
|
184
201
|
private timeout;
|
|
185
|
-
|
|
202
|
+
private static readonly MAX_INLINE_SIZE;
|
|
203
|
+
constructor(config?: NebulaClientConfig);
|
|
186
204
|
setApiKey(next: string): void;
|
|
187
205
|
setBaseUrl(next: string): void;
|
|
188
206
|
setCorsProxy(_next: string): void;
|
|
@@ -192,13 +210,19 @@ declare class Nebula {
|
|
|
192
210
|
private _isNebulaApiKey;
|
|
193
211
|
/** Build authentication headers */
|
|
194
212
|
private _buildAuthHeaders;
|
|
213
|
+
private _isRecord;
|
|
214
|
+
private _unwrapResults;
|
|
215
|
+
private _unwrapResultsArray;
|
|
216
|
+
private _looksLikeMultimodalContent;
|
|
217
|
+
private _normalizeContentParts;
|
|
218
|
+
private _serializeContentAsText;
|
|
195
219
|
/** Make an HTTP request to the Nebula API */
|
|
196
220
|
private _makeRequest;
|
|
197
221
|
/** Create a new collection */
|
|
198
222
|
createCollection(options: {
|
|
199
223
|
name: string;
|
|
200
224
|
description?: string;
|
|
201
|
-
metadata?: Record<string,
|
|
225
|
+
metadata?: Record<string, unknown>;
|
|
202
226
|
}): Promise<Collection>;
|
|
203
227
|
/** Get a specific collection by ID */
|
|
204
228
|
getCollection(collectionId: string): Promise<Collection>;
|
|
@@ -215,14 +239,14 @@ declare class Nebula {
|
|
|
215
239
|
collectionId: string;
|
|
216
240
|
name?: string;
|
|
217
241
|
description?: string;
|
|
218
|
-
metadata?: Record<string,
|
|
242
|
+
metadata?: Record<string, unknown>;
|
|
219
243
|
}): Promise<Collection>;
|
|
220
244
|
/** Delete a collection */
|
|
221
245
|
deleteCollection(collectionId: string): Promise<boolean>;
|
|
222
246
|
/**
|
|
223
247
|
* Legacy convenience: store raw text content into a collection as a document
|
|
224
248
|
*/
|
|
225
|
-
store(content: string, collectionId: string, metadata?: Record<string,
|
|
249
|
+
store(content: string, collectionId: string, metadata?: Record<string, unknown>): Promise<Memory$1>;
|
|
226
250
|
/**
|
|
227
251
|
* Store a single memory using the unified engrams API.
|
|
228
252
|
*
|
|
@@ -230,15 +254,15 @@ declare class Nebula {
|
|
|
230
254
|
* - If role is present, creates a conversation
|
|
231
255
|
* - Otherwise, creates a document
|
|
232
256
|
*/
|
|
233
|
-
storeMemory(memory: Memory | Record<string,
|
|
257
|
+
storeMemory(memory: Memory$1 | Record<string, unknown>, name?: string): Promise<string>;
|
|
234
258
|
/**
|
|
235
|
-
* Internal method to append content to an existing
|
|
259
|
+
* Internal method to append content to an existing memory
|
|
236
260
|
*
|
|
237
|
-
* @throws NebulaNotFoundException if
|
|
261
|
+
* @throws NebulaNotFoundException if memory_id doesn't exist
|
|
238
262
|
*/
|
|
239
263
|
private _appendToMemory;
|
|
240
264
|
/** Store multiple memories using the unified engrams API */
|
|
241
|
-
storeMemories(memories: Memory[]): Promise<string[]>;
|
|
265
|
+
storeMemories(memories: Memory$1[]): Promise<string[]>;
|
|
242
266
|
/** Delete one or more memories */
|
|
243
267
|
delete(memoryIds: string | string[]): Promise<boolean | {
|
|
244
268
|
message: string;
|
|
@@ -258,7 +282,7 @@ declare class Nebula {
|
|
|
258
282
|
/** Delete a specific chunk or message within a memory */
|
|
259
283
|
deleteChunk(chunkId: string): Promise<boolean>;
|
|
260
284
|
/** Update a specific chunk or message within a memory */
|
|
261
|
-
updateChunk(chunkId: string, content: string, metadata?: Record<string,
|
|
285
|
+
updateChunk(chunkId: string, content: string, metadata?: Record<string, unknown>): Promise<boolean>;
|
|
262
286
|
/**
|
|
263
287
|
* Update memory-level properties including name, metadata, and collection associations.
|
|
264
288
|
*
|
|
@@ -284,7 +308,7 @@ declare class Nebula {
|
|
|
284
308
|
updateMemory(options: {
|
|
285
309
|
memoryId: string;
|
|
286
310
|
name?: string;
|
|
287
|
-
metadata?: Record<string,
|
|
311
|
+
metadata?: Record<string, unknown>;
|
|
288
312
|
collectionIds?: string[];
|
|
289
313
|
mergeMetadata?: boolean;
|
|
290
314
|
}): Promise<boolean>;
|
|
@@ -325,18 +349,17 @@ declare class Nebula {
|
|
|
325
349
|
collection_ids: string | string[];
|
|
326
350
|
limit?: number;
|
|
327
351
|
offset?: number;
|
|
328
|
-
metadata_filters?: Record<string,
|
|
329
|
-
}): Promise<
|
|
352
|
+
metadata_filters?: Record<string, unknown>;
|
|
353
|
+
}): Promise<Memory$1[]>;
|
|
330
354
|
/** Get a specific memory by engram ID */
|
|
331
|
-
getMemory(memoryId: string): Promise<
|
|
355
|
+
getMemory(memoryId: string): Promise<Memory$1>;
|
|
332
356
|
/**
|
|
333
357
|
* Search within specific collections with optional metadata filtering.
|
|
334
358
|
*
|
|
335
359
|
* @param options - Search configuration
|
|
336
360
|
* @param options.query - Search query string
|
|
337
361
|
* @param options.collection_ids - One or more collection IDs to search within
|
|
338
|
-
* @param options.
|
|
339
|
-
* @param options.retrieval_type - Retrieval strategy (default: ADVANCED)
|
|
362
|
+
* @param options.effort - Compute effort budget (auto/low/medium/high). Controls traversal compute, not MemoryResponse size.
|
|
340
363
|
* @param options.filters - Optional filters to apply to the search. Supports comprehensive metadata filtering
|
|
341
364
|
* with MongoDB-like operators for both vector/chunk search and graph search.
|
|
342
365
|
* @param options.searchSettings - Optional search configuration
|
|
@@ -428,16 +451,56 @@ declare class Nebula {
|
|
|
428
451
|
search(options: {
|
|
429
452
|
query: string;
|
|
430
453
|
collection_ids?: string | string[];
|
|
431
|
-
|
|
432
|
-
filters?: Record<string,
|
|
433
|
-
searchSettings?: Record<string,
|
|
434
|
-
}): Promise<
|
|
435
|
-
healthCheck(): Promise<Record<string,
|
|
454
|
+
effort?: 'auto' | 'low' | 'medium' | 'high';
|
|
455
|
+
filters?: Record<string, unknown>;
|
|
456
|
+
searchSettings?: Record<string, unknown>;
|
|
457
|
+
}): Promise<MemoryResponse>;
|
|
458
|
+
healthCheck(): Promise<Record<string, unknown>>;
|
|
436
459
|
private _collectionFromDict;
|
|
437
460
|
private _memoryResponseFromDict;
|
|
438
461
|
private _searchResultFromDict;
|
|
439
462
|
private _searchResultFromGraphDict;
|
|
440
463
|
private _sha256;
|
|
464
|
+
private _formDataFromObject;
|
|
465
|
+
/**
|
|
466
|
+
* Convert and process multimodal content parts, auto-uploading large base64 files to S3.
|
|
467
|
+
*
|
|
468
|
+
* - Binary parts (`image`/`audio`/`document` with `data`) larger than 5MB are uploaded to S3 and converted to `s3_ref`.
|
|
469
|
+
*/
|
|
470
|
+
private _processContentParts;
|
|
471
|
+
/**
|
|
472
|
+
* Get a presigned URL for uploading large files to S3.
|
|
473
|
+
*/
|
|
474
|
+
getUploadUrl(options: {
|
|
475
|
+
filename: string;
|
|
476
|
+
content_type: string;
|
|
477
|
+
file_size: number;
|
|
478
|
+
}): Promise<{
|
|
479
|
+
upload_url: string;
|
|
480
|
+
s3_key: string;
|
|
481
|
+
bucket: string;
|
|
482
|
+
expires_in: number;
|
|
483
|
+
}>;
|
|
441
484
|
}
|
|
442
485
|
|
|
443
|
-
|
|
486
|
+
/**
|
|
487
|
+
* Utility for creating multimodal content from files.
|
|
488
|
+
* Note: These methods only work in Node.js environments.
|
|
489
|
+
*/
|
|
490
|
+
declare class NebulaContent {
|
|
491
|
+
/**
|
|
492
|
+
* Create a FileContentPart from a file path.
|
|
493
|
+
* Automatically deduces media_type and the backend 'type' (image, audio, document).
|
|
494
|
+
*/
|
|
495
|
+
static fromFile(filePath: string, mediaType?: string): Promise<FileContentPart>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
type MemoryFactory = {
|
|
499
|
+
(data: Memory$1): Memory$1;
|
|
500
|
+
File: typeof NebulaContent.fromFile;
|
|
501
|
+
fromFile: (filePath: string, collection_id: string, metadata?: Record<string, unknown>, role?: string) => Promise<Memory$1>;
|
|
502
|
+
};
|
|
503
|
+
declare const Memory: MemoryFactory;
|
|
504
|
+
type Memory = Memory$1;
|
|
505
|
+
|
|
506
|
+
export { type ActivatedEntity, type ActivatedFact, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type GroundedUtterance, Memory, type MemoryResponse, type MultimodalContentPart, Nebula, NebulaAuthenticationException, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaContent, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type RecallFocus, type S3FileReferencePart, type SearchOptions, type SearchResult, type StructuredChunk, type TextContentPart, Nebula as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare enum GraphSearchResultType {
|
|
|
6
6
|
interface Chunk {
|
|
7
7
|
id: string;
|
|
8
8
|
content: string;
|
|
9
|
-
metadata: Record<string,
|
|
9
|
+
metadata: Record<string, unknown>;
|
|
10
10
|
role?: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -17,33 +17,49 @@ interface StructuredChunk {
|
|
|
17
17
|
text: string;
|
|
18
18
|
role: 'user' | 'assistant' | 'system';
|
|
19
19
|
}
|
|
20
|
-
interface
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
interface TextContentPart {
|
|
21
|
+
type: 'text';
|
|
22
|
+
text: string;
|
|
23
|
+
}
|
|
24
|
+
interface FileContentPart {
|
|
25
|
+
type?: 'image' | 'audio' | 'document' | 'file';
|
|
26
|
+
data: string;
|
|
27
|
+
media_type: string;
|
|
28
|
+
filename?: string;
|
|
29
|
+
duration_seconds?: number;
|
|
28
30
|
}
|
|
29
|
-
interface
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
interface S3FileReferencePart {
|
|
32
|
+
type: 's3_ref';
|
|
33
|
+
s3_key: string;
|
|
34
|
+
bucket?: string;
|
|
35
|
+
media_type: string;
|
|
36
|
+
filename?: string;
|
|
37
|
+
size_bytes?: number;
|
|
38
|
+
}
|
|
39
|
+
type MultimodalContentPart = TextContentPart | FileContentPart | S3FileReferencePart;
|
|
40
|
+
interface Memory$1 {
|
|
41
|
+
collection_id?: string;
|
|
42
|
+
content?: string | string[] | MultimodalContentPart[] | Array<{
|
|
43
|
+
content: string | MultimodalContentPart[];
|
|
33
44
|
role: string;
|
|
34
|
-
metadata?: Record<string,
|
|
45
|
+
metadata?: Record<string, unknown>;
|
|
35
46
|
authority?: number;
|
|
36
47
|
}>;
|
|
37
48
|
role?: string;
|
|
49
|
+
id?: string;
|
|
38
50
|
memory_id?: string;
|
|
39
|
-
metadata: Record<string,
|
|
51
|
+
metadata: Record<string, unknown>;
|
|
40
52
|
authority?: number;
|
|
53
|
+
chunks?: Chunk[];
|
|
54
|
+
collection_ids?: string[];
|
|
55
|
+
created_at?: string;
|
|
56
|
+
updated_at?: string;
|
|
41
57
|
}
|
|
42
58
|
interface Collection {
|
|
43
59
|
id: string;
|
|
44
60
|
name: string;
|
|
45
61
|
description?: string;
|
|
46
|
-
metadata: Record<string,
|
|
62
|
+
metadata: Record<string, unknown>;
|
|
47
63
|
created_at?: string;
|
|
48
64
|
updated_at?: string;
|
|
49
65
|
memory_count: number;
|
|
@@ -52,13 +68,14 @@ interface Collection {
|
|
|
52
68
|
interface SearchResult {
|
|
53
69
|
id: string;
|
|
54
70
|
score: number;
|
|
55
|
-
metadata: Record<string,
|
|
71
|
+
metadata: Record<string, unknown>;
|
|
56
72
|
source?: string;
|
|
57
73
|
timestamp?: string;
|
|
58
74
|
display_name?: string;
|
|
59
75
|
source_role?: string;
|
|
60
76
|
memory_id?: string;
|
|
61
77
|
owner_id?: string;
|
|
78
|
+
engram_id?: string;
|
|
62
79
|
content?: string;
|
|
63
80
|
graph_result_type?: GraphSearchResultType;
|
|
64
81
|
graph_entity?: GraphEntityResult;
|
|
@@ -70,7 +87,7 @@ interface GraphEntityResult {
|
|
|
70
87
|
id?: string;
|
|
71
88
|
name: string;
|
|
72
89
|
description: string;
|
|
73
|
-
metadata: Record<string,
|
|
90
|
+
metadata: Record<string, unknown>;
|
|
74
91
|
}
|
|
75
92
|
interface GraphRelationshipResult {
|
|
76
93
|
id?: string;
|
|
@@ -80,17 +97,17 @@ interface GraphRelationshipResult {
|
|
|
80
97
|
subject_id?: string;
|
|
81
98
|
object_id?: string;
|
|
82
99
|
description?: string;
|
|
83
|
-
metadata: Record<string,
|
|
100
|
+
metadata: Record<string, unknown>;
|
|
84
101
|
}
|
|
85
102
|
interface GraphCommunityResult {
|
|
86
103
|
id?: string;
|
|
87
104
|
name: string;
|
|
88
105
|
summary: string;
|
|
89
|
-
metadata: Record<string,
|
|
106
|
+
metadata: Record<string, unknown>;
|
|
90
107
|
}
|
|
91
108
|
interface SearchOptions {
|
|
92
109
|
limit: number;
|
|
93
|
-
filters?: Record<string,
|
|
110
|
+
filters?: Record<string, unknown>;
|
|
94
111
|
search_mode?: 'fast' | 'super';
|
|
95
112
|
}
|
|
96
113
|
interface RecallFocus {
|
|
@@ -105,7 +122,7 @@ interface ActivatedEntity {
|
|
|
105
122
|
activation_score: number;
|
|
106
123
|
activation_reason?: string;
|
|
107
124
|
traversal_depth: number;
|
|
108
|
-
profile?: Record<string,
|
|
125
|
+
profile?: Record<string, unknown>;
|
|
109
126
|
}
|
|
110
127
|
interface ActivatedFact {
|
|
111
128
|
fact_id: string;
|
|
@@ -129,9 +146,9 @@ interface GroundedUtterance {
|
|
|
129
146
|
timestamp?: string;
|
|
130
147
|
display_name?: string;
|
|
131
148
|
supporting_fact_ids: string[];
|
|
132
|
-
metadata?: Record<string,
|
|
149
|
+
metadata?: Record<string, unknown>;
|
|
133
150
|
}
|
|
134
|
-
interface
|
|
151
|
+
interface MemoryResponse {
|
|
135
152
|
query: string;
|
|
136
153
|
entities: ActivatedEntity[];
|
|
137
154
|
facts: ActivatedFact[];
|
|
@@ -150,8 +167,8 @@ interface NebulaClientConfig {
|
|
|
150
167
|
}
|
|
151
168
|
declare class NebulaException extends Error {
|
|
152
169
|
statusCode?: number | undefined;
|
|
153
|
-
details?:
|
|
154
|
-
constructor(message: string, statusCode?: number | undefined, details?:
|
|
170
|
+
details?: unknown | undefined;
|
|
171
|
+
constructor(message: string, statusCode?: number | undefined, details?: unknown | undefined);
|
|
155
172
|
}
|
|
156
173
|
declare class NebulaClientException extends NebulaException {
|
|
157
174
|
cause?: Error | undefined;
|
|
@@ -164,8 +181,8 @@ declare class NebulaRateLimitException extends NebulaException {
|
|
|
164
181
|
constructor(message?: string);
|
|
165
182
|
}
|
|
166
183
|
declare class NebulaValidationException extends NebulaException {
|
|
167
|
-
details?:
|
|
168
|
-
constructor(message?: string, details?:
|
|
184
|
+
details?: unknown | undefined;
|
|
185
|
+
constructor(message?: string, details?: unknown | undefined);
|
|
169
186
|
}
|
|
170
187
|
declare class NebulaCollectionNotFoundException extends NebulaException {
|
|
171
188
|
constructor(message?: string);
|
|
@@ -182,7 +199,8 @@ declare class Nebula {
|
|
|
182
199
|
private apiKey;
|
|
183
200
|
private baseUrl;
|
|
184
201
|
private timeout;
|
|
185
|
-
|
|
202
|
+
private static readonly MAX_INLINE_SIZE;
|
|
203
|
+
constructor(config?: NebulaClientConfig);
|
|
186
204
|
setApiKey(next: string): void;
|
|
187
205
|
setBaseUrl(next: string): void;
|
|
188
206
|
setCorsProxy(_next: string): void;
|
|
@@ -192,13 +210,19 @@ declare class Nebula {
|
|
|
192
210
|
private _isNebulaApiKey;
|
|
193
211
|
/** Build authentication headers */
|
|
194
212
|
private _buildAuthHeaders;
|
|
213
|
+
private _isRecord;
|
|
214
|
+
private _unwrapResults;
|
|
215
|
+
private _unwrapResultsArray;
|
|
216
|
+
private _looksLikeMultimodalContent;
|
|
217
|
+
private _normalizeContentParts;
|
|
218
|
+
private _serializeContentAsText;
|
|
195
219
|
/** Make an HTTP request to the Nebula API */
|
|
196
220
|
private _makeRequest;
|
|
197
221
|
/** Create a new collection */
|
|
198
222
|
createCollection(options: {
|
|
199
223
|
name: string;
|
|
200
224
|
description?: string;
|
|
201
|
-
metadata?: Record<string,
|
|
225
|
+
metadata?: Record<string, unknown>;
|
|
202
226
|
}): Promise<Collection>;
|
|
203
227
|
/** Get a specific collection by ID */
|
|
204
228
|
getCollection(collectionId: string): Promise<Collection>;
|
|
@@ -215,14 +239,14 @@ declare class Nebula {
|
|
|
215
239
|
collectionId: string;
|
|
216
240
|
name?: string;
|
|
217
241
|
description?: string;
|
|
218
|
-
metadata?: Record<string,
|
|
242
|
+
metadata?: Record<string, unknown>;
|
|
219
243
|
}): Promise<Collection>;
|
|
220
244
|
/** Delete a collection */
|
|
221
245
|
deleteCollection(collectionId: string): Promise<boolean>;
|
|
222
246
|
/**
|
|
223
247
|
* Legacy convenience: store raw text content into a collection as a document
|
|
224
248
|
*/
|
|
225
|
-
store(content: string, collectionId: string, metadata?: Record<string,
|
|
249
|
+
store(content: string, collectionId: string, metadata?: Record<string, unknown>): Promise<Memory$1>;
|
|
226
250
|
/**
|
|
227
251
|
* Store a single memory using the unified engrams API.
|
|
228
252
|
*
|
|
@@ -230,15 +254,15 @@ declare class Nebula {
|
|
|
230
254
|
* - If role is present, creates a conversation
|
|
231
255
|
* - Otherwise, creates a document
|
|
232
256
|
*/
|
|
233
|
-
storeMemory(memory: Memory | Record<string,
|
|
257
|
+
storeMemory(memory: Memory$1 | Record<string, unknown>, name?: string): Promise<string>;
|
|
234
258
|
/**
|
|
235
|
-
* Internal method to append content to an existing
|
|
259
|
+
* Internal method to append content to an existing memory
|
|
236
260
|
*
|
|
237
|
-
* @throws NebulaNotFoundException if
|
|
261
|
+
* @throws NebulaNotFoundException if memory_id doesn't exist
|
|
238
262
|
*/
|
|
239
263
|
private _appendToMemory;
|
|
240
264
|
/** Store multiple memories using the unified engrams API */
|
|
241
|
-
storeMemories(memories: Memory[]): Promise<string[]>;
|
|
265
|
+
storeMemories(memories: Memory$1[]): Promise<string[]>;
|
|
242
266
|
/** Delete one or more memories */
|
|
243
267
|
delete(memoryIds: string | string[]): Promise<boolean | {
|
|
244
268
|
message: string;
|
|
@@ -258,7 +282,7 @@ declare class Nebula {
|
|
|
258
282
|
/** Delete a specific chunk or message within a memory */
|
|
259
283
|
deleteChunk(chunkId: string): Promise<boolean>;
|
|
260
284
|
/** Update a specific chunk or message within a memory */
|
|
261
|
-
updateChunk(chunkId: string, content: string, metadata?: Record<string,
|
|
285
|
+
updateChunk(chunkId: string, content: string, metadata?: Record<string, unknown>): Promise<boolean>;
|
|
262
286
|
/**
|
|
263
287
|
* Update memory-level properties including name, metadata, and collection associations.
|
|
264
288
|
*
|
|
@@ -284,7 +308,7 @@ declare class Nebula {
|
|
|
284
308
|
updateMemory(options: {
|
|
285
309
|
memoryId: string;
|
|
286
310
|
name?: string;
|
|
287
|
-
metadata?: Record<string,
|
|
311
|
+
metadata?: Record<string, unknown>;
|
|
288
312
|
collectionIds?: string[];
|
|
289
313
|
mergeMetadata?: boolean;
|
|
290
314
|
}): Promise<boolean>;
|
|
@@ -325,18 +349,17 @@ declare class Nebula {
|
|
|
325
349
|
collection_ids: string | string[];
|
|
326
350
|
limit?: number;
|
|
327
351
|
offset?: number;
|
|
328
|
-
metadata_filters?: Record<string,
|
|
329
|
-
}): Promise<
|
|
352
|
+
metadata_filters?: Record<string, unknown>;
|
|
353
|
+
}): Promise<Memory$1[]>;
|
|
330
354
|
/** Get a specific memory by engram ID */
|
|
331
|
-
getMemory(memoryId: string): Promise<
|
|
355
|
+
getMemory(memoryId: string): Promise<Memory$1>;
|
|
332
356
|
/**
|
|
333
357
|
* Search within specific collections with optional metadata filtering.
|
|
334
358
|
*
|
|
335
359
|
* @param options - Search configuration
|
|
336
360
|
* @param options.query - Search query string
|
|
337
361
|
* @param options.collection_ids - One or more collection IDs to search within
|
|
338
|
-
* @param options.
|
|
339
|
-
* @param options.retrieval_type - Retrieval strategy (default: ADVANCED)
|
|
362
|
+
* @param options.effort - Compute effort budget (auto/low/medium/high). Controls traversal compute, not MemoryResponse size.
|
|
340
363
|
* @param options.filters - Optional filters to apply to the search. Supports comprehensive metadata filtering
|
|
341
364
|
* with MongoDB-like operators for both vector/chunk search and graph search.
|
|
342
365
|
* @param options.searchSettings - Optional search configuration
|
|
@@ -428,16 +451,56 @@ declare class Nebula {
|
|
|
428
451
|
search(options: {
|
|
429
452
|
query: string;
|
|
430
453
|
collection_ids?: string | string[];
|
|
431
|
-
|
|
432
|
-
filters?: Record<string,
|
|
433
|
-
searchSettings?: Record<string,
|
|
434
|
-
}): Promise<
|
|
435
|
-
healthCheck(): Promise<Record<string,
|
|
454
|
+
effort?: 'auto' | 'low' | 'medium' | 'high';
|
|
455
|
+
filters?: Record<string, unknown>;
|
|
456
|
+
searchSettings?: Record<string, unknown>;
|
|
457
|
+
}): Promise<MemoryResponse>;
|
|
458
|
+
healthCheck(): Promise<Record<string, unknown>>;
|
|
436
459
|
private _collectionFromDict;
|
|
437
460
|
private _memoryResponseFromDict;
|
|
438
461
|
private _searchResultFromDict;
|
|
439
462
|
private _searchResultFromGraphDict;
|
|
440
463
|
private _sha256;
|
|
464
|
+
private _formDataFromObject;
|
|
465
|
+
/**
|
|
466
|
+
* Convert and process multimodal content parts, auto-uploading large base64 files to S3.
|
|
467
|
+
*
|
|
468
|
+
* - Binary parts (`image`/`audio`/`document` with `data`) larger than 5MB are uploaded to S3 and converted to `s3_ref`.
|
|
469
|
+
*/
|
|
470
|
+
private _processContentParts;
|
|
471
|
+
/**
|
|
472
|
+
* Get a presigned URL for uploading large files to S3.
|
|
473
|
+
*/
|
|
474
|
+
getUploadUrl(options: {
|
|
475
|
+
filename: string;
|
|
476
|
+
content_type: string;
|
|
477
|
+
file_size: number;
|
|
478
|
+
}): Promise<{
|
|
479
|
+
upload_url: string;
|
|
480
|
+
s3_key: string;
|
|
481
|
+
bucket: string;
|
|
482
|
+
expires_in: number;
|
|
483
|
+
}>;
|
|
441
484
|
}
|
|
442
485
|
|
|
443
|
-
|
|
486
|
+
/**
|
|
487
|
+
* Utility for creating multimodal content from files.
|
|
488
|
+
* Note: These methods only work in Node.js environments.
|
|
489
|
+
*/
|
|
490
|
+
declare class NebulaContent {
|
|
491
|
+
/**
|
|
492
|
+
* Create a FileContentPart from a file path.
|
|
493
|
+
* Automatically deduces media_type and the backend 'type' (image, audio, document).
|
|
494
|
+
*/
|
|
495
|
+
static fromFile(filePath: string, mediaType?: string): Promise<FileContentPart>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
type MemoryFactory = {
|
|
499
|
+
(data: Memory$1): Memory$1;
|
|
500
|
+
File: typeof NebulaContent.fromFile;
|
|
501
|
+
fromFile: (filePath: string, collection_id: string, metadata?: Record<string, unknown>, role?: string) => Promise<Memory$1>;
|
|
502
|
+
};
|
|
503
|
+
declare const Memory: MemoryFactory;
|
|
504
|
+
type Memory = Memory$1;
|
|
505
|
+
|
|
506
|
+
export { type ActivatedEntity, type ActivatedFact, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type GroundedUtterance, Memory, type MemoryResponse, type MultimodalContentPart, Nebula, NebulaAuthenticationException, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaContent, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type RecallFocus, type S3FileReferencePart, type SearchOptions, type SearchResult, type StructuredChunk, type TextContentPart, Nebula as default };
|