@nebula-ai/sdk 0.0.27 → 0.0.31
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/README.md +56 -19
- package/dist/index.d.mts +169 -47
- package/dist/index.d.ts +169 -47
- package/dist/index.js +388 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +387 -128
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ const cluster = await client.createCluster({
|
|
|
36
36
|
|
|
37
37
|
// Store a memory using the unified Memory model
|
|
38
38
|
const memoryId = await client.storeMemory({
|
|
39
|
-
|
|
39
|
+
collection_id: cluster.id,
|
|
40
40
|
content: 'This is an important piece of information about my project.',
|
|
41
41
|
metadata: { category: 'project', priority: 'high' }
|
|
42
42
|
});
|
|
@@ -44,7 +44,7 @@ const memoryId = await client.storeMemory({
|
|
|
44
44
|
// Search for memories with advanced options
|
|
45
45
|
const results = await client.search({
|
|
46
46
|
query: 'project information',
|
|
47
|
-
|
|
47
|
+
collection_ids: [cluster.id],
|
|
48
48
|
limit: 5,
|
|
49
49
|
retrieval_type: RetrievalType.ADVANCED,
|
|
50
50
|
filters: { 'metadata.category': 'project' }
|
|
@@ -75,7 +75,7 @@ new NebulaClient(config: NebulaClientConfig)
|
|
|
75
75
|
await client.createCluster(options: { name: string, description?: string, metadata?: Record<string, any> })
|
|
76
76
|
|
|
77
77
|
// Get a cluster by ID
|
|
78
|
-
await client.getCluster(
|
|
78
|
+
await client.getCluster(collectionId: string)
|
|
79
79
|
|
|
80
80
|
// Get a cluster by name
|
|
81
81
|
await client.getClusterByName(name: string)
|
|
@@ -84,17 +84,30 @@ await client.getClusterByName(name: string)
|
|
|
84
84
|
await client.listClusters(options?: { limit?: number, offset?: number })
|
|
85
85
|
|
|
86
86
|
// Update a cluster
|
|
87
|
-
await client.updateCluster(options: {
|
|
87
|
+
await client.updateCluster(options: { collectionId: string, name?: string, description?: string, metadata?: Record<string, any> })
|
|
88
88
|
|
|
89
89
|
// Delete a cluster
|
|
90
|
-
await client.deleteCluster(
|
|
90
|
+
await client.deleteCluster(collectionId: string)
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
#### Conversations
|
|
94
94
|
|
|
95
95
|
```typescript
|
|
96
96
|
// List conversations for the authenticated user
|
|
97
|
-
await client.listConversations(options?: {
|
|
97
|
+
await client.listConversations(options?: {
|
|
98
|
+
limit?: number,
|
|
99
|
+
offset?: number,
|
|
100
|
+
collection_ids?: string[],
|
|
101
|
+
metadata_filters?: Record<string, any> // MongoDB-like operators: $eq, $ne, $in, $nin, $exists, $and, $or
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// Example: Filter playground conversations
|
|
105
|
+
const playgroundConversations = await client.listConversations({
|
|
106
|
+
collection_ids: ['cluster-id'],
|
|
107
|
+
metadata_filters: {
|
|
108
|
+
'metadata.playground': { $eq: true }
|
|
109
|
+
}
|
|
110
|
+
});
|
|
98
111
|
|
|
99
112
|
// Get conversation messages
|
|
100
113
|
await client.getConversationMessages(conversationId: string): Promise<MemoryResponse[]>
|
|
@@ -117,7 +130,31 @@ await client.storeMemories(memories: Memory[])
|
|
|
117
130
|
await client.getMemory(memoryId: string)
|
|
118
131
|
|
|
119
132
|
// List memories from clusters
|
|
120
|
-
await client.listMemories(options: {
|
|
133
|
+
await client.listMemories(options: {
|
|
134
|
+
collection_ids: string | string[],
|
|
135
|
+
limit?: number,
|
|
136
|
+
offset?: number,
|
|
137
|
+
metadata_filters?: Record<string, any> // MongoDB-like operators: $eq, $ne, $in, $nin, $exists, $and, $or
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
// Example: List memories excluding conversations
|
|
141
|
+
const memories = await client.listMemories({
|
|
142
|
+
collection_ids: ['cluster-id'],
|
|
143
|
+
metadata_filters: {
|
|
144
|
+
'metadata.content_type': { $ne: 'conversation' }
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Example: Complex filter with multiple conditions
|
|
149
|
+
const playgroundMemories = await client.listMemories({
|
|
150
|
+
collection_ids: ['cluster-id'],
|
|
151
|
+
metadata_filters: {
|
|
152
|
+
$and: [
|
|
153
|
+
{ 'metadata.playground': { $eq: true } },
|
|
154
|
+
{ 'metadata.session_id': { $exists: true } }
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
});
|
|
121
158
|
|
|
122
159
|
// Delete one or more memories
|
|
123
160
|
// Single deletion:
|
|
@@ -133,7 +170,7 @@ await client.delete(['id1', 'id2', 'id3']) // Returns: detailed results object
|
|
|
133
170
|
// Search within clusters
|
|
134
171
|
await client.search(options: {
|
|
135
172
|
query: string,
|
|
136
|
-
|
|
173
|
+
collection_ids: string | string[],
|
|
137
174
|
limit?: number,
|
|
138
175
|
retrieval_type?: RetrievalType | string,
|
|
139
176
|
filters?: Record<string, any>,
|
|
@@ -154,7 +191,7 @@ await client.healthCheck()
|
|
|
154
191
|
|
|
155
192
|
```typescript
|
|
156
193
|
interface Memory {
|
|
157
|
-
|
|
194
|
+
collection_id: string; // Required: cluster to store in
|
|
158
195
|
content: string; // Required: text content
|
|
159
196
|
role?: string; // Optional: 'user', 'assistant', or custom (for conversations)
|
|
160
197
|
parent_id?: string; // Optional: conversation ID (for conversations)
|
|
@@ -170,7 +207,7 @@ interface MemoryResponse {
|
|
|
170
207
|
content?: string;
|
|
171
208
|
chunks?: string[];
|
|
172
209
|
metadata: Record<string, any>;
|
|
173
|
-
|
|
210
|
+
collection_ids: string[];
|
|
174
211
|
created_at?: string;
|
|
175
212
|
updated_at?: string;
|
|
176
213
|
}
|
|
@@ -226,7 +263,7 @@ The search method supports advanced configuration:
|
|
|
226
263
|
```typescript
|
|
227
264
|
const results = await client.search({
|
|
228
265
|
query: 'query',
|
|
229
|
-
|
|
266
|
+
collection_ids: [collectionId],
|
|
230
267
|
limit: 10,
|
|
231
268
|
retrieval_type: RetrievalType.ADVANCED,
|
|
232
269
|
filters: { 'metadata.category': 'science' },
|
|
@@ -256,7 +293,7 @@ import {
|
|
|
256
293
|
} from '@nebula-ai/sdk';
|
|
257
294
|
|
|
258
295
|
try {
|
|
259
|
-
await client.search({ query: 'query',
|
|
296
|
+
await client.search({ query: 'query', collection_ids: [collectionId] });
|
|
260
297
|
} catch (error) {
|
|
261
298
|
if (error instanceof NebulaAuthenticationException) {
|
|
262
299
|
console.log('Invalid API key');
|
|
@@ -289,12 +326,12 @@ async function manageMemories() {
|
|
|
289
326
|
// Store memories using the unified model
|
|
290
327
|
const memories = [
|
|
291
328
|
{
|
|
292
|
-
|
|
329
|
+
collection_id: cluster.id,
|
|
293
330
|
content: 'JavaScript is a programming language',
|
|
294
331
|
metadata: { category: 'programming', difficulty: 'beginner' }
|
|
295
332
|
},
|
|
296
333
|
{
|
|
297
|
-
|
|
334
|
+
collection_id: cluster.id,
|
|
298
335
|
content: 'TypeScript adds static typing to JavaScript',
|
|
299
336
|
metadata: { category: 'programming', difficulty: 'beginner' }
|
|
300
337
|
}
|
|
@@ -305,7 +342,7 @@ async function manageMemories() {
|
|
|
305
342
|
console.log('Stored memories:', memoryIds);
|
|
306
343
|
|
|
307
344
|
// Search for memories
|
|
308
|
-
const results = await client.search({ query: 'JavaScript',
|
|
345
|
+
const results = await client.search({ query: 'JavaScript', collection_ids: [cluster.id] });
|
|
309
346
|
console.log('Search results:', results);
|
|
310
347
|
|
|
311
348
|
// Delete a single memory
|
|
@@ -342,13 +379,13 @@ async function trackConversation() {
|
|
|
342
379
|
// Store conversation turns
|
|
343
380
|
const conversationMemories = [
|
|
344
381
|
{
|
|
345
|
-
|
|
382
|
+
collection_id: cluster.id,
|
|
346
383
|
content: 'What is machine learning?',
|
|
347
384
|
role: 'user',
|
|
348
385
|
metadata: { topic: 'AI' }
|
|
349
386
|
},
|
|
350
387
|
{
|
|
351
|
-
|
|
388
|
+
collection_id: cluster.id,
|
|
352
389
|
content: 'Machine learning is a subset of AI...',
|
|
353
390
|
role: 'assistant',
|
|
354
391
|
metadata: { topic: 'AI' }
|
|
@@ -405,7 +442,7 @@ async function advancedSearch() {
|
|
|
405
442
|
|
|
406
443
|
// Store knowledge graph data
|
|
407
444
|
await client.storeMemory({
|
|
408
|
-
|
|
445
|
+
collection_id: cluster.id,
|
|
409
446
|
content: 'Einstein developed the theory of relativity',
|
|
410
447
|
metadata: { entity: 'Einstein', concept: 'relativity', field: 'physics' }
|
|
411
448
|
});
|
|
@@ -413,7 +450,7 @@ async function advancedSearch() {
|
|
|
413
450
|
// Search with graph settings
|
|
414
451
|
const results = await client.search({
|
|
415
452
|
query: 'Einstein relativity',
|
|
416
|
-
|
|
453
|
+
collection_ids: [cluster.id],
|
|
417
454
|
limit: 10,
|
|
418
455
|
retrieval_type: RetrievalType.ADVANCED,
|
|
419
456
|
searchSettings: {
|
package/dist/index.d.mts
CHANGED
|
@@ -3,23 +3,35 @@ declare enum GraphSearchResultType {
|
|
|
3
3
|
RELATIONSHIP = "relationship",
|
|
4
4
|
COMMUNITY = "community"
|
|
5
5
|
}
|
|
6
|
+
interface Chunk {
|
|
7
|
+
id: string;
|
|
8
|
+
content: string;
|
|
9
|
+
metadata: Record<string, any>;
|
|
10
|
+
role?: string;
|
|
11
|
+
}
|
|
6
12
|
interface MemoryResponse {
|
|
7
13
|
id: string;
|
|
8
14
|
content?: string;
|
|
9
|
-
chunks?:
|
|
15
|
+
chunks?: Chunk[];
|
|
10
16
|
metadata: Record<string, any>;
|
|
11
|
-
|
|
17
|
+
collection_ids: string[];
|
|
12
18
|
created_at?: string;
|
|
13
19
|
updated_at?: string;
|
|
14
20
|
}
|
|
15
21
|
interface Memory {
|
|
16
|
-
|
|
17
|
-
content: string
|
|
22
|
+
collection_id: string;
|
|
23
|
+
content: string | string[] | Array<{
|
|
24
|
+
content: string;
|
|
25
|
+
role: string;
|
|
26
|
+
metadata?: Record<string, any>;
|
|
27
|
+
authority?: number;
|
|
28
|
+
}>;
|
|
18
29
|
role?: string;
|
|
19
|
-
|
|
30
|
+
memory_id?: string;
|
|
20
31
|
metadata: Record<string, any>;
|
|
32
|
+
authority?: number;
|
|
21
33
|
}
|
|
22
|
-
interface
|
|
34
|
+
interface Collection {
|
|
23
35
|
id: string;
|
|
24
36
|
name: string;
|
|
25
37
|
description?: string;
|
|
@@ -37,7 +49,7 @@ interface SearchResult {
|
|
|
37
49
|
timestamp?: string;
|
|
38
50
|
display_name?: string;
|
|
39
51
|
source_role?: string;
|
|
40
|
-
|
|
52
|
+
memory_id?: string;
|
|
41
53
|
owner_id?: string;
|
|
42
54
|
content?: string;
|
|
43
55
|
graph_result_type?: GraphSearchResultType;
|
|
@@ -104,9 +116,12 @@ declare class NebulaValidationException extends NebulaException {
|
|
|
104
116
|
details?: any | undefined;
|
|
105
117
|
constructor(message?: string, details?: any | undefined);
|
|
106
118
|
}
|
|
107
|
-
declare class
|
|
119
|
+
declare class NebulaCollectionNotFoundException extends NebulaException {
|
|
108
120
|
constructor(message?: string);
|
|
109
121
|
}
|
|
122
|
+
declare class NebulaNotFoundException extends NebulaException {
|
|
123
|
+
constructor(resourceId: string, resourceType?: string);
|
|
124
|
+
}
|
|
110
125
|
|
|
111
126
|
/**
|
|
112
127
|
* Official Nebula JavaScript/TypeScript SDK
|
|
@@ -128,48 +143,89 @@ declare class NebulaClient {
|
|
|
128
143
|
private _buildAuthHeaders;
|
|
129
144
|
/** Make an HTTP request to the Nebula API */
|
|
130
145
|
private _makeRequest;
|
|
131
|
-
/** Create a new
|
|
132
|
-
|
|
146
|
+
/** Create a new collection */
|
|
147
|
+
createCollection(options: {
|
|
133
148
|
name: string;
|
|
134
149
|
description?: string;
|
|
135
150
|
metadata?: Record<string, any>;
|
|
136
|
-
}): Promise<
|
|
137
|
-
/** Get a specific
|
|
138
|
-
|
|
139
|
-
/** Get a specific
|
|
140
|
-
|
|
141
|
-
/** Get all
|
|
142
|
-
|
|
151
|
+
}): Promise<Collection>;
|
|
152
|
+
/** Get a specific collection by ID */
|
|
153
|
+
getCollection(collectionId: string): Promise<Collection>;
|
|
154
|
+
/** Get a specific collection by name */
|
|
155
|
+
getCollectionByName(name: string): Promise<Collection>;
|
|
156
|
+
/** Get all collections */
|
|
157
|
+
listCollections(options?: {
|
|
143
158
|
limit?: number;
|
|
144
159
|
offset?: number;
|
|
145
|
-
}): Promise<
|
|
146
|
-
/**
|
|
160
|
+
}): Promise<Collection[]>;
|
|
161
|
+
/**
|
|
162
|
+
* List conversations for the authenticated user with optional metadata filtering
|
|
163
|
+
*
|
|
164
|
+
* @param options - Configuration for listing conversations
|
|
165
|
+
* @param options.limit - Maximum number of conversations to return (default: 100)
|
|
166
|
+
* @param options.offset - Number of conversations to skip for pagination (default: 0)
|
|
167
|
+
* @param options.collection_ids - Optional list of collection IDs to filter conversations by
|
|
168
|
+
* @param options.metadata_filters - Optional metadata filters using MongoDB-like operators.
|
|
169
|
+
* Supported operators: $eq, $ne, $in, $nin, $exists, $and, $or
|
|
170
|
+
*
|
|
171
|
+
* @returns Promise resolving to array of conversation objects with fields: id, created_at, user_id, name, collection_ids
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* // Get all playground conversations
|
|
175
|
+
* const conversations = await client.listConversations({
|
|
176
|
+
* collection_ids: ['collection-id'],
|
|
177
|
+
* metadata_filters: {
|
|
178
|
+
* 'metadata.playground': { $eq: true }
|
|
179
|
+
* }
|
|
180
|
+
* });
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* // Filter by session ID
|
|
184
|
+
* const conversations = await client.listConversations({
|
|
185
|
+
* metadata_filters: {
|
|
186
|
+
* 'metadata.session_id': { $eq: 'session-123' }
|
|
187
|
+
* }
|
|
188
|
+
* });
|
|
189
|
+
*/
|
|
147
190
|
listConversations(options?: {
|
|
148
191
|
limit?: number;
|
|
149
192
|
offset?: number;
|
|
150
|
-
|
|
193
|
+
collection_ids?: string[];
|
|
194
|
+
metadata_filters?: Record<string, any>;
|
|
151
195
|
}): Promise<any[]>;
|
|
152
196
|
/** Get conversation messages directly from the conversations API */
|
|
153
197
|
getConversationMessages(conversationId: string): Promise<MemoryResponse[]>;
|
|
154
198
|
getConversationMessages(conversationIds: string[]): Promise<Record<string, MemoryResponse[]>>;
|
|
155
199
|
/** Helper method to transform conversation messages to MemoryResponse format */
|
|
156
200
|
private _transformConversationMessages;
|
|
157
|
-
/** Update a
|
|
158
|
-
|
|
159
|
-
|
|
201
|
+
/** Update a collection */
|
|
202
|
+
updateCollection(options: {
|
|
203
|
+
collectionId: string;
|
|
160
204
|
name?: string;
|
|
161
205
|
description?: string;
|
|
162
206
|
metadata?: Record<string, any>;
|
|
163
|
-
}): Promise<
|
|
164
|
-
/** Delete a
|
|
165
|
-
|
|
207
|
+
}): Promise<Collection>;
|
|
208
|
+
/** Delete a collection */
|
|
209
|
+
deleteCollection(collectionId: string): Promise<boolean>;
|
|
210
|
+
/**
|
|
211
|
+
* Legacy convenience: store raw text content into a collection as a document
|
|
212
|
+
*/
|
|
213
|
+
store(content: string, collectionId: string, metadata?: Record<string, any>): Promise<MemoryResponse>;
|
|
166
214
|
/**
|
|
167
|
-
*
|
|
215
|
+
* Store a single memory using the unified engrams API.
|
|
216
|
+
*
|
|
217
|
+
* Automatically infers memory type:
|
|
218
|
+
* - If role is present, creates a conversation
|
|
219
|
+
* - Otherwise, creates a document
|
|
168
220
|
*/
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
|
|
172
|
-
|
|
221
|
+
storeMemory(memory: Memory | Record<string, any>, name?: string): Promise<string>;
|
|
222
|
+
/**
|
|
223
|
+
* Internal method to append content to an existing engram
|
|
224
|
+
*
|
|
225
|
+
* @throws NebulaNotFoundException if engram_id doesn't exist
|
|
226
|
+
*/
|
|
227
|
+
private _appendToMemory;
|
|
228
|
+
/** Store multiple memories using the unified engrams API */
|
|
173
229
|
storeMemories(memories: Memory[]): Promise<string[]>;
|
|
174
230
|
/** Delete one or more memories */
|
|
175
231
|
delete(memoryIds: string | string[]): Promise<boolean | {
|
|
@@ -187,22 +243,88 @@ declare class NebulaClient {
|
|
|
187
243
|
};
|
|
188
244
|
};
|
|
189
245
|
}>;
|
|
246
|
+
/** Delete a specific chunk or message within a memory */
|
|
247
|
+
deleteChunk(chunkId: string): Promise<boolean>;
|
|
248
|
+
/** Update a specific chunk or message within a memory */
|
|
249
|
+
updateChunk(chunkId: string, content: string, metadata?: Record<string, any>): Promise<boolean>;
|
|
250
|
+
/**
|
|
251
|
+
* Update memory-level properties including name, metadata, and collection associations.
|
|
252
|
+
*
|
|
253
|
+
* This method allows updating properties of an entire memory (document or conversation)
|
|
254
|
+
* without modifying its content. For updating individual chunks or messages within a memory,
|
|
255
|
+
* use updateChunk(). For updating content, use storeMemory() to append.
|
|
256
|
+
*
|
|
257
|
+
* @param options - Update configuration
|
|
258
|
+
* @param options.memoryId - The ID of the memory to update
|
|
259
|
+
* @param options.name - New name for the memory (useful for conversations and documents)
|
|
260
|
+
* @param options.metadata - Metadata to set. By default, replaces existing metadata.
|
|
261
|
+
* Set mergeMetadata=true to merge with existing metadata instead.
|
|
262
|
+
* @param options.collectionIds - New collection associations. Must specify at least one valid collection.
|
|
263
|
+
* @param options.mergeMetadata - If true, merges provided metadata with existing metadata.
|
|
264
|
+
* If false (default), replaces existing metadata entirely.
|
|
265
|
+
*
|
|
266
|
+
* @returns Promise resolving to true if successful
|
|
267
|
+
*
|
|
268
|
+
* @throws NebulaNotFoundException if memory_id doesn't exist
|
|
269
|
+
* @throws NebulaValidationException if validation fails (e.g., no fields provided)
|
|
270
|
+
* @throws NebulaAuthenticationException if user doesn't have permission to update this memory
|
|
271
|
+
*/
|
|
272
|
+
updateMemory(options: {
|
|
273
|
+
memoryId: string;
|
|
274
|
+
name?: string;
|
|
275
|
+
metadata?: Record<string, any>;
|
|
276
|
+
collectionIds?: string[];
|
|
277
|
+
mergeMetadata?: boolean;
|
|
278
|
+
}): Promise<boolean>;
|
|
190
279
|
/** Delete a conversation and all its messages */
|
|
191
280
|
deleteConversation(conversationId: string): Promise<boolean>;
|
|
192
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* Get all memories from specific collections with optional metadata filtering
|
|
283
|
+
*
|
|
284
|
+
* @param options - Configuration for listing memories
|
|
285
|
+
* @param options.collection_ids - One or more collection IDs to retrieve memories from
|
|
286
|
+
* @param options.limit - Maximum number of memories to return (default: 100)
|
|
287
|
+
* @param options.offset - Number of memories to skip for pagination (default: 0)
|
|
288
|
+
* @param options.metadata_filters - Optional metadata filters using MongoDB-like operators.
|
|
289
|
+
* Supported operators: $eq, $ne, $in, $nin, $exists, $and, $or
|
|
290
|
+
*
|
|
291
|
+
* @returns Promise resolving to array of MemoryResponse objects
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* // Get all playground memories excluding conversations
|
|
295
|
+
* const memories = await client.listMemories({
|
|
296
|
+
* collection_ids: ['collection-id'],
|
|
297
|
+
* metadata_filters: {
|
|
298
|
+
* 'metadata.content_type': { $ne: 'conversation' }
|
|
299
|
+
* }
|
|
300
|
+
* });
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* // Complex filter with multiple conditions
|
|
304
|
+
* const memories = await client.listMemories({
|
|
305
|
+
* collection_ids: ['collection-id'],
|
|
306
|
+
* metadata_filters: {
|
|
307
|
+
* $and: [
|
|
308
|
+
* { 'metadata.playground': { $eq: true } },
|
|
309
|
+
* { 'metadata.session_id': { $exists: true } }
|
|
310
|
+
* ]
|
|
311
|
+
* }
|
|
312
|
+
* });
|
|
313
|
+
*/
|
|
193
314
|
listMemories(options: {
|
|
194
|
-
|
|
315
|
+
collection_ids: string | string[];
|
|
195
316
|
limit?: number;
|
|
196
317
|
offset?: number;
|
|
318
|
+
metadata_filters?: Record<string, any>;
|
|
197
319
|
}): Promise<MemoryResponse[]>;
|
|
198
|
-
/** Get a specific memory by ID */
|
|
320
|
+
/** Get a specific memory by engram ID */
|
|
199
321
|
getMemory(memoryId: string): Promise<MemoryResponse>;
|
|
200
322
|
/**
|
|
201
|
-
* Search within specific
|
|
323
|
+
* Search within specific collections with optional metadata filtering.
|
|
202
324
|
*
|
|
203
325
|
* @param options - Search configuration
|
|
204
326
|
* @param options.query - Search query string
|
|
205
|
-
* @param options.
|
|
327
|
+
* @param options.collection_ids - One or more collection IDs to search within
|
|
206
328
|
* @param options.limit - Maximum number of results to return (default: 10)
|
|
207
329
|
* @param options.retrieval_type - Retrieval strategy (default: ADVANCED)
|
|
208
330
|
* @param options.filters - Optional filters to apply to the search. Supports comprehensive metadata filtering
|
|
@@ -215,7 +337,7 @@ declare class NebulaClient {
|
|
|
215
337
|
* // Basic equality filter
|
|
216
338
|
* await client.search({
|
|
217
339
|
* query: "machine learning",
|
|
218
|
-
*
|
|
340
|
+
* collection_ids: ["research-collection"],
|
|
219
341
|
* filters: {
|
|
220
342
|
* "metadata.category": { $eq: "research" },
|
|
221
343
|
* "metadata.verified": true // Shorthand for $eq
|
|
@@ -226,7 +348,7 @@ declare class NebulaClient {
|
|
|
226
348
|
* // Numeric comparisons
|
|
227
349
|
* await client.search({
|
|
228
350
|
* query: "high priority",
|
|
229
|
-
*
|
|
351
|
+
* collection_ids: ["tasks"],
|
|
230
352
|
* filters: {
|
|
231
353
|
* "metadata.priority": { $gte: 8 },
|
|
232
354
|
* "metadata.score": { $lt: 100 }
|
|
@@ -237,7 +359,7 @@ declare class NebulaClient {
|
|
|
237
359
|
* // String matching
|
|
238
360
|
* await client.search({
|
|
239
361
|
* query: "employees",
|
|
240
|
-
*
|
|
362
|
+
* collection_ids: ["team"],
|
|
241
363
|
* filters: {
|
|
242
364
|
* "metadata.email": { $ilike: "%@company.com" } // Case-insensitive
|
|
243
365
|
* }
|
|
@@ -247,7 +369,7 @@ declare class NebulaClient {
|
|
|
247
369
|
* // Array operations
|
|
248
370
|
* await client.search({
|
|
249
371
|
* query: "developers",
|
|
250
|
-
*
|
|
372
|
+
* collection_ids: ["team"],
|
|
251
373
|
* filters: {
|
|
252
374
|
* "metadata.skills": { $overlap: ["python", "typescript"] } // Has any
|
|
253
375
|
* }
|
|
@@ -257,7 +379,7 @@ declare class NebulaClient {
|
|
|
257
379
|
* // Nested paths
|
|
258
380
|
* await client.search({
|
|
259
381
|
* query: "users",
|
|
260
|
-
*
|
|
382
|
+
* collection_ids: ["profiles"],
|
|
261
383
|
* filters: {
|
|
262
384
|
* "metadata.user.preferences.theme": { $eq: "dark" }
|
|
263
385
|
* }
|
|
@@ -267,7 +389,7 @@ declare class NebulaClient {
|
|
|
267
389
|
* // Complex logical combinations
|
|
268
390
|
* await client.search({
|
|
269
391
|
* query: "candidates",
|
|
270
|
-
*
|
|
392
|
+
* collection_ids: ["hiring"],
|
|
271
393
|
* filters: {
|
|
272
394
|
* $and: [
|
|
273
395
|
* { "metadata.verified": true },
|
|
@@ -295,7 +417,7 @@ declare class NebulaClient {
|
|
|
295
417
|
*/
|
|
296
418
|
search(options: {
|
|
297
419
|
query: string;
|
|
298
|
-
|
|
420
|
+
collection_ids: string | string[];
|
|
299
421
|
limit?: number;
|
|
300
422
|
filters?: Record<string, any>;
|
|
301
423
|
search_mode?: 'fast' | 'super';
|
|
@@ -304,13 +426,13 @@ declare class NebulaClient {
|
|
|
304
426
|
/**
|
|
305
427
|
* Legacy wrapper: store a two-message conversation turn as a document
|
|
306
428
|
*/
|
|
307
|
-
storeConversation(userMessage: string, assistantMessage: string,
|
|
429
|
+
storeConversation(userMessage: string, assistantMessage: string, collectionId: string, sessionId: string): Promise<MemoryResponse>;
|
|
308
430
|
/**
|
|
309
431
|
* Legacy wrapper: search conversations optionally scoped by session
|
|
310
432
|
*/
|
|
311
|
-
searchConversations(query: string,
|
|
433
|
+
searchConversations(query: string, collectionId: string, sessionId?: string, includeAllSessions?: boolean): Promise<SearchResult[]>;
|
|
312
434
|
healthCheck(): Promise<Record<string, any>>;
|
|
313
|
-
private
|
|
435
|
+
private _collectionFromDict;
|
|
314
436
|
private _memoryResponseFromDict;
|
|
315
437
|
private _searchResultFromDict;
|
|
316
438
|
private _searchResultFromGraphDict;
|
|
@@ -318,4 +440,4 @@ declare class NebulaClient {
|
|
|
318
440
|
private _formDataFromObject;
|
|
319
441
|
}
|
|
320
442
|
|
|
321
|
-
export { type AgentResponse, type
|
|
443
|
+
export { type AgentResponse, type Chunk, type Collection, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type Memory, type MemoryResponse, NebulaAuthenticationException, NebulaClient, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type SearchOptions, type SearchResult };
|