@akumi/sdk 0.4.2 → 0.6.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/README.md +5 -5
- package/dist/index.cjs +82 -88
- package/dist/index.d.cts +29 -45
- package/dist/index.d.ts +29 -45
- package/dist/index.js +79 -85
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Akumi TypeScript SDK
|
|
2
2
|
|
|
3
|
-
The official TypeScript client for [Akumi](https://akumi.
|
|
3
|
+
The official TypeScript client for [Akumi](https://akumi.eu), the
|
|
4
4
|
EU-sovereign, OpenAI-compatible inference API. Native `fetch`, zero runtime
|
|
5
5
|
dependencies. One `base_url` for every model, governed and metered, with your
|
|
6
6
|
regulated data kept in the EU.
|
|
@@ -22,7 +22,7 @@ npm install @akumi/sdk
|
|
|
22
22
|
|
|
23
23
|
## Quickstart
|
|
24
24
|
|
|
25
|
-
Create an API key under app.akumi.
|
|
25
|
+
Create an API key under app.akumi.eu -> Platform -> API keys:
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
import { Akumi } from "@akumi/sdk";
|
|
@@ -70,14 +70,14 @@ const vector = embeddings.data[0].embedding;
|
|
|
70
70
|
|
|
71
71
|
## Configuration
|
|
72
72
|
|
|
73
|
-
`fromApiKey()` targets `https://api.akumi.
|
|
73
|
+
`fromApiKey()` targets `https://api.akumi.eu/v1` and retries transient
|
|
74
74
|
failures (429, 502, 503, 504). Pass a config object to override the base URL,
|
|
75
75
|
timeout, or retry policy.
|
|
76
76
|
|
|
77
77
|
## Documentation
|
|
78
78
|
|
|
79
|
-
- Guides: https://akumi.
|
|
80
|
-
- API reference: https://akumi.
|
|
79
|
+
- Guides: https://docs.akumi.eu
|
|
80
|
+
- API reference: https://docs.akumi.eu/api-reference
|
|
81
81
|
|
|
82
82
|
## About
|
|
83
83
|
|
package/dist/index.cjs
CHANGED
|
@@ -23,14 +23,14 @@ __export(index_exports, {
|
|
|
23
23
|
Akumi: () => Akumi,
|
|
24
24
|
AkumiError: () => AkumiError,
|
|
25
25
|
ApiError: () => ApiError,
|
|
26
|
-
|
|
26
|
+
AuditLogResource: () => AuditLogResource,
|
|
27
27
|
AuthenticationError: () => AuthenticationError,
|
|
28
|
-
|
|
28
|
+
ChatCompletionsResource: () => ChatCompletionsResource,
|
|
29
29
|
EmbeddingsResource: () => EmbeddingsResource,
|
|
30
30
|
InvalidRequestError: () => InvalidRequestError,
|
|
31
|
+
MemoryResource: () => MemoryResource,
|
|
31
32
|
ModelsResource: () => ModelsResource,
|
|
32
33
|
RateLimitError: () => RateLimitError,
|
|
33
|
-
RecallResource: () => RecallResource,
|
|
34
34
|
ScoresResource: () => ScoresResource
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -112,7 +112,7 @@ function parseSseLine(line) {
|
|
|
112
112
|
function resolveConfig(config) {
|
|
113
113
|
return {
|
|
114
114
|
apiKey: config.apiKey,
|
|
115
|
-
baseUrl: config.baseUrl ?? "https://api.akumi.
|
|
115
|
+
baseUrl: config.baseUrl ?? "https://api.akumi.eu/v1",
|
|
116
116
|
maxRetries: config.maxRetries ?? 2,
|
|
117
117
|
retryOn: config.retryOn ?? [429, 500, 502, 503, 504]
|
|
118
118
|
};
|
|
@@ -221,155 +221,149 @@ function safeJsonParse(text) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
// src/resources/
|
|
225
|
-
var
|
|
224
|
+
// src/resources/auditLog.ts
|
|
225
|
+
var AuditLogResource = class {
|
|
226
|
+
constructor(transport) {
|
|
227
|
+
this.transport = transport;
|
|
228
|
+
}
|
|
229
|
+
transport;
|
|
230
|
+
async list(query = {}) {
|
|
231
|
+
return this.transport.request("GET", "/audit-logs", query, null);
|
|
232
|
+
}
|
|
233
|
+
async get(uuid) {
|
|
234
|
+
return this.transport.request("GET", `/audit-logs/${uuid}`, null, null);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// src/resources/chatCompletions.ts
|
|
239
|
+
var ChatCompletionsResource = class {
|
|
240
|
+
constructor(transport) {
|
|
241
|
+
this.transport = transport;
|
|
242
|
+
}
|
|
243
|
+
transport;
|
|
244
|
+
async create(params = {}) {
|
|
245
|
+
return this.transport.request("POST", "/chat/completions", null, params);
|
|
246
|
+
}
|
|
247
|
+
async *createStreamed(params = {}) {
|
|
248
|
+
yield* this.transport.stream("POST", "/chat/completions", params);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// src/resources/embeddings.ts
|
|
253
|
+
var EmbeddingsResource = class {
|
|
254
|
+
constructor(transport) {
|
|
255
|
+
this.transport = transport;
|
|
256
|
+
}
|
|
257
|
+
transport;
|
|
258
|
+
async create(params = {}) {
|
|
259
|
+
return this.transport.request("POST", "/embeddings", null, params);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
// src/resources/memory.ts
|
|
264
|
+
var MemoryResource = class {
|
|
226
265
|
constructor(transport) {
|
|
227
266
|
this.transport = transport;
|
|
228
267
|
}
|
|
229
268
|
transport;
|
|
230
269
|
async listThreads(query = {}) {
|
|
231
|
-
return this.transport.request("GET", "/
|
|
270
|
+
return this.transport.request("GET", "/memory/threads", query, null);
|
|
232
271
|
}
|
|
233
272
|
async createThread() {
|
|
234
|
-
return this.transport.request("POST", "/
|
|
273
|
+
return this.transport.request("POST", "/memory/threads", null, null);
|
|
235
274
|
}
|
|
236
275
|
async getThread(thread) {
|
|
237
|
-
return this.transport.request("GET", `/
|
|
276
|
+
return this.transport.request("GET", `/memory/threads/${thread}`, null, null);
|
|
238
277
|
}
|
|
239
278
|
async deleteThread(thread) {
|
|
240
|
-
return this.transport.request("DELETE", `/
|
|
279
|
+
return this.transport.request("DELETE", `/memory/threads/${thread}`, null, null);
|
|
241
280
|
}
|
|
242
281
|
async search(params = {}) {
|
|
243
|
-
return this.transport.request("POST", "/
|
|
244
|
-
}
|
|
245
|
-
async searchFacts(params = {}) {
|
|
246
|
-
return this.transport.request("POST", "/recall/facts/search", null, params);
|
|
282
|
+
return this.transport.request("POST", "/memory/search", null, params);
|
|
247
283
|
}
|
|
248
284
|
async listFacts(query = {}) {
|
|
249
|
-
return this.transport.request("GET", "/
|
|
285
|
+
return this.transport.request("GET", "/memory/facts", query, null);
|
|
250
286
|
}
|
|
251
287
|
async rememberFact(params = {}) {
|
|
252
|
-
return this.transport.request("POST", "/
|
|
288
|
+
return this.transport.request("POST", "/memory/facts", null, params);
|
|
253
289
|
}
|
|
254
290
|
async forgetFact(id) {
|
|
255
|
-
return this.transport.request("DELETE", `/
|
|
291
|
+
return this.transport.request("DELETE", `/memory/facts/${id}`, null, null);
|
|
256
292
|
}
|
|
257
293
|
async export(query = {}) {
|
|
258
|
-
return this.transport.request("GET", "/
|
|
294
|
+
return this.transport.request("GET", "/memory/export", query, null);
|
|
259
295
|
}
|
|
260
296
|
async erase() {
|
|
261
|
-
return this.transport.request("DELETE", "/
|
|
262
|
-
}
|
|
263
|
-
async searchDocuments(params = {}) {
|
|
264
|
-
return this.transport.request("POST", "/recall/documents/search", null, params);
|
|
297
|
+
return this.transport.request("DELETE", "/memory", null, null);
|
|
265
298
|
}
|
|
266
299
|
async listDocuments(query = {}) {
|
|
267
|
-
return this.transport.request("GET", "/
|
|
300
|
+
return this.transport.request("GET", "/memory/documents", query, null);
|
|
268
301
|
}
|
|
269
302
|
async ingestDocument(params = {}) {
|
|
270
|
-
return this.transport.request("POST", "/
|
|
303
|
+
return this.transport.request("POST", "/memory/documents", null, params);
|
|
271
304
|
}
|
|
272
305
|
async getDocument(document) {
|
|
273
|
-
return this.transport.request("GET", `/
|
|
306
|
+
return this.transport.request("GET", `/memory/documents/${document}`, null, null);
|
|
274
307
|
}
|
|
275
308
|
async deleteDocument(document) {
|
|
276
|
-
return this.transport.request("DELETE", `/
|
|
309
|
+
return this.transport.request("DELETE", `/memory/documents/${document}`, null, null);
|
|
277
310
|
}
|
|
278
311
|
async listCollections(query = {}) {
|
|
279
|
-
return this.transport.request("GET", "/
|
|
312
|
+
return this.transport.request("GET", "/memory/collections", query, null);
|
|
280
313
|
}
|
|
281
314
|
async createCollection(params = {}) {
|
|
282
|
-
return this.transport.request("POST", "/
|
|
315
|
+
return this.transport.request("POST", "/memory/collections", null, params);
|
|
283
316
|
}
|
|
284
317
|
async getCollection(slug) {
|
|
285
|
-
return this.transport.request("GET", `/
|
|
318
|
+
return this.transport.request("GET", `/memory/collections/${slug}`, null, null);
|
|
286
319
|
}
|
|
287
320
|
async deleteCollection(slug) {
|
|
288
|
-
return this.transport.request("DELETE", `/
|
|
321
|
+
return this.transport.request("DELETE", `/memory/collections/${slug}`, null, null);
|
|
289
322
|
}
|
|
290
323
|
async updateCollection(slug, params = {}) {
|
|
291
|
-
return this.transport.request("PATCH", `/
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
// src/resources/scores.ts
|
|
296
|
-
var ScoresResource = class {
|
|
297
|
-
constructor(transport) {
|
|
298
|
-
this.transport = transport;
|
|
299
|
-
}
|
|
300
|
-
transport;
|
|
301
|
-
async create(params = {}) {
|
|
302
|
-
return this.transport.request("POST", "/scores", null, params);
|
|
324
|
+
return this.transport.request("PATCH", `/memory/collections/${slug}`, null, params);
|
|
303
325
|
}
|
|
304
326
|
};
|
|
305
327
|
|
|
306
|
-
// src/resources/
|
|
307
|
-
var
|
|
308
|
-
constructor(transport) {
|
|
309
|
-
this.transport = transport;
|
|
310
|
-
}
|
|
311
|
-
transport;
|
|
312
|
-
async list(query = {}) {
|
|
313
|
-
return this.transport.request("GET", "/audit-logs", query, null);
|
|
314
|
-
}
|
|
315
|
-
async get(uuid) {
|
|
316
|
-
return this.transport.request("GET", `/audit-logs/${uuid}`, null, null);
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
// src/resources/chat.ts
|
|
321
|
-
var ChatResource = class {
|
|
328
|
+
// src/resources/models.ts
|
|
329
|
+
var ModelsResource = class {
|
|
322
330
|
constructor(transport) {
|
|
323
331
|
this.transport = transport;
|
|
324
332
|
}
|
|
325
333
|
transport;
|
|
326
|
-
async
|
|
327
|
-
return this.transport.request("
|
|
328
|
-
}
|
|
329
|
-
async *createStreamed(params = {}) {
|
|
330
|
-
yield* this.transport.stream("POST", "/chat/completions", params);
|
|
334
|
+
async list() {
|
|
335
|
+
return this.transport.request("GET", "/models", null, null);
|
|
331
336
|
}
|
|
332
337
|
};
|
|
333
338
|
|
|
334
|
-
// src/resources/
|
|
335
|
-
var
|
|
339
|
+
// src/resources/scores.ts
|
|
340
|
+
var ScoresResource = class {
|
|
336
341
|
constructor(transport) {
|
|
337
342
|
this.transport = transport;
|
|
338
343
|
}
|
|
339
344
|
transport;
|
|
340
345
|
async create(params = {}) {
|
|
341
|
-
return this.transport.request("POST", "/
|
|
342
|
-
}
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
// src/resources/models.ts
|
|
346
|
-
var ModelsResource = class {
|
|
347
|
-
constructor(transport) {
|
|
348
|
-
this.transport = transport;
|
|
349
|
-
}
|
|
350
|
-
transport;
|
|
351
|
-
async list() {
|
|
352
|
-
return this.transport.request("GET", "/models", null, null);
|
|
346
|
+
return this.transport.request("POST", "/scores", null, params);
|
|
353
347
|
}
|
|
354
348
|
};
|
|
355
349
|
|
|
356
350
|
// src/client.ts
|
|
357
351
|
var Akumi = class _Akumi {
|
|
358
352
|
transport;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
auditLogs;
|
|
362
|
-
chat;
|
|
353
|
+
auditLog;
|
|
354
|
+
chatCompletions;
|
|
363
355
|
embeddings;
|
|
356
|
+
memory;
|
|
364
357
|
models;
|
|
358
|
+
scores;
|
|
365
359
|
constructor(config) {
|
|
366
360
|
this.transport = new Transport(config);
|
|
367
|
-
this.
|
|
368
|
-
this.
|
|
369
|
-
this.auditLogs = new AuditLogsResource(this.transport);
|
|
370
|
-
this.chat = new ChatResource(this.transport);
|
|
361
|
+
this.auditLog = new AuditLogResource(this.transport);
|
|
362
|
+
this.chatCompletions = new ChatCompletionsResource(this.transport);
|
|
371
363
|
this.embeddings = new EmbeddingsResource(this.transport);
|
|
364
|
+
this.memory = new MemoryResource(this.transport);
|
|
372
365
|
this.models = new ModelsResource(this.transport);
|
|
366
|
+
this.scores = new ScoresResource(this.transport);
|
|
373
367
|
}
|
|
374
368
|
static fromApiKey(apiKey) {
|
|
375
369
|
return new _Akumi({ apiKey });
|
|
@@ -380,13 +374,13 @@ var Akumi = class _Akumi {
|
|
|
380
374
|
Akumi,
|
|
381
375
|
AkumiError,
|
|
382
376
|
ApiError,
|
|
383
|
-
|
|
377
|
+
AuditLogResource,
|
|
384
378
|
AuthenticationError,
|
|
385
|
-
|
|
379
|
+
ChatCompletionsResource,
|
|
386
380
|
EmbeddingsResource,
|
|
387
381
|
InvalidRequestError,
|
|
382
|
+
MemoryResource,
|
|
388
383
|
ModelsResource,
|
|
389
384
|
RateLimitError,
|
|
390
|
-
RecallResource,
|
|
391
385
|
ScoresResource
|
|
392
386
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,27 @@ declare class Transport {
|
|
|
18
18
|
private dispatch;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
declare class
|
|
21
|
+
declare class AuditLogResource {
|
|
22
|
+
private readonly transport;
|
|
23
|
+
constructor(transport: Transport);
|
|
24
|
+
list(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
25
|
+
get(uuid: string): Promise<Record<string, unknown>>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class ChatCompletionsResource {
|
|
29
|
+
private readonly transport;
|
|
30
|
+
constructor(transport: Transport);
|
|
31
|
+
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
32
|
+
createStreamed(params?: Record<string, unknown>): AsyncGenerator<Record<string, unknown>>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class EmbeddingsResource {
|
|
36
|
+
private readonly transport;
|
|
37
|
+
constructor(transport: Transport);
|
|
38
|
+
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare class MemoryResource {
|
|
22
42
|
private readonly transport;
|
|
23
43
|
constructor(transport: Transport);
|
|
24
44
|
listThreads(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -26,13 +46,11 @@ declare class RecallResource {
|
|
|
26
46
|
getThread(thread: string): Promise<Record<string, unknown>>;
|
|
27
47
|
deleteThread(thread: string): Promise<Record<string, unknown>>;
|
|
28
48
|
search(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
29
|
-
searchFacts(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
30
49
|
listFacts(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
31
50
|
rememberFact(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
32
51
|
forgetFact(id: string): Promise<Record<string, unknown>>;
|
|
33
52
|
export(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
34
53
|
erase(): Promise<Record<string, unknown>>;
|
|
35
|
-
searchDocuments(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
36
54
|
listDocuments(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
37
55
|
ingestDocument(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
38
56
|
getDocument(document: string): Promise<Record<string, unknown>>;
|
|
@@ -44,46 +62,26 @@ declare class RecallResource {
|
|
|
44
62
|
updateCollection(slug: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
45
63
|
}
|
|
46
64
|
|
|
47
|
-
declare class
|
|
48
|
-
private readonly transport;
|
|
49
|
-
constructor(transport: Transport);
|
|
50
|
-
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare class AuditLogsResource {
|
|
54
|
-
private readonly transport;
|
|
55
|
-
constructor(transport: Transport);
|
|
56
|
-
list(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
57
|
-
get(uuid: string): Promise<Record<string, unknown>>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare class ChatResource {
|
|
65
|
+
declare class ModelsResource {
|
|
61
66
|
private readonly transport;
|
|
62
67
|
constructor(transport: Transport);
|
|
63
|
-
|
|
64
|
-
createStreamed(params?: Record<string, unknown>): AsyncGenerator<Record<string, unknown>>;
|
|
68
|
+
list(): Promise<Record<string, unknown>>;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
declare class
|
|
71
|
+
declare class ScoresResource {
|
|
68
72
|
private readonly transport;
|
|
69
73
|
constructor(transport: Transport);
|
|
70
74
|
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
declare class ModelsResource {
|
|
74
|
-
private readonly transport;
|
|
75
|
-
constructor(transport: Transport);
|
|
76
|
-
list(): Promise<Record<string, unknown>>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
77
|
declare class Akumi {
|
|
80
78
|
private readonly transport;
|
|
81
|
-
readonly
|
|
82
|
-
readonly
|
|
83
|
-
readonly auditLogs: AuditLogsResource;
|
|
84
|
-
readonly chat: ChatResource;
|
|
79
|
+
readonly auditLog: AuditLogResource;
|
|
80
|
+
readonly chatCompletions: ChatCompletionsResource;
|
|
85
81
|
readonly embeddings: EmbeddingsResource;
|
|
82
|
+
readonly memory: MemoryResource;
|
|
86
83
|
readonly models: ModelsResource;
|
|
84
|
+
readonly scores: ScoresResource;
|
|
87
85
|
constructor(config: ClientConfig);
|
|
88
86
|
static fromApiKey(apiKey: string): Akumi;
|
|
89
87
|
}
|
|
@@ -171,20 +169,6 @@ interface RememberFactRequest {
|
|
|
171
169
|
user_ref: string;
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
interface SearchDocumentsRequest {
|
|
175
|
-
query: string;
|
|
176
|
-
collection: string[];
|
|
177
|
-
user_ref?: string | null;
|
|
178
|
-
limit?: number | null;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
interface SearchFactsRequest {
|
|
182
|
-
query: string;
|
|
183
|
-
collection?: string[] | null;
|
|
184
|
-
user_ref?: string | null;
|
|
185
|
-
limit?: number | null;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
172
|
interface SearchRequest {
|
|
189
173
|
query: string;
|
|
190
174
|
collection?: string[] | null;
|
|
@@ -210,4 +194,4 @@ interface ThreadMessageViewModel {
|
|
|
210
194
|
interface ThreadViewModel {
|
|
211
195
|
}
|
|
212
196
|
|
|
213
|
-
export { Akumi, AkumiError, ApiError, type AuditLogApiResource,
|
|
197
|
+
export { Akumi, AkumiError, ApiError, type AuditLogApiResource, AuditLogResource, AuthenticationError, type ChatCompletionsRequest, ChatCompletionsResource, type ClientConfig, type EmbeddingsRequest, EmbeddingsResource, type IngestDocumentRequest, InvalidRequestError, MemoryResource, ModelsResource, type PiiLanguage, RateLimitError, type RememberFactRequest, ScoresResource, type SearchRequest, type StoreCollectionRequest, type StoreScoreRequest, type ThreadMessageViewModel, type ThreadViewModel };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,27 @@ declare class Transport {
|
|
|
18
18
|
private dispatch;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
declare class
|
|
21
|
+
declare class AuditLogResource {
|
|
22
|
+
private readonly transport;
|
|
23
|
+
constructor(transport: Transport);
|
|
24
|
+
list(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
25
|
+
get(uuid: string): Promise<Record<string, unknown>>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class ChatCompletionsResource {
|
|
29
|
+
private readonly transport;
|
|
30
|
+
constructor(transport: Transport);
|
|
31
|
+
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
32
|
+
createStreamed(params?: Record<string, unknown>): AsyncGenerator<Record<string, unknown>>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class EmbeddingsResource {
|
|
36
|
+
private readonly transport;
|
|
37
|
+
constructor(transport: Transport);
|
|
38
|
+
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare class MemoryResource {
|
|
22
42
|
private readonly transport;
|
|
23
43
|
constructor(transport: Transport);
|
|
24
44
|
listThreads(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
@@ -26,13 +46,11 @@ declare class RecallResource {
|
|
|
26
46
|
getThread(thread: string): Promise<Record<string, unknown>>;
|
|
27
47
|
deleteThread(thread: string): Promise<Record<string, unknown>>;
|
|
28
48
|
search(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
29
|
-
searchFacts(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
30
49
|
listFacts(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
31
50
|
rememberFact(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
32
51
|
forgetFact(id: string): Promise<Record<string, unknown>>;
|
|
33
52
|
export(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
34
53
|
erase(): Promise<Record<string, unknown>>;
|
|
35
|
-
searchDocuments(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
36
54
|
listDocuments(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
37
55
|
ingestDocument(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
38
56
|
getDocument(document: string): Promise<Record<string, unknown>>;
|
|
@@ -44,46 +62,26 @@ declare class RecallResource {
|
|
|
44
62
|
updateCollection(slug: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
45
63
|
}
|
|
46
64
|
|
|
47
|
-
declare class
|
|
48
|
-
private readonly transport;
|
|
49
|
-
constructor(transport: Transport);
|
|
50
|
-
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
declare class AuditLogsResource {
|
|
54
|
-
private readonly transport;
|
|
55
|
-
constructor(transport: Transport);
|
|
56
|
-
list(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
57
|
-
get(uuid: string): Promise<Record<string, unknown>>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
declare class ChatResource {
|
|
65
|
+
declare class ModelsResource {
|
|
61
66
|
private readonly transport;
|
|
62
67
|
constructor(transport: Transport);
|
|
63
|
-
|
|
64
|
-
createStreamed(params?: Record<string, unknown>): AsyncGenerator<Record<string, unknown>>;
|
|
68
|
+
list(): Promise<Record<string, unknown>>;
|
|
65
69
|
}
|
|
66
70
|
|
|
67
|
-
declare class
|
|
71
|
+
declare class ScoresResource {
|
|
68
72
|
private readonly transport;
|
|
69
73
|
constructor(transport: Transport);
|
|
70
74
|
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
declare class ModelsResource {
|
|
74
|
-
private readonly transport;
|
|
75
|
-
constructor(transport: Transport);
|
|
76
|
-
list(): Promise<Record<string, unknown>>;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
77
|
declare class Akumi {
|
|
80
78
|
private readonly transport;
|
|
81
|
-
readonly
|
|
82
|
-
readonly
|
|
83
|
-
readonly auditLogs: AuditLogsResource;
|
|
84
|
-
readonly chat: ChatResource;
|
|
79
|
+
readonly auditLog: AuditLogResource;
|
|
80
|
+
readonly chatCompletions: ChatCompletionsResource;
|
|
85
81
|
readonly embeddings: EmbeddingsResource;
|
|
82
|
+
readonly memory: MemoryResource;
|
|
86
83
|
readonly models: ModelsResource;
|
|
84
|
+
readonly scores: ScoresResource;
|
|
87
85
|
constructor(config: ClientConfig);
|
|
88
86
|
static fromApiKey(apiKey: string): Akumi;
|
|
89
87
|
}
|
|
@@ -171,20 +169,6 @@ interface RememberFactRequest {
|
|
|
171
169
|
user_ref: string;
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
interface SearchDocumentsRequest {
|
|
175
|
-
query: string;
|
|
176
|
-
collection: string[];
|
|
177
|
-
user_ref?: string | null;
|
|
178
|
-
limit?: number | null;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
interface SearchFactsRequest {
|
|
182
|
-
query: string;
|
|
183
|
-
collection?: string[] | null;
|
|
184
|
-
user_ref?: string | null;
|
|
185
|
-
limit?: number | null;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
172
|
interface SearchRequest {
|
|
189
173
|
query: string;
|
|
190
174
|
collection?: string[] | null;
|
|
@@ -210,4 +194,4 @@ interface ThreadMessageViewModel {
|
|
|
210
194
|
interface ThreadViewModel {
|
|
211
195
|
}
|
|
212
196
|
|
|
213
|
-
export { Akumi, AkumiError, ApiError, type AuditLogApiResource,
|
|
197
|
+
export { Akumi, AkumiError, ApiError, type AuditLogApiResource, AuditLogResource, AuthenticationError, type ChatCompletionsRequest, ChatCompletionsResource, type ClientConfig, type EmbeddingsRequest, EmbeddingsResource, type IngestDocumentRequest, InvalidRequestError, MemoryResource, ModelsResource, type PiiLanguage, RateLimitError, type RememberFactRequest, ScoresResource, type SearchRequest, type StoreCollectionRequest, type StoreScoreRequest, type ThreadMessageViewModel, type ThreadViewModel };
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ function parseSseLine(line) {
|
|
|
75
75
|
function resolveConfig(config) {
|
|
76
76
|
return {
|
|
77
77
|
apiKey: config.apiKey,
|
|
78
|
-
baseUrl: config.baseUrl ?? "https://api.akumi.
|
|
78
|
+
baseUrl: config.baseUrl ?? "https://api.akumi.eu/v1",
|
|
79
79
|
maxRetries: config.maxRetries ?? 2,
|
|
80
80
|
retryOn: config.retryOn ?? [429, 500, 502, 503, 504]
|
|
81
81
|
};
|
|
@@ -184,155 +184,149 @@ function safeJsonParse(text) {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
// src/resources/
|
|
188
|
-
var
|
|
187
|
+
// src/resources/auditLog.ts
|
|
188
|
+
var AuditLogResource = class {
|
|
189
|
+
constructor(transport) {
|
|
190
|
+
this.transport = transport;
|
|
191
|
+
}
|
|
192
|
+
transport;
|
|
193
|
+
async list(query = {}) {
|
|
194
|
+
return this.transport.request("GET", "/audit-logs", query, null);
|
|
195
|
+
}
|
|
196
|
+
async get(uuid) {
|
|
197
|
+
return this.transport.request("GET", `/audit-logs/${uuid}`, null, null);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// src/resources/chatCompletions.ts
|
|
202
|
+
var ChatCompletionsResource = class {
|
|
203
|
+
constructor(transport) {
|
|
204
|
+
this.transport = transport;
|
|
205
|
+
}
|
|
206
|
+
transport;
|
|
207
|
+
async create(params = {}) {
|
|
208
|
+
return this.transport.request("POST", "/chat/completions", null, params);
|
|
209
|
+
}
|
|
210
|
+
async *createStreamed(params = {}) {
|
|
211
|
+
yield* this.transport.stream("POST", "/chat/completions", params);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// src/resources/embeddings.ts
|
|
216
|
+
var EmbeddingsResource = class {
|
|
217
|
+
constructor(transport) {
|
|
218
|
+
this.transport = transport;
|
|
219
|
+
}
|
|
220
|
+
transport;
|
|
221
|
+
async create(params = {}) {
|
|
222
|
+
return this.transport.request("POST", "/embeddings", null, params);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
// src/resources/memory.ts
|
|
227
|
+
var MemoryResource = class {
|
|
189
228
|
constructor(transport) {
|
|
190
229
|
this.transport = transport;
|
|
191
230
|
}
|
|
192
231
|
transport;
|
|
193
232
|
async listThreads(query = {}) {
|
|
194
|
-
return this.transport.request("GET", "/
|
|
233
|
+
return this.transport.request("GET", "/memory/threads", query, null);
|
|
195
234
|
}
|
|
196
235
|
async createThread() {
|
|
197
|
-
return this.transport.request("POST", "/
|
|
236
|
+
return this.transport.request("POST", "/memory/threads", null, null);
|
|
198
237
|
}
|
|
199
238
|
async getThread(thread) {
|
|
200
|
-
return this.transport.request("GET", `/
|
|
239
|
+
return this.transport.request("GET", `/memory/threads/${thread}`, null, null);
|
|
201
240
|
}
|
|
202
241
|
async deleteThread(thread) {
|
|
203
|
-
return this.transport.request("DELETE", `/
|
|
242
|
+
return this.transport.request("DELETE", `/memory/threads/${thread}`, null, null);
|
|
204
243
|
}
|
|
205
244
|
async search(params = {}) {
|
|
206
|
-
return this.transport.request("POST", "/
|
|
207
|
-
}
|
|
208
|
-
async searchFacts(params = {}) {
|
|
209
|
-
return this.transport.request("POST", "/recall/facts/search", null, params);
|
|
245
|
+
return this.transport.request("POST", "/memory/search", null, params);
|
|
210
246
|
}
|
|
211
247
|
async listFacts(query = {}) {
|
|
212
|
-
return this.transport.request("GET", "/
|
|
248
|
+
return this.transport.request("GET", "/memory/facts", query, null);
|
|
213
249
|
}
|
|
214
250
|
async rememberFact(params = {}) {
|
|
215
|
-
return this.transport.request("POST", "/
|
|
251
|
+
return this.transport.request("POST", "/memory/facts", null, params);
|
|
216
252
|
}
|
|
217
253
|
async forgetFact(id) {
|
|
218
|
-
return this.transport.request("DELETE", `/
|
|
254
|
+
return this.transport.request("DELETE", `/memory/facts/${id}`, null, null);
|
|
219
255
|
}
|
|
220
256
|
async export(query = {}) {
|
|
221
|
-
return this.transport.request("GET", "/
|
|
257
|
+
return this.transport.request("GET", "/memory/export", query, null);
|
|
222
258
|
}
|
|
223
259
|
async erase() {
|
|
224
|
-
return this.transport.request("DELETE", "/
|
|
225
|
-
}
|
|
226
|
-
async searchDocuments(params = {}) {
|
|
227
|
-
return this.transport.request("POST", "/recall/documents/search", null, params);
|
|
260
|
+
return this.transport.request("DELETE", "/memory", null, null);
|
|
228
261
|
}
|
|
229
262
|
async listDocuments(query = {}) {
|
|
230
|
-
return this.transport.request("GET", "/
|
|
263
|
+
return this.transport.request("GET", "/memory/documents", query, null);
|
|
231
264
|
}
|
|
232
265
|
async ingestDocument(params = {}) {
|
|
233
|
-
return this.transport.request("POST", "/
|
|
266
|
+
return this.transport.request("POST", "/memory/documents", null, params);
|
|
234
267
|
}
|
|
235
268
|
async getDocument(document) {
|
|
236
|
-
return this.transport.request("GET", `/
|
|
269
|
+
return this.transport.request("GET", `/memory/documents/${document}`, null, null);
|
|
237
270
|
}
|
|
238
271
|
async deleteDocument(document) {
|
|
239
|
-
return this.transport.request("DELETE", `/
|
|
272
|
+
return this.transport.request("DELETE", `/memory/documents/${document}`, null, null);
|
|
240
273
|
}
|
|
241
274
|
async listCollections(query = {}) {
|
|
242
|
-
return this.transport.request("GET", "/
|
|
275
|
+
return this.transport.request("GET", "/memory/collections", query, null);
|
|
243
276
|
}
|
|
244
277
|
async createCollection(params = {}) {
|
|
245
|
-
return this.transport.request("POST", "/
|
|
278
|
+
return this.transport.request("POST", "/memory/collections", null, params);
|
|
246
279
|
}
|
|
247
280
|
async getCollection(slug) {
|
|
248
|
-
return this.transport.request("GET", `/
|
|
281
|
+
return this.transport.request("GET", `/memory/collections/${slug}`, null, null);
|
|
249
282
|
}
|
|
250
283
|
async deleteCollection(slug) {
|
|
251
|
-
return this.transport.request("DELETE", `/
|
|
284
|
+
return this.transport.request("DELETE", `/memory/collections/${slug}`, null, null);
|
|
252
285
|
}
|
|
253
286
|
async updateCollection(slug, params = {}) {
|
|
254
|
-
return this.transport.request("PATCH", `/
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// src/resources/scores.ts
|
|
259
|
-
var ScoresResource = class {
|
|
260
|
-
constructor(transport) {
|
|
261
|
-
this.transport = transport;
|
|
262
|
-
}
|
|
263
|
-
transport;
|
|
264
|
-
async create(params = {}) {
|
|
265
|
-
return this.transport.request("POST", "/scores", null, params);
|
|
287
|
+
return this.transport.request("PATCH", `/memory/collections/${slug}`, null, params);
|
|
266
288
|
}
|
|
267
289
|
};
|
|
268
290
|
|
|
269
|
-
// src/resources/
|
|
270
|
-
var
|
|
271
|
-
constructor(transport) {
|
|
272
|
-
this.transport = transport;
|
|
273
|
-
}
|
|
274
|
-
transport;
|
|
275
|
-
async list(query = {}) {
|
|
276
|
-
return this.transport.request("GET", "/audit-logs", query, null);
|
|
277
|
-
}
|
|
278
|
-
async get(uuid) {
|
|
279
|
-
return this.transport.request("GET", `/audit-logs/${uuid}`, null, null);
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// src/resources/chat.ts
|
|
284
|
-
var ChatResource = class {
|
|
291
|
+
// src/resources/models.ts
|
|
292
|
+
var ModelsResource = class {
|
|
285
293
|
constructor(transport) {
|
|
286
294
|
this.transport = transport;
|
|
287
295
|
}
|
|
288
296
|
transport;
|
|
289
|
-
async
|
|
290
|
-
return this.transport.request("
|
|
291
|
-
}
|
|
292
|
-
async *createStreamed(params = {}) {
|
|
293
|
-
yield* this.transport.stream("POST", "/chat/completions", params);
|
|
297
|
+
async list() {
|
|
298
|
+
return this.transport.request("GET", "/models", null, null);
|
|
294
299
|
}
|
|
295
300
|
};
|
|
296
301
|
|
|
297
|
-
// src/resources/
|
|
298
|
-
var
|
|
302
|
+
// src/resources/scores.ts
|
|
303
|
+
var ScoresResource = class {
|
|
299
304
|
constructor(transport) {
|
|
300
305
|
this.transport = transport;
|
|
301
306
|
}
|
|
302
307
|
transport;
|
|
303
308
|
async create(params = {}) {
|
|
304
|
-
return this.transport.request("POST", "/
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
// src/resources/models.ts
|
|
309
|
-
var ModelsResource = class {
|
|
310
|
-
constructor(transport) {
|
|
311
|
-
this.transport = transport;
|
|
312
|
-
}
|
|
313
|
-
transport;
|
|
314
|
-
async list() {
|
|
315
|
-
return this.transport.request("GET", "/models", null, null);
|
|
309
|
+
return this.transport.request("POST", "/scores", null, params);
|
|
316
310
|
}
|
|
317
311
|
};
|
|
318
312
|
|
|
319
313
|
// src/client.ts
|
|
320
314
|
var Akumi = class _Akumi {
|
|
321
315
|
transport;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
auditLogs;
|
|
325
|
-
chat;
|
|
316
|
+
auditLog;
|
|
317
|
+
chatCompletions;
|
|
326
318
|
embeddings;
|
|
319
|
+
memory;
|
|
327
320
|
models;
|
|
321
|
+
scores;
|
|
328
322
|
constructor(config) {
|
|
329
323
|
this.transport = new Transport(config);
|
|
330
|
-
this.
|
|
331
|
-
this.
|
|
332
|
-
this.auditLogs = new AuditLogsResource(this.transport);
|
|
333
|
-
this.chat = new ChatResource(this.transport);
|
|
324
|
+
this.auditLog = new AuditLogResource(this.transport);
|
|
325
|
+
this.chatCompletions = new ChatCompletionsResource(this.transport);
|
|
334
326
|
this.embeddings = new EmbeddingsResource(this.transport);
|
|
327
|
+
this.memory = new MemoryResource(this.transport);
|
|
335
328
|
this.models = new ModelsResource(this.transport);
|
|
329
|
+
this.scores = new ScoresResource(this.transport);
|
|
336
330
|
}
|
|
337
331
|
static fromApiKey(apiKey) {
|
|
338
332
|
return new _Akumi({ apiKey });
|
|
@@ -342,13 +336,13 @@ export {
|
|
|
342
336
|
Akumi,
|
|
343
337
|
AkumiError,
|
|
344
338
|
ApiError,
|
|
345
|
-
|
|
339
|
+
AuditLogResource,
|
|
346
340
|
AuthenticationError,
|
|
347
|
-
|
|
341
|
+
ChatCompletionsResource,
|
|
348
342
|
EmbeddingsResource,
|
|
349
343
|
InvalidRequestError,
|
|
344
|
+
MemoryResource,
|
|
350
345
|
ModelsResource,
|
|
351
346
|
RateLimitError,
|
|
352
|
-
RecallResource,
|
|
353
347
|
ScoresResource
|
|
354
348
|
};
|