@nebula-ai/sdk 0.0.19
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/LICENSE +26 -0
- package/README.md +448 -0
- package/dist/index.d.mts +218 -0
- package/dist/index.d.ts +218 -0
- package/dist/index.js +664 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +651 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +66 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
declare enum RetrievalType {
|
|
2
|
+
BASIC = "basic",
|
|
3
|
+
ADVANCED = "advanced",
|
|
4
|
+
CUSTOM = "custom"
|
|
5
|
+
}
|
|
6
|
+
declare enum GraphSearchResultType {
|
|
7
|
+
ENTITY = "entity",
|
|
8
|
+
RELATIONSHIP = "relationship",
|
|
9
|
+
COMMUNITY = "community"
|
|
10
|
+
}
|
|
11
|
+
interface MemoryResponse {
|
|
12
|
+
id: string;
|
|
13
|
+
content?: string;
|
|
14
|
+
chunks?: string[];
|
|
15
|
+
metadata: Record<string, any>;
|
|
16
|
+
cluster_ids: string[];
|
|
17
|
+
created_at?: string;
|
|
18
|
+
updated_at?: string;
|
|
19
|
+
}
|
|
20
|
+
interface Memory {
|
|
21
|
+
cluster_id: string;
|
|
22
|
+
content: string;
|
|
23
|
+
role?: string;
|
|
24
|
+
parent_id?: string;
|
|
25
|
+
metadata: Record<string, any>;
|
|
26
|
+
}
|
|
27
|
+
interface Cluster {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
metadata: Record<string, any>;
|
|
32
|
+
created_at?: string;
|
|
33
|
+
updated_at?: string;
|
|
34
|
+
memory_count: number;
|
|
35
|
+
owner_id?: string;
|
|
36
|
+
}
|
|
37
|
+
interface SearchResult {
|
|
38
|
+
id: string;
|
|
39
|
+
score: number;
|
|
40
|
+
metadata: Record<string, any>;
|
|
41
|
+
source?: string;
|
|
42
|
+
content?: string;
|
|
43
|
+
graph_result_type?: GraphSearchResultType;
|
|
44
|
+
graph_entity?: GraphEntityResult;
|
|
45
|
+
graph_relationship?: GraphRelationshipResult;
|
|
46
|
+
graph_community?: GraphCommunityResult;
|
|
47
|
+
chunk_ids?: string[];
|
|
48
|
+
}
|
|
49
|
+
interface GraphEntityResult {
|
|
50
|
+
id?: string;
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
metadata: Record<string, any>;
|
|
54
|
+
}
|
|
55
|
+
interface GraphRelationshipResult {
|
|
56
|
+
id?: string;
|
|
57
|
+
subject: string;
|
|
58
|
+
predicate: string;
|
|
59
|
+
object: string;
|
|
60
|
+
subject_id?: string;
|
|
61
|
+
object_id?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
metadata: Record<string, any>;
|
|
64
|
+
}
|
|
65
|
+
interface GraphCommunityResult {
|
|
66
|
+
id?: string;
|
|
67
|
+
name: string;
|
|
68
|
+
summary: string;
|
|
69
|
+
metadata: Record<string, any>;
|
|
70
|
+
}
|
|
71
|
+
interface AgentResponse {
|
|
72
|
+
content: string;
|
|
73
|
+
agent_id: string;
|
|
74
|
+
conversation_id?: string;
|
|
75
|
+
metadata: Record<string, any>;
|
|
76
|
+
citations: Record<string, any>[];
|
|
77
|
+
}
|
|
78
|
+
interface SearchOptions {
|
|
79
|
+
limit: number;
|
|
80
|
+
filters?: Record<string, any>;
|
|
81
|
+
retrieval_type: RetrievalType;
|
|
82
|
+
}
|
|
83
|
+
interface NebulaSDKConfig {
|
|
84
|
+
apiKey: string;
|
|
85
|
+
baseUrl?: string;
|
|
86
|
+
timeout?: number;
|
|
87
|
+
}
|
|
88
|
+
declare class NebulaException extends Error {
|
|
89
|
+
statusCode?: number | undefined;
|
|
90
|
+
details?: any;
|
|
91
|
+
constructor(message: string, statusCode?: number | undefined, details?: any);
|
|
92
|
+
}
|
|
93
|
+
declare class NebulaClientException extends NebulaException {
|
|
94
|
+
cause?: Error | undefined;
|
|
95
|
+
constructor(message: string, cause?: Error | undefined);
|
|
96
|
+
}
|
|
97
|
+
declare class NebulaAuthenticationException extends NebulaException {
|
|
98
|
+
constructor(message?: string);
|
|
99
|
+
}
|
|
100
|
+
declare class NebulaRateLimitException extends NebulaException {
|
|
101
|
+
constructor(message?: string);
|
|
102
|
+
}
|
|
103
|
+
declare class NebulaValidationException extends NebulaException {
|
|
104
|
+
details?: any;
|
|
105
|
+
constructor(message?: string, details?: any);
|
|
106
|
+
}
|
|
107
|
+
declare class NebulaClusterNotFoundException extends NebulaException {
|
|
108
|
+
constructor(message?: string);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Official Nebula Cloud JavaScript/TypeScript SDK
|
|
113
|
+
* Mirrors the exact Nebula Python SDK client.py implementation
|
|
114
|
+
*/
|
|
115
|
+
declare class NebulaSDK {
|
|
116
|
+
private apiKey;
|
|
117
|
+
private baseUrl;
|
|
118
|
+
private timeout;
|
|
119
|
+
constructor(config: NebulaSDKConfig);
|
|
120
|
+
/**
|
|
121
|
+
* Check if API key is set
|
|
122
|
+
*/
|
|
123
|
+
isApiKeySet(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Detect if a token looks like a Nebula API key (public.raw)
|
|
126
|
+
*/
|
|
127
|
+
private _isNebulaApiKey;
|
|
128
|
+
/**
|
|
129
|
+
* Build authentication headers
|
|
130
|
+
*/
|
|
131
|
+
private _buildAuthHeaders;
|
|
132
|
+
/**
|
|
133
|
+
* Make an HTTP request to the Nebula API
|
|
134
|
+
*/
|
|
135
|
+
private _makeRequest;
|
|
136
|
+
/**
|
|
137
|
+
* Create a new cluster
|
|
138
|
+
*/
|
|
139
|
+
createCluster(name: string, description?: string, metadata?: Record<string, any>): Promise<Cluster>;
|
|
140
|
+
/**
|
|
141
|
+
* Get a specific cluster by ID
|
|
142
|
+
*/
|
|
143
|
+
getCluster(clusterId: string): Promise<Cluster>;
|
|
144
|
+
/**
|
|
145
|
+
* Get a specific cluster by name
|
|
146
|
+
*/
|
|
147
|
+
getClusterByName(name: string): Promise<Cluster>;
|
|
148
|
+
/**
|
|
149
|
+
* Get all clusters
|
|
150
|
+
*/
|
|
151
|
+
listClusters(limit?: number, offset?: number): Promise<Cluster[]>;
|
|
152
|
+
/**
|
|
153
|
+
* List conversations for the authenticated user
|
|
154
|
+
*/
|
|
155
|
+
listConversations(limit?: number, offset?: number): Promise<any[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Update a cluster
|
|
158
|
+
*/
|
|
159
|
+
updateCluster(clusterId: string, name?: string, description?: string, metadata?: Record<string, any>): Promise<Cluster>;
|
|
160
|
+
/**
|
|
161
|
+
* Delete a cluster
|
|
162
|
+
*/
|
|
163
|
+
deleteCluster(clusterId: string): Promise<boolean>;
|
|
164
|
+
/**
|
|
165
|
+
* Store a single memory
|
|
166
|
+
*/
|
|
167
|
+
storeMemory(memory: Memory | Record<string, any>): Promise<string>;
|
|
168
|
+
/**
|
|
169
|
+
* Store multiple memories
|
|
170
|
+
*/
|
|
171
|
+
storeMemories(memories: Memory[]): Promise<string[]>;
|
|
172
|
+
/**
|
|
173
|
+
* Delete a specific memory
|
|
174
|
+
*/
|
|
175
|
+
delete(memoryId: string): Promise<boolean>;
|
|
176
|
+
/**
|
|
177
|
+
* Get all memories from specific clusters
|
|
178
|
+
*/
|
|
179
|
+
listMemories(clusterIds: string[], limit?: number, offset?: number): Promise<MemoryResponse[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Get a specific memory by ID
|
|
182
|
+
*/
|
|
183
|
+
getMemory(memoryId: string): Promise<MemoryResponse>;
|
|
184
|
+
/**
|
|
185
|
+
* Search within specific clusters
|
|
186
|
+
*/
|
|
187
|
+
search(query: string, clusterIds: string[], limit?: number, retrievalType?: RetrievalType | string, filters?: Record<string, any>, searchSettings?: Record<string, any>): Promise<SearchResult[]>;
|
|
188
|
+
/**
|
|
189
|
+
* Check the health of the Nebula API
|
|
190
|
+
*/
|
|
191
|
+
healthCheck(): Promise<Record<string, any>>;
|
|
192
|
+
/**
|
|
193
|
+
* Convert cluster dict to Cluster object
|
|
194
|
+
*/
|
|
195
|
+
private _clusterFromDict;
|
|
196
|
+
/**
|
|
197
|
+
* Convert memory dict to MemoryResponse object
|
|
198
|
+
*/
|
|
199
|
+
private _memoryResponseFromDict;
|
|
200
|
+
/**
|
|
201
|
+
* Convert search result dict to SearchResult object
|
|
202
|
+
*/
|
|
203
|
+
private _searchResultFromDict;
|
|
204
|
+
/**
|
|
205
|
+
* Convert graph search result dict to SearchResult object
|
|
206
|
+
*/
|
|
207
|
+
private _searchResultFromGraphDict;
|
|
208
|
+
/**
|
|
209
|
+
* SHA-256 hash function
|
|
210
|
+
*/
|
|
211
|
+
private _sha256;
|
|
212
|
+
/**
|
|
213
|
+
* Convert object to FormData
|
|
214
|
+
*/
|
|
215
|
+
private _formDataFromObject;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { type AgentResponse, type Cluster, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type Memory, type MemoryResponse, NebulaAuthenticationException, NebulaClientException, NebulaClusterNotFoundException, NebulaException, NebulaRateLimitException, NebulaSDK, type NebulaSDKConfig, NebulaValidationException, RetrievalType, type SearchOptions, type SearchResult, NebulaSDK as default };
|