antarya 0.1.1 → 0.1.2
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.cjs +15 -6
- package/dist/index.d.cts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.js +15 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -312,6 +312,15 @@ var Chat = class {
|
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
|
|
315
|
+
// src/resources/paging.ts
|
|
316
|
+
function pageQuery(p) {
|
|
317
|
+
const q = new URLSearchParams();
|
|
318
|
+
if (p.limit !== void 0) q.set("limit", String(p.limit));
|
|
319
|
+
if (p.after !== void 0 && p.after !== "") q.set("after", p.after);
|
|
320
|
+
const s = q.toString();
|
|
321
|
+
return s ? `?${s}` : "";
|
|
322
|
+
}
|
|
323
|
+
|
|
315
324
|
// src/resources/files.ts
|
|
316
325
|
var isPathStream = (f) => !!f && typeof f === "object" && typeof f.path === "string" && Symbol.asyncIterator in f;
|
|
317
326
|
var baseName = (p) => p.split(/[\\/]/).filter(Boolean).pop() ?? "file";
|
|
@@ -340,14 +349,14 @@ var Files = class {
|
|
|
340
349
|
form.append("file", blob, name ?? "file");
|
|
341
350
|
return await this.client.request("POST", "/files", { form, signal: opts.signal });
|
|
342
351
|
}
|
|
343
|
-
async list(opts = {}) {
|
|
344
|
-
return await this.client.request("GET",
|
|
352
|
+
async list(params = {}, opts = {}) {
|
|
353
|
+
return await this.client.request("GET", `/files${pageQuery(params)}`, { signal: opts.signal });
|
|
345
354
|
}
|
|
346
355
|
async get(id, opts = {}) {
|
|
347
356
|
return await this.client.request("GET", `/files/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
348
357
|
}
|
|
349
358
|
async delete(id, opts = {}) {
|
|
350
|
-
return this.client.request("DELETE", `/files/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
359
|
+
return await this.client.request("DELETE", `/files/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
351
360
|
}
|
|
352
361
|
};
|
|
353
362
|
|
|
@@ -374,14 +383,14 @@ var Sessions = class {
|
|
|
374
383
|
async create(p = {}, opts = {}) {
|
|
375
384
|
return await this.client.request("POST", "/sessions", { body: p, signal: opts.signal });
|
|
376
385
|
}
|
|
377
|
-
async list(opts = {}) {
|
|
378
|
-
return await this.client.request("GET",
|
|
386
|
+
async list(params = {}, opts = {}) {
|
|
387
|
+
return await this.client.request("GET", `/sessions${pageQuery(params)}`, { signal: opts.signal });
|
|
379
388
|
}
|
|
380
389
|
async get(id, opts = {}) {
|
|
381
390
|
return await this.client.request("GET", `/sessions/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
382
391
|
}
|
|
383
392
|
async delete(id, opts = {}) {
|
|
384
|
-
return this.client.request("DELETE", `/sessions/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
393
|
+
return await this.client.request("DELETE", `/sessions/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
385
394
|
}
|
|
386
395
|
};
|
|
387
396
|
|
package/dist/index.d.cts
CHANGED
|
@@ -208,7 +208,21 @@ interface SessionObject {
|
|
|
208
208
|
object: "session";
|
|
209
209
|
created_at: string;
|
|
210
210
|
updated_at: string;
|
|
211
|
-
|
|
211
|
+
metadata: Record<string, string>;
|
|
212
|
+
}
|
|
213
|
+
/** A saved conversation with its messages, oldest first, as `sessions.get` returns it. */
|
|
214
|
+
interface SessionWithMessages extends SessionObject {
|
|
215
|
+
messages: Message[];
|
|
216
|
+
}
|
|
217
|
+
/** Paging parameters for list calls: `limit` (1 to 100, default 20) and `after` (an id from the list). */
|
|
218
|
+
interface ListParams {
|
|
219
|
+
limit?: number;
|
|
220
|
+
after?: string;
|
|
221
|
+
}
|
|
222
|
+
/** What a delete returns. */
|
|
223
|
+
interface DeletedObject {
|
|
224
|
+
id: string;
|
|
225
|
+
deleted: true;
|
|
212
226
|
}
|
|
213
227
|
/** A chat request without the transport flag; `stream` is chosen by the method you call. */
|
|
214
228
|
type ChatParams = Omit<ChatRequest, "stream">;
|
|
@@ -229,6 +243,7 @@ type BatchResultLine = {
|
|
|
229
243
|
interface List<T> {
|
|
230
244
|
object: "list";
|
|
231
245
|
data: T[];
|
|
246
|
+
has_more: boolean;
|
|
232
247
|
}
|
|
233
248
|
|
|
234
249
|
declare class Batches {
|
|
@@ -317,9 +332,9 @@ declare class Files {
|
|
|
317
332
|
private readonly client;
|
|
318
333
|
constructor(client: Antarya);
|
|
319
334
|
create(p: CreateFileParams, opts?: CallOptions): Promise<FileObject>;
|
|
320
|
-
list(opts?: CallOptions): Promise<List<FileObject>>;
|
|
335
|
+
list(params?: ListParams, opts?: CallOptions): Promise<List<FileObject>>;
|
|
321
336
|
get(id: string, opts?: CallOptions): Promise<FileObject>;
|
|
322
|
-
delete(id: string, opts?: CallOptions): Promise<
|
|
337
|
+
delete(id: string, opts?: CallOptions): Promise<DeletedObject>;
|
|
323
338
|
}
|
|
324
339
|
|
|
325
340
|
declare class Models {
|
|
@@ -335,9 +350,9 @@ declare class Sessions {
|
|
|
335
350
|
create(p?: {
|
|
336
351
|
metadata?: Record<string, string>;
|
|
337
352
|
}, opts?: CallOptions): Promise<SessionObject>;
|
|
338
|
-
list(opts?: CallOptions): Promise<List<SessionObject>>;
|
|
339
|
-
get(id: string, opts?: CallOptions): Promise<
|
|
340
|
-
delete(id: string, opts?: CallOptions): Promise<
|
|
353
|
+
list(params?: ListParams, opts?: CallOptions): Promise<List<SessionObject>>;
|
|
354
|
+
get(id: string, opts?: CallOptions): Promise<SessionWithMessages>;
|
|
355
|
+
delete(id: string, opts?: CallOptions): Promise<DeletedObject>;
|
|
341
356
|
}
|
|
342
357
|
|
|
343
358
|
interface ClientOptions {
|
|
@@ -394,4 +409,4 @@ declare class Antarya {
|
|
|
394
409
|
}
|
|
395
410
|
|
|
396
411
|
export { APIConnectionError, APIError, APITimeoutError, ARTIFACT_KINDS, Antarya, AuthenticationError, BadRequestError, ChatStream, InternalServerError, NotFoundError, OverloadedError, PermissionDeniedError, RateLimitError, RequestTooLargeError, Antarya as default, errorFrom };
|
|
397
|
-
export type { ArtifactPart, BatchObject, BatchRequestItem, BatchResultLine, CallOptions, ChatParams, ChatReply, ChatRequest, ClientOptions, CreateFileParams, FileInput, FileObject, FilePart, ImagePart, InlineFilePart, List, Message, ModelObject, Part, ReplyPart, RequestOptions, ResponseFormat, SessionObject, StopReason, StreamEvent, TextPart, ThinkingNote, ToolCallPart, ToolChoice, ToolDef, ToolResultPart, Usage };
|
|
412
|
+
export type { ArtifactPart, BatchObject, BatchRequestItem, BatchResultLine, CallOptions, ChatParams, ChatReply, ChatRequest, ClientOptions, CreateFileParams, DeletedObject, FileInput, FileObject, FilePart, ImagePart, InlineFilePart, List, ListParams, Message, ModelObject, Part, ReplyPart, RequestOptions, ResponseFormat, SessionObject, SessionWithMessages, StopReason, StreamEvent, TextPart, ThinkingNote, ToolCallPart, ToolChoice, ToolDef, ToolResultPart, Usage };
|
package/dist/index.d.ts
CHANGED
|
@@ -208,7 +208,21 @@ interface SessionObject {
|
|
|
208
208
|
object: "session";
|
|
209
209
|
created_at: string;
|
|
210
210
|
updated_at: string;
|
|
211
|
-
|
|
211
|
+
metadata: Record<string, string>;
|
|
212
|
+
}
|
|
213
|
+
/** A saved conversation with its messages, oldest first, as `sessions.get` returns it. */
|
|
214
|
+
interface SessionWithMessages extends SessionObject {
|
|
215
|
+
messages: Message[];
|
|
216
|
+
}
|
|
217
|
+
/** Paging parameters for list calls: `limit` (1 to 100, default 20) and `after` (an id from the list). */
|
|
218
|
+
interface ListParams {
|
|
219
|
+
limit?: number;
|
|
220
|
+
after?: string;
|
|
221
|
+
}
|
|
222
|
+
/** What a delete returns. */
|
|
223
|
+
interface DeletedObject {
|
|
224
|
+
id: string;
|
|
225
|
+
deleted: true;
|
|
212
226
|
}
|
|
213
227
|
/** A chat request without the transport flag; `stream` is chosen by the method you call. */
|
|
214
228
|
type ChatParams = Omit<ChatRequest, "stream">;
|
|
@@ -229,6 +243,7 @@ type BatchResultLine = {
|
|
|
229
243
|
interface List<T> {
|
|
230
244
|
object: "list";
|
|
231
245
|
data: T[];
|
|
246
|
+
has_more: boolean;
|
|
232
247
|
}
|
|
233
248
|
|
|
234
249
|
declare class Batches {
|
|
@@ -317,9 +332,9 @@ declare class Files {
|
|
|
317
332
|
private readonly client;
|
|
318
333
|
constructor(client: Antarya);
|
|
319
334
|
create(p: CreateFileParams, opts?: CallOptions): Promise<FileObject>;
|
|
320
|
-
list(opts?: CallOptions): Promise<List<FileObject>>;
|
|
335
|
+
list(params?: ListParams, opts?: CallOptions): Promise<List<FileObject>>;
|
|
321
336
|
get(id: string, opts?: CallOptions): Promise<FileObject>;
|
|
322
|
-
delete(id: string, opts?: CallOptions): Promise<
|
|
337
|
+
delete(id: string, opts?: CallOptions): Promise<DeletedObject>;
|
|
323
338
|
}
|
|
324
339
|
|
|
325
340
|
declare class Models {
|
|
@@ -335,9 +350,9 @@ declare class Sessions {
|
|
|
335
350
|
create(p?: {
|
|
336
351
|
metadata?: Record<string, string>;
|
|
337
352
|
}, opts?: CallOptions): Promise<SessionObject>;
|
|
338
|
-
list(opts?: CallOptions): Promise<List<SessionObject>>;
|
|
339
|
-
get(id: string, opts?: CallOptions): Promise<
|
|
340
|
-
delete(id: string, opts?: CallOptions): Promise<
|
|
353
|
+
list(params?: ListParams, opts?: CallOptions): Promise<List<SessionObject>>;
|
|
354
|
+
get(id: string, opts?: CallOptions): Promise<SessionWithMessages>;
|
|
355
|
+
delete(id: string, opts?: CallOptions): Promise<DeletedObject>;
|
|
341
356
|
}
|
|
342
357
|
|
|
343
358
|
interface ClientOptions {
|
|
@@ -394,4 +409,4 @@ declare class Antarya {
|
|
|
394
409
|
}
|
|
395
410
|
|
|
396
411
|
export { APIConnectionError, APIError, APITimeoutError, ARTIFACT_KINDS, Antarya, AuthenticationError, BadRequestError, ChatStream, InternalServerError, NotFoundError, OverloadedError, PermissionDeniedError, RateLimitError, RequestTooLargeError, Antarya as default, errorFrom };
|
|
397
|
-
export type { ArtifactPart, BatchObject, BatchRequestItem, BatchResultLine, CallOptions, ChatParams, ChatReply, ChatRequest, ClientOptions, CreateFileParams, FileInput, FileObject, FilePart, ImagePart, InlineFilePart, List, Message, ModelObject, Part, ReplyPart, RequestOptions, ResponseFormat, SessionObject, StopReason, StreamEvent, TextPart, ThinkingNote, ToolCallPart, ToolChoice, ToolDef, ToolResultPart, Usage };
|
|
412
|
+
export type { ArtifactPart, BatchObject, BatchRequestItem, BatchResultLine, CallOptions, ChatParams, ChatReply, ChatRequest, ClientOptions, CreateFileParams, DeletedObject, FileInput, FileObject, FilePart, ImagePart, InlineFilePart, List, ListParams, Message, ModelObject, Part, ReplyPart, RequestOptions, ResponseFormat, SessionObject, SessionWithMessages, StopReason, StreamEvent, TextPart, ThinkingNote, ToolCallPart, ToolChoice, ToolDef, ToolResultPart, Usage };
|
package/dist/index.js
CHANGED
|
@@ -271,6 +271,15 @@ var Chat = class {
|
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
273
|
|
|
274
|
+
// src/resources/paging.ts
|
|
275
|
+
function pageQuery(p) {
|
|
276
|
+
const q = new URLSearchParams();
|
|
277
|
+
if (p.limit !== void 0) q.set("limit", String(p.limit));
|
|
278
|
+
if (p.after !== void 0 && p.after !== "") q.set("after", p.after);
|
|
279
|
+
const s = q.toString();
|
|
280
|
+
return s ? `?${s}` : "";
|
|
281
|
+
}
|
|
282
|
+
|
|
274
283
|
// src/resources/files.ts
|
|
275
284
|
var isPathStream = (f) => !!f && typeof f === "object" && typeof f.path === "string" && Symbol.asyncIterator in f;
|
|
276
285
|
var baseName = (p) => p.split(/[\\/]/).filter(Boolean).pop() ?? "file";
|
|
@@ -299,14 +308,14 @@ var Files = class {
|
|
|
299
308
|
form.append("file", blob, name ?? "file");
|
|
300
309
|
return await this.client.request("POST", "/files", { form, signal: opts.signal });
|
|
301
310
|
}
|
|
302
|
-
async list(opts = {}) {
|
|
303
|
-
return await this.client.request("GET",
|
|
311
|
+
async list(params = {}, opts = {}) {
|
|
312
|
+
return await this.client.request("GET", `/files${pageQuery(params)}`, { signal: opts.signal });
|
|
304
313
|
}
|
|
305
314
|
async get(id, opts = {}) {
|
|
306
315
|
return await this.client.request("GET", `/files/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
307
316
|
}
|
|
308
317
|
async delete(id, opts = {}) {
|
|
309
|
-
return this.client.request("DELETE", `/files/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
318
|
+
return await this.client.request("DELETE", `/files/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
310
319
|
}
|
|
311
320
|
};
|
|
312
321
|
|
|
@@ -333,14 +342,14 @@ var Sessions = class {
|
|
|
333
342
|
async create(p = {}, opts = {}) {
|
|
334
343
|
return await this.client.request("POST", "/sessions", { body: p, signal: opts.signal });
|
|
335
344
|
}
|
|
336
|
-
async list(opts = {}) {
|
|
337
|
-
return await this.client.request("GET",
|
|
345
|
+
async list(params = {}, opts = {}) {
|
|
346
|
+
return await this.client.request("GET", `/sessions${pageQuery(params)}`, { signal: opts.signal });
|
|
338
347
|
}
|
|
339
348
|
async get(id, opts = {}) {
|
|
340
349
|
return await this.client.request("GET", `/sessions/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
341
350
|
}
|
|
342
351
|
async delete(id, opts = {}) {
|
|
343
|
-
return this.client.request("DELETE", `/sessions/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
352
|
+
return await this.client.request("DELETE", `/sessions/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
344
353
|
}
|
|
345
354
|
};
|
|
346
355
|
|