@nebula-ai/sdk 1.1.29 → 1.1.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/dist/index.d.mts +16 -14
- package/dist/index.d.ts +16 -14
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -130,12 +130,13 @@ interface ActivatedFacet {
|
|
|
130
130
|
interface ActivatedKnowledge {
|
|
131
131
|
id?: string;
|
|
132
132
|
category?: string;
|
|
133
|
+
description?: string;
|
|
133
134
|
entity_id?: string;
|
|
134
135
|
entity_name?: string;
|
|
135
136
|
facet_name?: string;
|
|
136
|
-
subject
|
|
137
|
-
predicate
|
|
138
|
-
value
|
|
137
|
+
subject?: string;
|
|
138
|
+
predicate?: string;
|
|
139
|
+
value?: string;
|
|
139
140
|
activation_score: number;
|
|
140
141
|
extraction_confidence?: number;
|
|
141
142
|
corroboration_count?: number;
|
|
@@ -145,7 +146,7 @@ interface ActivatedKnowledge {
|
|
|
145
146
|
resolved_at?: string;
|
|
146
147
|
source_nodegroup_ids?: string[];
|
|
147
148
|
}
|
|
148
|
-
interface
|
|
149
|
+
interface GroundedSource {
|
|
149
150
|
id?: string;
|
|
150
151
|
text: string;
|
|
151
152
|
activation_score: number;
|
|
@@ -160,12 +161,13 @@ interface GroundedUtterance {
|
|
|
160
161
|
}
|
|
161
162
|
interface ActivatedEpisode {
|
|
162
163
|
id?: string;
|
|
163
|
-
name
|
|
164
|
+
name?: string;
|
|
165
|
+
description?: string;
|
|
164
166
|
activation_score: number;
|
|
165
167
|
status?: string;
|
|
166
168
|
t_start?: number;
|
|
167
169
|
t_last?: number;
|
|
168
|
-
n_facts
|
|
170
|
+
n_facts?: number;
|
|
169
171
|
member_knowledge_ids?: string[];
|
|
170
172
|
source_chunk_ids?: string[];
|
|
171
173
|
entity_names?: string[];
|
|
@@ -175,7 +177,7 @@ interface MemoryResponse {
|
|
|
175
177
|
entities: ActivatedEntity[];
|
|
176
178
|
knowledge: ActivatedKnowledge[];
|
|
177
179
|
episodes?: ActivatedEpisode[];
|
|
178
|
-
|
|
180
|
+
sources: GroundedSource[];
|
|
179
181
|
total_traversal_time_ms?: number;
|
|
180
182
|
token_count?: number;
|
|
181
183
|
}
|
|
@@ -303,16 +305,16 @@ declare class Nebula {
|
|
|
303
305
|
};
|
|
304
306
|
};
|
|
305
307
|
}>;
|
|
306
|
-
/** Delete a specific
|
|
307
|
-
|
|
308
|
-
/** Update a specific
|
|
309
|
-
|
|
308
|
+
/** Delete a specific source within a memory */
|
|
309
|
+
deleteSource(sourceId: string): Promise<boolean>;
|
|
310
|
+
/** Update a specific source within a memory */
|
|
311
|
+
updateSource(sourceId: string, content: string, metadata?: Record<string, unknown>): Promise<boolean>;
|
|
310
312
|
/**
|
|
311
313
|
* Update memory-level properties including name, metadata, and collection associations.
|
|
312
314
|
*
|
|
313
315
|
* This method allows updating properties of an entire memory (document or conversation)
|
|
314
|
-
* without modifying its content. For updating individual
|
|
315
|
-
* use
|
|
316
|
+
* without modifying its content. For updating individual sources within a memory,
|
|
317
|
+
* use updateSource(). For updating content, use storeMemory() to append.
|
|
316
318
|
*
|
|
317
319
|
* @param options - Update configuration
|
|
318
320
|
* @param options.memoryId - The ID of the memory to update
|
|
@@ -545,4 +547,4 @@ type MemoryFactory = {
|
|
|
545
547
|
declare const Memory: MemoryFactory;
|
|
546
548
|
type Memory = Memory$1;
|
|
547
549
|
|
|
548
|
-
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedKnowledge, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type
|
|
550
|
+
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedKnowledge, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type GroundedSource, Memory, type MemoryResponse, type MultimodalContentPart, Nebula, NebulaAuthenticationException, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaContent, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type S3FileReferencePart, type SearchOptions, type SearchResult, type StructuredChunk, type TextContentPart, Nebula as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -130,12 +130,13 @@ interface ActivatedFacet {
|
|
|
130
130
|
interface ActivatedKnowledge {
|
|
131
131
|
id?: string;
|
|
132
132
|
category?: string;
|
|
133
|
+
description?: string;
|
|
133
134
|
entity_id?: string;
|
|
134
135
|
entity_name?: string;
|
|
135
136
|
facet_name?: string;
|
|
136
|
-
subject
|
|
137
|
-
predicate
|
|
138
|
-
value
|
|
137
|
+
subject?: string;
|
|
138
|
+
predicate?: string;
|
|
139
|
+
value?: string;
|
|
139
140
|
activation_score: number;
|
|
140
141
|
extraction_confidence?: number;
|
|
141
142
|
corroboration_count?: number;
|
|
@@ -145,7 +146,7 @@ interface ActivatedKnowledge {
|
|
|
145
146
|
resolved_at?: string;
|
|
146
147
|
source_nodegroup_ids?: string[];
|
|
147
148
|
}
|
|
148
|
-
interface
|
|
149
|
+
interface GroundedSource {
|
|
149
150
|
id?: string;
|
|
150
151
|
text: string;
|
|
151
152
|
activation_score: number;
|
|
@@ -160,12 +161,13 @@ interface GroundedUtterance {
|
|
|
160
161
|
}
|
|
161
162
|
interface ActivatedEpisode {
|
|
162
163
|
id?: string;
|
|
163
|
-
name
|
|
164
|
+
name?: string;
|
|
165
|
+
description?: string;
|
|
164
166
|
activation_score: number;
|
|
165
167
|
status?: string;
|
|
166
168
|
t_start?: number;
|
|
167
169
|
t_last?: number;
|
|
168
|
-
n_facts
|
|
170
|
+
n_facts?: number;
|
|
169
171
|
member_knowledge_ids?: string[];
|
|
170
172
|
source_chunk_ids?: string[];
|
|
171
173
|
entity_names?: string[];
|
|
@@ -175,7 +177,7 @@ interface MemoryResponse {
|
|
|
175
177
|
entities: ActivatedEntity[];
|
|
176
178
|
knowledge: ActivatedKnowledge[];
|
|
177
179
|
episodes?: ActivatedEpisode[];
|
|
178
|
-
|
|
180
|
+
sources: GroundedSource[];
|
|
179
181
|
total_traversal_time_ms?: number;
|
|
180
182
|
token_count?: number;
|
|
181
183
|
}
|
|
@@ -303,16 +305,16 @@ declare class Nebula {
|
|
|
303
305
|
};
|
|
304
306
|
};
|
|
305
307
|
}>;
|
|
306
|
-
/** Delete a specific
|
|
307
|
-
|
|
308
|
-
/** Update a specific
|
|
309
|
-
|
|
308
|
+
/** Delete a specific source within a memory */
|
|
309
|
+
deleteSource(sourceId: string): Promise<boolean>;
|
|
310
|
+
/** Update a specific source within a memory */
|
|
311
|
+
updateSource(sourceId: string, content: string, metadata?: Record<string, unknown>): Promise<boolean>;
|
|
310
312
|
/**
|
|
311
313
|
* Update memory-level properties including name, metadata, and collection associations.
|
|
312
314
|
*
|
|
313
315
|
* This method allows updating properties of an entire memory (document or conversation)
|
|
314
|
-
* without modifying its content. For updating individual
|
|
315
|
-
* use
|
|
316
|
+
* without modifying its content. For updating individual sources within a memory,
|
|
317
|
+
* use updateSource(). For updating content, use storeMemory() to append.
|
|
316
318
|
*
|
|
317
319
|
* @param options - Update configuration
|
|
318
320
|
* @param options.memoryId - The ID of the memory to update
|
|
@@ -545,4 +547,4 @@ type MemoryFactory = {
|
|
|
545
547
|
declare const Memory: MemoryFactory;
|
|
546
548
|
type Memory = Memory$1;
|
|
547
549
|
|
|
548
|
-
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedKnowledge, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type
|
|
550
|
+
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedKnowledge, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type GroundedSource, Memory, type MemoryResponse, type MultimodalContentPart, Nebula, NebulaAuthenticationException, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaContent, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type S3FileReferencePart, type SearchOptions, type SearchResult, type StructuredChunk, type TextContentPart, Nebula as default };
|
package/dist/index.js
CHANGED
|
@@ -183,7 +183,7 @@ var _Nebula = class _Nebula {
|
|
|
183
183
|
return await this._processContentParts(normalized);
|
|
184
184
|
}
|
|
185
185
|
/** Make an HTTP request to the Nebula API */
|
|
186
|
-
async _makeRequest(method, endpoint, jsonData, params) {
|
|
186
|
+
async _makeRequest(method, endpoint, jsonData, params, extraHeaders) {
|
|
187
187
|
const url = new URL(endpoint, this.baseUrl);
|
|
188
188
|
if (params) {
|
|
189
189
|
Object.entries(params).forEach(([key, value]) => {
|
|
@@ -198,7 +198,7 @@ var _Nebula = class _Nebula {
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
const headers = this._buildAuthHeaders(true);
|
|
201
|
+
const headers = { ...this._buildAuthHeaders(true), ...extraHeaders };
|
|
202
202
|
const controller = new AbortController();
|
|
203
203
|
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
204
204
|
try {
|
|
@@ -578,30 +578,30 @@ var _Nebula = class _Nebula {
|
|
|
578
578
|
throw new NebulaClientException(`Unknown error: ${String(error)}`);
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
/** Delete a specific
|
|
582
|
-
async
|
|
581
|
+
/** Delete a specific source within a memory */
|
|
582
|
+
async deleteSource(sourceId) {
|
|
583
583
|
try {
|
|
584
|
-
await this._makeRequest("DELETE", `/v1/
|
|
584
|
+
await this._makeRequest("DELETE", `/v1/sources/${sourceId}`);
|
|
585
585
|
return true;
|
|
586
586
|
} catch (error) {
|
|
587
587
|
if (error instanceof NebulaException && error.statusCode === 404) {
|
|
588
|
-
throw new NebulaNotFoundException(
|
|
588
|
+
throw new NebulaNotFoundException(sourceId, "Source");
|
|
589
589
|
}
|
|
590
590
|
throw error;
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
|
-
/** Update a specific
|
|
594
|
-
async
|
|
593
|
+
/** Update a specific source within a memory */
|
|
594
|
+
async updateSource(sourceId, content, metadata) {
|
|
595
595
|
const payload = { content };
|
|
596
596
|
if (metadata !== void 0) {
|
|
597
597
|
payload.metadata = metadata;
|
|
598
598
|
}
|
|
599
599
|
try {
|
|
600
|
-
await this._makeRequest("PATCH", `/v1/
|
|
600
|
+
await this._makeRequest("PATCH", `/v1/sources/${sourceId}`, payload);
|
|
601
601
|
return true;
|
|
602
602
|
} catch (error) {
|
|
603
603
|
if (error instanceof NebulaException && error.statusCode === 404) {
|
|
604
|
-
throw new NebulaNotFoundException(
|
|
604
|
+
throw new NebulaNotFoundException(sourceId, "Source");
|
|
605
605
|
}
|
|
606
606
|
throw error;
|
|
607
607
|
}
|
|
@@ -610,8 +610,8 @@ var _Nebula = class _Nebula {
|
|
|
610
610
|
* Update memory-level properties including name, metadata, and collection associations.
|
|
611
611
|
*
|
|
612
612
|
* This method allows updating properties of an entire memory (document or conversation)
|
|
613
|
-
* without modifying its content. For updating individual
|
|
614
|
-
* use
|
|
613
|
+
* without modifying its content. For updating individual sources within a memory,
|
|
614
|
+
* use updateSource(). For updating content, use storeMemory() to append.
|
|
615
615
|
*
|
|
616
616
|
* @param options - Update configuration
|
|
617
617
|
* @param options.memoryId - The ID of the memory to update
|
|
@@ -830,8 +830,8 @@ var _Nebula = class _Nebula {
|
|
|
830
830
|
data.effort = options.effort;
|
|
831
831
|
}
|
|
832
832
|
if (options.collection_ids) {
|
|
833
|
-
const
|
|
834
|
-
const validCollectionIds =
|
|
833
|
+
const collectionIds2 = Array.isArray(options.collection_ids) ? options.collection_ids : [options.collection_ids];
|
|
834
|
+
const validCollectionIds = collectionIds2.filter((id) => id && id.trim() !== "");
|
|
835
835
|
if (validCollectionIds.length) {
|
|
836
836
|
data.collection_ids = validCollectionIds;
|
|
837
837
|
}
|
|
@@ -842,14 +842,16 @@ var _Nebula = class _Nebula {
|
|
|
842
842
|
if (options.searchSettings) {
|
|
843
843
|
data.search_settings = options.searchSettings;
|
|
844
844
|
}
|
|
845
|
-
const
|
|
845
|
+
const collectionIds = data.collection_ids;
|
|
846
|
+
const extraHeaders = collectionIds && collectionIds.length === 1 ? { "X-Nebula-Collection-Id": collectionIds[0] } : void 0;
|
|
847
|
+
const response = await this._makeRequest("POST", "/v1/memories/search", data, void 0, extraHeaders);
|
|
846
848
|
const memoryResponseData = response.results;
|
|
847
849
|
const memoryResponse = {
|
|
848
850
|
query: memoryResponseData.query || options.query,
|
|
849
851
|
entities: memoryResponseData.entities || [],
|
|
850
|
-
knowledge: memoryResponseData.knowledge ??
|
|
852
|
+
knowledge: memoryResponseData.knowledge ?? [],
|
|
851
853
|
episodes: memoryResponseData.episodes || [],
|
|
852
|
-
|
|
854
|
+
sources: memoryResponseData.sources || [],
|
|
853
855
|
total_traversal_time_ms: memoryResponseData.total_traversal_time_ms,
|
|
854
856
|
token_count: memoryResponseData.token_count
|
|
855
857
|
};
|