@akumi/sdk 0.4.1 → 0.5.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 +63 -69
- package/dist/index.d.cts +31 -47
- package/dist/index.d.ts +31 -47
- package/dist/index.js +61 -67
- 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,9 +23,9 @@ __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
31
|
ModelsResource: () => ModelsResource,
|
|
@@ -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,6 +221,56 @@ function safeJsonParse(text) {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
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/models.ts
|
|
264
|
+
var ModelsResource = class {
|
|
265
|
+
constructor(transport) {
|
|
266
|
+
this.transport = transport;
|
|
267
|
+
}
|
|
268
|
+
transport;
|
|
269
|
+
async list() {
|
|
270
|
+
return this.transport.request("GET", "/models", null, null);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
224
274
|
// src/resources/recall.ts
|
|
225
275
|
var RecallResource = class {
|
|
226
276
|
constructor(transport) {
|
|
@@ -242,9 +292,6 @@ var RecallResource = class {
|
|
|
242
292
|
async search(params = {}) {
|
|
243
293
|
return this.transport.request("POST", "/recall/search", null, params);
|
|
244
294
|
}
|
|
245
|
-
async searchFacts(params = {}) {
|
|
246
|
-
return this.transport.request("POST", "/recall/facts/search", null, params);
|
|
247
|
-
}
|
|
248
295
|
async listFacts(query = {}) {
|
|
249
296
|
return this.transport.request("GET", "/recall/facts", query, null);
|
|
250
297
|
}
|
|
@@ -260,9 +307,6 @@ var RecallResource = class {
|
|
|
260
307
|
async erase() {
|
|
261
308
|
return this.transport.request("DELETE", "/recall", null, null);
|
|
262
309
|
}
|
|
263
|
-
async searchDocuments(params = {}) {
|
|
264
|
-
return this.transport.request("POST", "/recall/documents/search", null, params);
|
|
265
|
-
}
|
|
266
310
|
async listDocuments(query = {}) {
|
|
267
311
|
return this.transport.request("GET", "/recall/documents", query, null);
|
|
268
312
|
}
|
|
@@ -303,73 +347,23 @@ var ScoresResource = class {
|
|
|
303
347
|
}
|
|
304
348
|
};
|
|
305
349
|
|
|
306
|
-
// src/resources/auditLogs.ts
|
|
307
|
-
var AuditLogsResource = class {
|
|
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 {
|
|
322
|
-
constructor(transport) {
|
|
323
|
-
this.transport = transport;
|
|
324
|
-
}
|
|
325
|
-
transport;
|
|
326
|
-
async create(params = {}) {
|
|
327
|
-
return this.transport.request("POST", "/chat/completions", null, params);
|
|
328
|
-
}
|
|
329
|
-
async *createStreamed(params = {}) {
|
|
330
|
-
yield* this.transport.stream("POST", "/chat/completions", params);
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
// src/resources/embeddings.ts
|
|
335
|
-
var EmbeddingsResource = class {
|
|
336
|
-
constructor(transport) {
|
|
337
|
-
this.transport = transport;
|
|
338
|
-
}
|
|
339
|
-
transport;
|
|
340
|
-
async create(params = {}) {
|
|
341
|
-
return this.transport.request("POST", "/embeddings", null, params);
|
|
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);
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
|
|
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;
|
|
364
356
|
models;
|
|
357
|
+
recall;
|
|
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);
|
|
372
364
|
this.models = new ModelsResource(this.transport);
|
|
365
|
+
this.recall = new RecallResource(this.transport);
|
|
366
|
+
this.scores = new ScoresResource(this.transport);
|
|
373
367
|
}
|
|
374
368
|
static fromApiKey(apiKey) {
|
|
375
369
|
return new _Akumi({ apiKey });
|
|
@@ -380,9 +374,9 @@ 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,
|
|
388
382
|
ModelsResource,
|
package/dist/index.d.cts
CHANGED
|
@@ -18,6 +18,32 @@ declare class Transport {
|
|
|
18
18
|
private dispatch;
|
|
19
19
|
}
|
|
20
20
|
|
|
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 ModelsResource {
|
|
42
|
+
private readonly transport;
|
|
43
|
+
constructor(transport: Transport);
|
|
44
|
+
list(): Promise<Record<string, unknown>>;
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
declare class RecallResource {
|
|
22
48
|
private readonly transport;
|
|
23
49
|
constructor(transport: Transport);
|
|
@@ -26,13 +52,11 @@ declare class RecallResource {
|
|
|
26
52
|
getThread(thread: string): Promise<Record<string, unknown>>;
|
|
27
53
|
deleteThread(thread: string): Promise<Record<string, unknown>>;
|
|
28
54
|
search(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
29
|
-
searchFacts(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
30
55
|
listFacts(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
31
56
|
rememberFact(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
32
57
|
forgetFact(id: string): Promise<Record<string, unknown>>;
|
|
33
58
|
export(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
34
59
|
erase(): Promise<Record<string, unknown>>;
|
|
35
|
-
searchDocuments(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
36
60
|
listDocuments(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
37
61
|
ingestDocument(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
38
62
|
getDocument(document: string): Promise<Record<string, unknown>>;
|
|
@@ -50,40 +74,14 @@ declare class ScoresResource {
|
|
|
50
74
|
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
51
75
|
}
|
|
52
76
|
|
|
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 {
|
|
61
|
-
private readonly transport;
|
|
62
|
-
constructor(transport: Transport);
|
|
63
|
-
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
64
|
-
createStreamed(params?: Record<string, unknown>): AsyncGenerator<Record<string, unknown>>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
declare class EmbeddingsResource {
|
|
68
|
-
private readonly transport;
|
|
69
|
-
constructor(transport: Transport);
|
|
70
|
-
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
71
|
-
}
|
|
72
|
-
|
|
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;
|
|
86
82
|
readonly models: ModelsResource;
|
|
83
|
+
readonly recall: RecallResource;
|
|
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, ModelsResource, type PiiLanguage, RateLimitError, RecallResource, type RememberFactRequest, ScoresResource, type SearchRequest, type StoreCollectionRequest, type StoreScoreRequest, type ThreadMessageViewModel, type ThreadViewModel };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,32 @@ declare class Transport {
|
|
|
18
18
|
private dispatch;
|
|
19
19
|
}
|
|
20
20
|
|
|
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 ModelsResource {
|
|
42
|
+
private readonly transport;
|
|
43
|
+
constructor(transport: Transport);
|
|
44
|
+
list(): Promise<Record<string, unknown>>;
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
declare class RecallResource {
|
|
22
48
|
private readonly transport;
|
|
23
49
|
constructor(transport: Transport);
|
|
@@ -26,13 +52,11 @@ declare class RecallResource {
|
|
|
26
52
|
getThread(thread: string): Promise<Record<string, unknown>>;
|
|
27
53
|
deleteThread(thread: string): Promise<Record<string, unknown>>;
|
|
28
54
|
search(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
29
|
-
searchFacts(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
30
55
|
listFacts(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
31
56
|
rememberFact(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
32
57
|
forgetFact(id: string): Promise<Record<string, unknown>>;
|
|
33
58
|
export(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
34
59
|
erase(): Promise<Record<string, unknown>>;
|
|
35
|
-
searchDocuments(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
36
60
|
listDocuments(query?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
37
61
|
ingestDocument(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
38
62
|
getDocument(document: string): Promise<Record<string, unknown>>;
|
|
@@ -50,40 +74,14 @@ declare class ScoresResource {
|
|
|
50
74
|
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
51
75
|
}
|
|
52
76
|
|
|
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 {
|
|
61
|
-
private readonly transport;
|
|
62
|
-
constructor(transport: Transport);
|
|
63
|
-
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
64
|
-
createStreamed(params?: Record<string, unknown>): AsyncGenerator<Record<string, unknown>>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
declare class EmbeddingsResource {
|
|
68
|
-
private readonly transport;
|
|
69
|
-
constructor(transport: Transport);
|
|
70
|
-
create(params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
71
|
-
}
|
|
72
|
-
|
|
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;
|
|
86
82
|
readonly models: ModelsResource;
|
|
83
|
+
readonly recall: RecallResource;
|
|
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, ModelsResource, type PiiLanguage, RateLimitError, RecallResource, 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,6 +184,56 @@ function safeJsonParse(text) {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
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/models.ts
|
|
227
|
+
var ModelsResource = class {
|
|
228
|
+
constructor(transport) {
|
|
229
|
+
this.transport = transport;
|
|
230
|
+
}
|
|
231
|
+
transport;
|
|
232
|
+
async list() {
|
|
233
|
+
return this.transport.request("GET", "/models", null, null);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
187
237
|
// src/resources/recall.ts
|
|
188
238
|
var RecallResource = class {
|
|
189
239
|
constructor(transport) {
|
|
@@ -205,9 +255,6 @@ var RecallResource = class {
|
|
|
205
255
|
async search(params = {}) {
|
|
206
256
|
return this.transport.request("POST", "/recall/search", null, params);
|
|
207
257
|
}
|
|
208
|
-
async searchFacts(params = {}) {
|
|
209
|
-
return this.transport.request("POST", "/recall/facts/search", null, params);
|
|
210
|
-
}
|
|
211
258
|
async listFacts(query = {}) {
|
|
212
259
|
return this.transport.request("GET", "/recall/facts", query, null);
|
|
213
260
|
}
|
|
@@ -223,9 +270,6 @@ var RecallResource = class {
|
|
|
223
270
|
async erase() {
|
|
224
271
|
return this.transport.request("DELETE", "/recall", null, null);
|
|
225
272
|
}
|
|
226
|
-
async searchDocuments(params = {}) {
|
|
227
|
-
return this.transport.request("POST", "/recall/documents/search", null, params);
|
|
228
|
-
}
|
|
229
273
|
async listDocuments(query = {}) {
|
|
230
274
|
return this.transport.request("GET", "/recall/documents", query, null);
|
|
231
275
|
}
|
|
@@ -266,73 +310,23 @@ var ScoresResource = class {
|
|
|
266
310
|
}
|
|
267
311
|
};
|
|
268
312
|
|
|
269
|
-
// src/resources/auditLogs.ts
|
|
270
|
-
var AuditLogsResource = class {
|
|
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 {
|
|
285
|
-
constructor(transport) {
|
|
286
|
-
this.transport = transport;
|
|
287
|
-
}
|
|
288
|
-
transport;
|
|
289
|
-
async create(params = {}) {
|
|
290
|
-
return this.transport.request("POST", "/chat/completions", null, params);
|
|
291
|
-
}
|
|
292
|
-
async *createStreamed(params = {}) {
|
|
293
|
-
yield* this.transport.stream("POST", "/chat/completions", params);
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// src/resources/embeddings.ts
|
|
298
|
-
var EmbeddingsResource = class {
|
|
299
|
-
constructor(transport) {
|
|
300
|
-
this.transport = transport;
|
|
301
|
-
}
|
|
302
|
-
transport;
|
|
303
|
-
async create(params = {}) {
|
|
304
|
-
return this.transport.request("POST", "/embeddings", null, params);
|
|
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);
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
|
|
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;
|
|
327
319
|
models;
|
|
320
|
+
recall;
|
|
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);
|
|
335
327
|
this.models = new ModelsResource(this.transport);
|
|
328
|
+
this.recall = new RecallResource(this.transport);
|
|
329
|
+
this.scores = new ScoresResource(this.transport);
|
|
336
330
|
}
|
|
337
331
|
static fromApiKey(apiKey) {
|
|
338
332
|
return new _Akumi({ apiKey });
|
|
@@ -342,9 +336,9 @@ 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,
|
|
350
344
|
ModelsResource,
|