@nebula-ai/sdk 1.1.30 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +20 -11
- package/dist/index.d.ts +20 -11
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -123,19 +123,20 @@ interface ActivatedFacet {
|
|
|
123
123
|
facet_id: string;
|
|
124
124
|
facet_name: string;
|
|
125
125
|
relevance_score: number;
|
|
126
|
-
facts:
|
|
126
|
+
facts: ActivatedSemantic[];
|
|
127
127
|
coherence_score?: number;
|
|
128
128
|
is_noise: boolean;
|
|
129
129
|
}
|
|
130
|
-
interface
|
|
130
|
+
interface ActivatedSemantic {
|
|
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;
|
|
@@ -160,22 +161,30 @@ interface GroundedSource {
|
|
|
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
|
|
169
|
-
|
|
170
|
+
n_facts?: number;
|
|
171
|
+
member_semantic_ids?: string[];
|
|
170
172
|
source_chunk_ids?: string[];
|
|
171
173
|
entity_names?: string[];
|
|
172
174
|
}
|
|
175
|
+
interface ActivatedProcedure {
|
|
176
|
+
statement: string;
|
|
177
|
+
activation_score: number;
|
|
178
|
+
confidence: number;
|
|
179
|
+
is_negated?: boolean;
|
|
180
|
+
}
|
|
173
181
|
interface MemoryResponse {
|
|
174
182
|
query: string;
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
semantics: ActivatedSemantic[];
|
|
184
|
+
procedures?: ActivatedProcedure[];
|
|
177
185
|
episodes?: ActivatedEpisode[];
|
|
178
186
|
sources: GroundedSource[];
|
|
187
|
+
entities: ActivatedEntity[];
|
|
179
188
|
total_traversal_time_ms?: number;
|
|
180
189
|
token_count?: number;
|
|
181
190
|
}
|
|
@@ -545,4 +554,4 @@ type MemoryFactory = {
|
|
|
545
554
|
declare const Memory: MemoryFactory;
|
|
546
555
|
type Memory = Memory$1;
|
|
547
556
|
|
|
548
|
-
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type
|
|
557
|
+
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedProcedure, type ActivatedSemantic, 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
|
@@ -123,19 +123,20 @@ interface ActivatedFacet {
|
|
|
123
123
|
facet_id: string;
|
|
124
124
|
facet_name: string;
|
|
125
125
|
relevance_score: number;
|
|
126
|
-
facts:
|
|
126
|
+
facts: ActivatedSemantic[];
|
|
127
127
|
coherence_score?: number;
|
|
128
128
|
is_noise: boolean;
|
|
129
129
|
}
|
|
130
|
-
interface
|
|
130
|
+
interface ActivatedSemantic {
|
|
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;
|
|
@@ -160,22 +161,30 @@ interface GroundedSource {
|
|
|
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
|
|
169
|
-
|
|
170
|
+
n_facts?: number;
|
|
171
|
+
member_semantic_ids?: string[];
|
|
170
172
|
source_chunk_ids?: string[];
|
|
171
173
|
entity_names?: string[];
|
|
172
174
|
}
|
|
175
|
+
interface ActivatedProcedure {
|
|
176
|
+
statement: string;
|
|
177
|
+
activation_score: number;
|
|
178
|
+
confidence: number;
|
|
179
|
+
is_negated?: boolean;
|
|
180
|
+
}
|
|
173
181
|
interface MemoryResponse {
|
|
174
182
|
query: string;
|
|
175
|
-
|
|
176
|
-
|
|
183
|
+
semantics: ActivatedSemantic[];
|
|
184
|
+
procedures?: ActivatedProcedure[];
|
|
177
185
|
episodes?: ActivatedEpisode[];
|
|
178
186
|
sources: GroundedSource[];
|
|
187
|
+
entities: ActivatedEntity[];
|
|
179
188
|
total_traversal_time_ms?: number;
|
|
180
189
|
token_count?: number;
|
|
181
190
|
}
|
|
@@ -545,4 +554,4 @@ type MemoryFactory = {
|
|
|
545
554
|
declare const Memory: MemoryFactory;
|
|
546
555
|
type Memory = Memory$1;
|
|
547
556
|
|
|
548
|
-
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type
|
|
557
|
+
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedProcedure, type ActivatedSemantic, 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 {
|
|
@@ -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,16 +842,19 @@ 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
|
-
|
|
850
|
-
|
|
851
|
+
semantics: memoryResponseData.semantics || memoryResponseData.knowledge || [],
|
|
852
|
+
procedures: memoryResponseData.procedures || [],
|
|
851
853
|
episodes: memoryResponseData.episodes || [],
|
|
852
|
-
sources: memoryResponseData.sources ||
|
|
854
|
+
sources: memoryResponseData.sources || [],
|
|
853
855
|
total_traversal_time_ms: memoryResponseData.total_traversal_time_ms,
|
|
854
|
-
token_count: memoryResponseData.token_count
|
|
856
|
+
token_count: memoryResponseData.token_count,
|
|
857
|
+
entities: memoryResponseData.entities || []
|
|
855
858
|
};
|
|
856
859
|
return memoryResponse;
|
|
857
860
|
}
|