@perplexity-ai/perplexity_ai 0.39.1 → 0.41.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/CHANGELOG.md +19 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -2
- package/dist/client.js.map +1 -1
- package/dist/generated/api.d.ts +235 -22
- package/dist/generated/api.d.ts.map +1 -1
- package/dist/generated/api.js +84 -0
- package/dist/generated/api.js.map +1 -1
- package/dist/generated/runtime.d.ts +1 -1
- package/dist/generated/runtime.d.ts.map +1 -1
- package/dist/generated/runtime.js +12 -1
- package/dist/generated/runtime.js.map +1 -1
- package/dist/resources/batches.d.ts +6 -0
- package/dist/resources/batches.d.ts.map +1 -0
- package/dist/resources/batches.js +3 -0
- package/dist/resources/batches.js.map +1 -0
- package/dist/resources/client.d.ts +13 -0
- package/dist/resources/client.d.ts.map +1 -1
- package/dist/resources/client.js +4 -0
- package/dist/resources/client.js.map +1 -1
- package/dist/resources/files.d.ts +7 -0
- package/dist/resources/files.d.ts.map +1 -0
- package/dist/resources/files.js +3 -0
- package/dist/resources/files.js.map +1 -0
- package/dist/resources/index.d.ts +2 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +2 -0
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/shared.d.ts +7 -0
- package/dist/resources/shared.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +7 -2
- package/src/generated/api.ts +300 -22
- package/src/generated/runtime.ts +11 -1
- package/src/resources/batches.ts +5 -0
- package/src/resources/client.ts +15 -0
- package/src/resources/files.ts +6 -0
- package/src/resources/index.ts +2 -0
- package/src/resources/shared.ts +7 -0
- package/src/version.ts +1 -1
package/src/generated/api.ts
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import { addOutputText, legacyQuery, legacyRequestOptions, ownBoolean, ownCursor, ownParameter, normalizeHeaders, multipartBody, pathSegment } from "./runtime.js";
|
|
2
2
|
import type { APIPromise, RequestOptions, SdkTransport, Stream } from "./runtime.js";
|
|
3
3
|
export type { APIPromise, HeaderValue, HeadersLike, RequestOptions, SdkTransport, Stream } from "./runtime.js";
|
|
4
|
-
export type AdvisorResultOutputItemInput = {
|
|
5
|
-
advice?: string;
|
|
6
|
-
arguments?: string;
|
|
7
|
-
call_id: string;
|
|
8
|
-
error_code?: string;
|
|
9
|
-
error_message?: string;
|
|
10
|
-
question?: string;
|
|
11
|
-
status: StatusInput;
|
|
12
|
-
type: "advisor_result";
|
|
13
|
-
};
|
|
14
|
-
export type AdvisorResultOutputItemOutput = {
|
|
15
|
-
advice?: string;
|
|
16
|
-
arguments?: string;
|
|
17
|
-
call_id: string;
|
|
18
|
-
error_code?: string;
|
|
19
|
-
error_message?: string;
|
|
20
|
-
question?: string;
|
|
21
|
-
status: StatusOutput;
|
|
22
|
-
type: "advisor_result";
|
|
23
|
-
};
|
|
24
4
|
export type AnnotationInput = {
|
|
25
5
|
end_index?: number;
|
|
26
6
|
start_index?: number;
|
|
@@ -301,6 +281,128 @@ export type AsyncApiChatCompletionsResponseSummaryOutput = {
|
|
|
301
281
|
};
|
|
302
282
|
export type AsyncProcessingStatusInput = "CREATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED";
|
|
303
283
|
export type AsyncProcessingStatusOutput = "CREATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED";
|
|
284
|
+
export type BatchInput = {
|
|
285
|
+
cancelled_at?: number | null;
|
|
286
|
+
cancelling_at?: number | null;
|
|
287
|
+
completed_at?: number | null;
|
|
288
|
+
completion_window: string;
|
|
289
|
+
created_at: number;
|
|
290
|
+
endpoint: string;
|
|
291
|
+
error_file_id?: string | null;
|
|
292
|
+
errors?: BatchErrorsInput | null;
|
|
293
|
+
expired_at?: number | null;
|
|
294
|
+
expires_at?: number | null;
|
|
295
|
+
failed_at?: number | null;
|
|
296
|
+
finalizing_at?: number | null;
|
|
297
|
+
id: string;
|
|
298
|
+
in_progress_at?: number | null;
|
|
299
|
+
input_file_id: string;
|
|
300
|
+
metadata?: ({} & Record<string, string>) | null;
|
|
301
|
+
object: "batch";
|
|
302
|
+
output_file_id?: string | null;
|
|
303
|
+
request_counts: BatchRequestCountsInput;
|
|
304
|
+
status: "validating" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled" | "failed";
|
|
305
|
+
usage: BatchUsageInput;
|
|
306
|
+
};
|
|
307
|
+
export type BatchOutput = {
|
|
308
|
+
cancelled_at?: number | null;
|
|
309
|
+
cancelling_at?: number | null;
|
|
310
|
+
completed_at?: number | null;
|
|
311
|
+
completion_window: string;
|
|
312
|
+
created_at: number;
|
|
313
|
+
endpoint: string;
|
|
314
|
+
error_file_id?: string | null;
|
|
315
|
+
errors?: BatchErrorsOutput | null;
|
|
316
|
+
expired_at?: number | null;
|
|
317
|
+
expires_at?: number | null;
|
|
318
|
+
failed_at?: number | null;
|
|
319
|
+
finalizing_at?: number | null;
|
|
320
|
+
id: string;
|
|
321
|
+
in_progress_at?: number | null;
|
|
322
|
+
input_file_id: string;
|
|
323
|
+
metadata?: ({} & Record<string, string>) | null;
|
|
324
|
+
object: "batch";
|
|
325
|
+
output_file_id?: string | null;
|
|
326
|
+
request_counts: BatchRequestCountsOutput;
|
|
327
|
+
status: "validating" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled" | "failed";
|
|
328
|
+
usage: BatchUsageOutput;
|
|
329
|
+
};
|
|
330
|
+
export type BatchCreateRequestInput = {
|
|
331
|
+
completion_window?: "24h";
|
|
332
|
+
endpoint: "/v1/responses";
|
|
333
|
+
input_file_id: string;
|
|
334
|
+
metadata?: ({} & Record<string, string>) | null;
|
|
335
|
+
};
|
|
336
|
+
export type BatchCreateRequestOutput = {
|
|
337
|
+
completion_window?: "24h";
|
|
338
|
+
endpoint: "/v1/responses";
|
|
339
|
+
input_file_id: string;
|
|
340
|
+
metadata?: ({} & Record<string, string>) | null;
|
|
341
|
+
};
|
|
342
|
+
export type BatchErrorInput = {
|
|
343
|
+
code: string;
|
|
344
|
+
line?: number | null;
|
|
345
|
+
message: string;
|
|
346
|
+
};
|
|
347
|
+
export type BatchErrorOutput = {
|
|
348
|
+
code: string;
|
|
349
|
+
line?: number | null;
|
|
350
|
+
message: string;
|
|
351
|
+
};
|
|
352
|
+
export type BatchErrorsInput = {
|
|
353
|
+
data: BatchErrorInput[];
|
|
354
|
+
object: "list";
|
|
355
|
+
};
|
|
356
|
+
export type BatchErrorsOutput = {
|
|
357
|
+
data: BatchErrorOutput[];
|
|
358
|
+
object: "list";
|
|
359
|
+
};
|
|
360
|
+
export type BatchListInput = {
|
|
361
|
+
data: BatchInput[];
|
|
362
|
+
first_id?: string | null;
|
|
363
|
+
has_more: boolean;
|
|
364
|
+
last_id?: string | null;
|
|
365
|
+
object: "list";
|
|
366
|
+
};
|
|
367
|
+
export type BatchListOutput = {
|
|
368
|
+
data: BatchOutput[];
|
|
369
|
+
first_id?: string | null;
|
|
370
|
+
has_more: boolean;
|
|
371
|
+
last_id?: string | null;
|
|
372
|
+
object: "list";
|
|
373
|
+
};
|
|
374
|
+
export type BatchRequestCountsInput = {
|
|
375
|
+
completed: number;
|
|
376
|
+
failed: number;
|
|
377
|
+
total: number;
|
|
378
|
+
};
|
|
379
|
+
export type BatchRequestCountsOutput = {
|
|
380
|
+
completed: number;
|
|
381
|
+
failed: number;
|
|
382
|
+
total: number;
|
|
383
|
+
};
|
|
384
|
+
export type BatchUsageInput = {
|
|
385
|
+
input_tokens: number;
|
|
386
|
+
input_tokens_details: {
|
|
387
|
+
cached_tokens: number;
|
|
388
|
+
};
|
|
389
|
+
output_tokens: number;
|
|
390
|
+
output_tokens_details: {
|
|
391
|
+
reasoning_tokens: number;
|
|
392
|
+
};
|
|
393
|
+
total_tokens: number;
|
|
394
|
+
};
|
|
395
|
+
export type BatchUsageOutput = {
|
|
396
|
+
input_tokens: number;
|
|
397
|
+
input_tokens_details: {
|
|
398
|
+
cached_tokens: number;
|
|
399
|
+
};
|
|
400
|
+
output_tokens: number;
|
|
401
|
+
output_tokens_details: {
|
|
402
|
+
reasoning_tokens: number;
|
|
403
|
+
};
|
|
404
|
+
total_tokens: number;
|
|
405
|
+
};
|
|
304
406
|
export type BrowserSessionResponseInput = {
|
|
305
407
|
session_id?: string;
|
|
306
408
|
status?: "running" | "stopped";
|
|
@@ -761,6 +863,58 @@ export type FetchUrlToolOutput = {
|
|
|
761
863
|
max_urls?: number;
|
|
762
864
|
type: "fetch_url";
|
|
763
865
|
};
|
|
866
|
+
export type FileDeletedInput = {
|
|
867
|
+
deleted: boolean;
|
|
868
|
+
id: string;
|
|
869
|
+
object: "file";
|
|
870
|
+
};
|
|
871
|
+
export type FileDeletedOutput = {
|
|
872
|
+
deleted: boolean;
|
|
873
|
+
id: string;
|
|
874
|
+
object: "file";
|
|
875
|
+
};
|
|
876
|
+
export type FileObjectInput = {
|
|
877
|
+
bytes: number;
|
|
878
|
+
created_at: number;
|
|
879
|
+
expires_at?: number | null;
|
|
880
|
+
filename: string;
|
|
881
|
+
id: string;
|
|
882
|
+
object: "file";
|
|
883
|
+
purpose: FilePurposeInput;
|
|
884
|
+
};
|
|
885
|
+
export type FileObjectOutput = {
|
|
886
|
+
bytes: number;
|
|
887
|
+
created_at: number;
|
|
888
|
+
expires_at?: number | null;
|
|
889
|
+
filename: string;
|
|
890
|
+
id: string;
|
|
891
|
+
object: "file";
|
|
892
|
+
purpose: FilePurposeOutput;
|
|
893
|
+
};
|
|
894
|
+
export type FileObjectListInput = {
|
|
895
|
+
data: FileObjectInput[];
|
|
896
|
+
first_id?: string | null;
|
|
897
|
+
has_more: boolean;
|
|
898
|
+
last_id?: string | null;
|
|
899
|
+
object: "list";
|
|
900
|
+
};
|
|
901
|
+
export type FileObjectListOutput = {
|
|
902
|
+
data: FileObjectOutput[];
|
|
903
|
+
first_id?: string | null;
|
|
904
|
+
has_more: boolean;
|
|
905
|
+
last_id?: string | null;
|
|
906
|
+
object: "list";
|
|
907
|
+
};
|
|
908
|
+
export type FilePurposeInput = "batch" | "batch_output";
|
|
909
|
+
export type FilePurposeOutput = "batch" | "batch_output";
|
|
910
|
+
export type FileUploadInput = {
|
|
911
|
+
file: Blob;
|
|
912
|
+
purpose: "batch";
|
|
913
|
+
};
|
|
914
|
+
export type FileUploadOutput = {
|
|
915
|
+
file: string;
|
|
916
|
+
purpose: "batch";
|
|
917
|
+
};
|
|
764
918
|
export type FinanceSearchToolInput = {
|
|
765
919
|
type: "finance_search";
|
|
766
920
|
};
|
|
@@ -1265,8 +1419,8 @@ export type NamespaceToolDefOutput = {
|
|
|
1265
1419
|
parameters?: {} & Record<string, unknown>;
|
|
1266
1420
|
type: "function";
|
|
1267
1421
|
};
|
|
1268
|
-
export type OutputItemInput = MessageOutputItemInput | SearchResultsOutputItemInput | ImageSearchResultsOutputItemInput | FetchUrlResultsOutputItemInput | FunctionCallOutputItemInput | McpListToolsOutputItemInput | McpCallOutputItemInput | McpApprovalRequestOutputItemInput | ToolSearchOutputItemInput | SkillLoadedOutputItemInput |
|
|
1269
|
-
export type OutputItemOutput = MessageOutputItemOutput | SearchResultsOutputItemOutput | ImageSearchResultsOutputItemOutput | FetchUrlResultsOutputItemOutput | FunctionCallOutputItemOutput | McpListToolsOutputItemOutput | McpCallOutputItemOutput | McpApprovalRequestOutputItemOutput | ToolSearchOutputItemOutput | SkillLoadedOutputItemOutput |
|
|
1422
|
+
export type OutputItemInput = MessageOutputItemInput | SearchResultsOutputItemInput | ImageSearchResultsOutputItemInput | FetchUrlResultsOutputItemInput | FunctionCallOutputItemInput | McpListToolsOutputItemInput | McpCallOutputItemInput | McpApprovalRequestOutputItemInput | ToolSearchOutputItemInput | SkillLoadedOutputItemInput | SandboxResultsOutputItemInput | SandboxWriteFileOutputItemInput | SandboxReadFileOutputItemInput | SandboxEditFileOutputItemInput | SandboxGrepOutputItemInput | SandboxGlobOutputItemInput | SandboxApplyPatchOutputItemInput | ShareFileOutputItemInput | UnknownOutputItemInput;
|
|
1423
|
+
export type OutputItemOutput = MessageOutputItemOutput | SearchResultsOutputItemOutput | ImageSearchResultsOutputItemOutput | FetchUrlResultsOutputItemOutput | FunctionCallOutputItemOutput | McpListToolsOutputItemOutput | McpCallOutputItemOutput | McpApprovalRequestOutputItemOutput | ToolSearchOutputItemOutput | SkillLoadedOutputItemOutput | SandboxResultsOutputItemOutput | SandboxWriteFileOutputItemOutput | SandboxReadFileOutputItemOutput | SandboxEditFileOutputItemOutput | SandboxGrepOutputItemOutput | SandboxGlobOutputItemOutput | SandboxApplyPatchOutputItemOutput | ShareFileOutputItemOutput | UnknownOutputItemOutput;
|
|
1270
1424
|
export type OutputItemAddedEventInput = {
|
|
1271
1425
|
item: OutputItemInput;
|
|
1272
1426
|
output_index: number;
|
|
@@ -1549,6 +1703,7 @@ export type ResponsesObjectTypeInput = "response";
|
|
|
1549
1703
|
export type ResponsesObjectTypeOutput = "response";
|
|
1550
1704
|
export type ResponsesRequestInput = {
|
|
1551
1705
|
background?: boolean | null;
|
|
1706
|
+
effort?: string;
|
|
1552
1707
|
input: InputInput;
|
|
1553
1708
|
instructions?: string;
|
|
1554
1709
|
language_preference?: string;
|
|
@@ -1556,6 +1711,7 @@ export type ResponsesRequestInput = {
|
|
|
1556
1711
|
max_steps?: number;
|
|
1557
1712
|
model?: string;
|
|
1558
1713
|
models?: string[];
|
|
1714
|
+
/** @deprecated Use effort instead. If both are supplied, effort takes precedence when non-null. */
|
|
1559
1715
|
preset?: string;
|
|
1560
1716
|
previous_response_id?: string;
|
|
1561
1717
|
profile?: ProfileReferenceInput;
|
|
@@ -1574,6 +1730,7 @@ export type ResponsesRequestInput = {
|
|
|
1574
1730
|
};
|
|
1575
1731
|
export type ResponsesRequestOutput = {
|
|
1576
1732
|
background?: boolean | null;
|
|
1733
|
+
effort?: string;
|
|
1577
1734
|
input: InputOutput;
|
|
1578
1735
|
instructions?: string;
|
|
1579
1736
|
language_preference?: string;
|
|
@@ -1581,6 +1738,7 @@ export type ResponsesRequestOutput = {
|
|
|
1581
1738
|
max_steps?: number;
|
|
1582
1739
|
model?: string;
|
|
1583
1740
|
models?: string[];
|
|
1741
|
+
/** @deprecated Use effort instead. If both are supplied, effort takes precedence when non-null. */
|
|
1584
1742
|
preset?: string;
|
|
1585
1743
|
previous_response_id?: string;
|
|
1586
1744
|
profile?: ProfileReferenceOutput;
|
|
@@ -1600,11 +1758,13 @@ export type ResponsesRequestOutput = {
|
|
|
1600
1758
|
export type ResponsesResponseInput = {
|
|
1601
1759
|
background?: boolean;
|
|
1602
1760
|
created_at: number;
|
|
1761
|
+
effort?: string;
|
|
1603
1762
|
error?: ErrorInfoInput;
|
|
1604
1763
|
id: string;
|
|
1605
1764
|
model: string;
|
|
1606
1765
|
object: ResponsesObjectTypeInput;
|
|
1607
1766
|
output: OutputItemInput[];
|
|
1767
|
+
/** @deprecated Use effort instead. Contains the same configuration and version. */
|
|
1608
1768
|
preset?: string;
|
|
1609
1769
|
previous_response_id?: string | null;
|
|
1610
1770
|
prompt_cache_key?: string | null;
|
|
@@ -1616,11 +1776,13 @@ export type ResponsesResponseInput = {
|
|
|
1616
1776
|
export type ResponsesResponseOutput = {
|
|
1617
1777
|
background?: boolean;
|
|
1618
1778
|
created_at: number;
|
|
1779
|
+
effort?: string;
|
|
1619
1780
|
error?: ErrorInfoOutput;
|
|
1620
1781
|
id: string;
|
|
1621
1782
|
model: string;
|
|
1622
1783
|
object: ResponsesObjectTypeOutput;
|
|
1623
1784
|
output: OutputItemOutput[];
|
|
1785
|
+
/** @deprecated Use effort instead. Contains the same configuration and version. */
|
|
1624
1786
|
preset?: string;
|
|
1625
1787
|
previous_response_id?: string | null;
|
|
1626
1788
|
prompt_cache_key?: string | null;
|
|
@@ -2311,6 +2473,47 @@ export class AsyncResource {
|
|
|
2311
2473
|
this.chat = new AsyncChatResource(client);
|
|
2312
2474
|
}
|
|
2313
2475
|
}
|
|
2476
|
+
export class BatchesResource {
|
|
2477
|
+
private readonly _client: SdkTransport;
|
|
2478
|
+
constructor(client: SdkTransport) {
|
|
2479
|
+
this._client = client;
|
|
2480
|
+
}
|
|
2481
|
+
cancel(batchID: string, options?: RequestOptions): APIPromise<BatchOutput> {
|
|
2482
|
+
return this._client.post<BatchOutput>(`/v1/batches/${pathSegment(batchID)}/cancel`, {
|
|
2483
|
+
...options
|
|
2484
|
+
});
|
|
2485
|
+
}
|
|
2486
|
+
create(body: BatchCreateRequestInput, params?: {
|
|
2487
|
+
"Idempotency-Key"?: string;
|
|
2488
|
+
}, options?: RequestOptions): APIPromise<BatchOutput> {
|
|
2489
|
+
return this._client.post<BatchOutput>("/v1/batches", {
|
|
2490
|
+
...options,
|
|
2491
|
+
body: body,
|
|
2492
|
+
headers: {
|
|
2493
|
+
"Idempotency-Key": params?.["Idempotency-Key"],
|
|
2494
|
+
...normalizeHeaders(options?.headers)
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
list(params?: {
|
|
2499
|
+
after?: string;
|
|
2500
|
+
limit?: number;
|
|
2501
|
+
}, options?: RequestOptions): APIPromise<BatchListOutput> {
|
|
2502
|
+
return this._client.get<BatchListOutput>("/v1/batches", {
|
|
2503
|
+
...options,
|
|
2504
|
+
query: {
|
|
2505
|
+
after: params?.after,
|
|
2506
|
+
limit: params?.limit,
|
|
2507
|
+
...options?.query
|
|
2508
|
+
}
|
|
2509
|
+
});
|
|
2510
|
+
}
|
|
2511
|
+
retrieve(batchID: string, options?: RequestOptions): APIPromise<BatchOutput> {
|
|
2512
|
+
return this._client.get<BatchOutput>(`/v1/batches/${pathSegment(batchID)}`, {
|
|
2513
|
+
...options
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2314
2517
|
export class BrowserResource {
|
|
2315
2518
|
readonly sessions: BrowserSessionsResource;
|
|
2316
2519
|
constructor(client: SdkTransport) {
|
|
@@ -2359,6 +2562,55 @@ export class EmbeddingsResource {
|
|
|
2359
2562
|
});
|
|
2360
2563
|
}
|
|
2361
2564
|
}
|
|
2565
|
+
export class FilesResource {
|
|
2566
|
+
private readonly _client: SdkTransport;
|
|
2567
|
+
constructor(client: SdkTransport) {
|
|
2568
|
+
this._client = client;
|
|
2569
|
+
}
|
|
2570
|
+
content(fileID: string, options?: RequestOptions): APIPromise<Response> {
|
|
2571
|
+
return this._client.get<Response>(`/v1/files/${pathSegment(fileID)}/content`, {
|
|
2572
|
+
...options,
|
|
2573
|
+
headers: {
|
|
2574
|
+
"Accept": "application/octet-stream",
|
|
2575
|
+
...normalizeHeaders(options?.headers)
|
|
2576
|
+
},
|
|
2577
|
+
__binaryResponse: true
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
create(body: FileUploadInput, options?: RequestOptions): APIPromise<FileObjectOutput> {
|
|
2581
|
+
return this._client.post<FileObjectOutput>("/v1/files", {
|
|
2582
|
+
...options,
|
|
2583
|
+
body: multipartBody(body, ["file"], ["purpose"])
|
|
2584
|
+
});
|
|
2585
|
+
}
|
|
2586
|
+
delete(fileID: string, options?: RequestOptions): APIPromise<FileDeletedOutput> {
|
|
2587
|
+
return this._client.delete<FileDeletedOutput>(`/v1/files/${pathSegment(fileID)}`, {
|
|
2588
|
+
...options
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
list(params?: {
|
|
2592
|
+
after?: string;
|
|
2593
|
+
limit?: number;
|
|
2594
|
+
order?: "asc" | "desc";
|
|
2595
|
+
purpose?: FilePurposeInput;
|
|
2596
|
+
}, options?: RequestOptions): APIPromise<FileObjectListOutput> {
|
|
2597
|
+
return this._client.get<FileObjectListOutput>("/v1/files", {
|
|
2598
|
+
...options,
|
|
2599
|
+
query: {
|
|
2600
|
+
after: params?.after,
|
|
2601
|
+
limit: params?.limit,
|
|
2602
|
+
order: params?.order,
|
|
2603
|
+
purpose: params?.purpose,
|
|
2604
|
+
...options?.query
|
|
2605
|
+
}
|
|
2606
|
+
});
|
|
2607
|
+
}
|
|
2608
|
+
retrieve(fileID: string, options?: RequestOptions): APIPromise<FileObjectOutput> {
|
|
2609
|
+
return this._client.get<FileObjectOutput>(`/v1/files/${pathSegment(fileID)}`, {
|
|
2610
|
+
...options
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2362
2614
|
export class ModelsResource {
|
|
2363
2615
|
private readonly _client: SdkTransport;
|
|
2364
2616
|
constructor(client: SdkTransport) {
|
|
@@ -2577,22 +2829,26 @@ export class SkillsResource {
|
|
|
2577
2829
|
}
|
|
2578
2830
|
export class PerplexitySdk {
|
|
2579
2831
|
readonly async: AsyncResource;
|
|
2832
|
+
readonly batches: BatchesResource;
|
|
2580
2833
|
readonly browser: BrowserResource;
|
|
2581
2834
|
readonly chat: ChatResource;
|
|
2582
2835
|
readonly contextualizedEmbeddings: ContextualizedEmbeddingsResource;
|
|
2583
2836
|
readonly decisions: DecisionsResource;
|
|
2584
2837
|
readonly embeddings: EmbeddingsResource;
|
|
2838
|
+
readonly files: FilesResource;
|
|
2585
2839
|
readonly models: ModelsResource;
|
|
2586
2840
|
readonly responses: ResponsesResource;
|
|
2587
2841
|
readonly search: SearchResource;
|
|
2588
2842
|
readonly skills: SkillsResource;
|
|
2589
2843
|
constructor(client: SdkTransport) {
|
|
2590
2844
|
this.async = new AsyncResource(client);
|
|
2845
|
+
this.batches = new BatchesResource(client);
|
|
2591
2846
|
this.browser = new BrowserResource(client);
|
|
2592
2847
|
this.chat = new ChatResource(client);
|
|
2593
2848
|
this.contextualizedEmbeddings = new ContextualizedEmbeddingsResource(client);
|
|
2594
2849
|
this.decisions = new DecisionsResource(client);
|
|
2595
2850
|
this.embeddings = new EmbeddingsResource(client);
|
|
2851
|
+
this.files = new FilesResource(client);
|
|
2596
2852
|
this.models = new ModelsResource(client);
|
|
2597
2853
|
this.responses = new ResponsesResource(client);
|
|
2598
2854
|
this.search = new SearchResource(client);
|
|
@@ -2601,6 +2857,8 @@ export class PerplexitySdk {
|
|
|
2601
2857
|
}
|
|
2602
2858
|
export class Async extends AsyncResource {
|
|
2603
2859
|
}
|
|
2860
|
+
export class Batches extends BatchesResource {
|
|
2861
|
+
}
|
|
2604
2862
|
export class Browser extends BrowserResource {
|
|
2605
2863
|
}
|
|
2606
2864
|
export class Chat extends ChatResource {
|
|
@@ -2611,6 +2869,8 @@ export class Decisions extends DecisionsResource {
|
|
|
2611
2869
|
}
|
|
2612
2870
|
export class Embeddings extends EmbeddingsResource {
|
|
2613
2871
|
}
|
|
2872
|
+
export class Files extends FilesResource {
|
|
2873
|
+
}
|
|
2614
2874
|
export class Models extends ModelsResource {
|
|
2615
2875
|
}
|
|
2616
2876
|
export class Responses extends ResponsesResource {
|
|
@@ -2621,6 +2881,9 @@ export class Skills extends SkillsResource {
|
|
|
2621
2881
|
}
|
|
2622
2882
|
export type Annotation = AnnotationOutput;
|
|
2623
2883
|
export type APIPublicSearchResult = ApiPublicSearchResultOutput;
|
|
2884
|
+
export type Batch = BatchOutput;
|
|
2885
|
+
export type BatchCreateParams = BatchCreateRequestInput;
|
|
2886
|
+
export type BatchListResponse = BatchListOutput;
|
|
2624
2887
|
export type BrowserSessionResponse = BrowserSessionResponseOutput;
|
|
2625
2888
|
export type ChatMessageInput = ChatMessageInputInput;
|
|
2626
2889
|
export type ChatMessageOutput = ChatMessageOutputOutput;
|
|
@@ -2638,6 +2901,10 @@ export type EmbeddingCreateResponse = EmbeddingsResponseOutput;
|
|
|
2638
2901
|
export type EmbeddingObject = EmbeddingObjectOutput;
|
|
2639
2902
|
export type EmbeddingsUsage = EmbeddingsUsageOutput;
|
|
2640
2903
|
export type ErrorInfo = ErrorInfoOutput;
|
|
2904
|
+
export type FileCreateParams = FileUploadInput;
|
|
2905
|
+
export type FileDeleted = FileDeletedOutput;
|
|
2906
|
+
export type FileListResponse = FileObjectListOutput;
|
|
2907
|
+
export type FileObject = FileObjectOutput;
|
|
2641
2908
|
export type FunctionCallOutputItem = FunctionCallOutputItemOutput;
|
|
2642
2909
|
export type FunctionTool = FunctionToolInput;
|
|
2643
2910
|
export type ImageResult = ImageResultOutput;
|
|
@@ -2695,6 +2962,11 @@ export namespace Async {
|
|
|
2695
2962
|
}
|
|
2696
2963
|
}
|
|
2697
2964
|
}
|
|
2965
|
+
export namespace Batches {
|
|
2966
|
+
export type Batch = BatchOutput;
|
|
2967
|
+
export type BatchCreateParams = BatchCreateRequestInput;
|
|
2968
|
+
export type BatchListResponse = BatchListOutput;
|
|
2969
|
+
}
|
|
2698
2970
|
export namespace Browser {
|
|
2699
2971
|
export class Sessions extends BrowserSessionsResource {
|
|
2700
2972
|
}
|
|
@@ -2738,6 +3010,12 @@ export namespace Embeddings {
|
|
|
2738
3010
|
export type EmbeddingCreateParams = EmbeddingsRequestInput;
|
|
2739
3011
|
export type EmbeddingCreateResponse = EmbeddingsResponseOutput;
|
|
2740
3012
|
}
|
|
3013
|
+
export namespace Files {
|
|
3014
|
+
export type FileCreateParams = FileUploadInput;
|
|
3015
|
+
export type FileDeleted = FileDeletedOutput;
|
|
3016
|
+
export type FileListResponse = FileObjectListOutput;
|
|
3017
|
+
export type FileObject = FileObjectOutput;
|
|
3018
|
+
}
|
|
2741
3019
|
export namespace Models {
|
|
2742
3020
|
export type Model = ModelOutput;
|
|
2743
3021
|
export type ModelListResponse = Awaited<ReturnType<ModelsResource["list"]>>;
|
package/src/generated/runtime.ts
CHANGED
|
@@ -57,8 +57,9 @@ export type SdkTransport = {
|
|
|
57
57
|
|
|
58
58
|
// Builds form data from the schema's fields only; other keys are not sent.
|
|
59
59
|
export function multipartBody(
|
|
60
|
-
body: Record<string, Blob | undefined>,
|
|
60
|
+
body: Record<string, Blob | string | undefined>,
|
|
61
61
|
fields: readonly string[],
|
|
62
|
+
textFields: readonly string[] = [],
|
|
62
63
|
): FormData {
|
|
63
64
|
const form = new FormData();
|
|
64
65
|
for (const name of fields) {
|
|
@@ -72,6 +73,15 @@ export function multipartBody(
|
|
|
72
73
|
}
|
|
73
74
|
form.append(name, file);
|
|
74
75
|
}
|
|
76
|
+
for (const name of textFields) {
|
|
77
|
+
if (!Object.prototype.hasOwnProperty.call(body, name)) continue;
|
|
78
|
+
const value = body[name];
|
|
79
|
+
if (value === undefined) continue;
|
|
80
|
+
if (typeof value !== 'string') {
|
|
81
|
+
throw new TypeError(`Multipart field ${name} must be a string.`);
|
|
82
|
+
}
|
|
83
|
+
form.append(name, value);
|
|
84
|
+
}
|
|
75
85
|
return form;
|
|
76
86
|
}
|
|
77
87
|
|
package/src/resources/client.ts
CHANGED
|
@@ -2,11 +2,13 @@ import * as API from '../generated/api.js';
|
|
|
2
2
|
import type { SdkTransport } from '../generated/api.js';
|
|
3
3
|
export interface ClientResources {
|
|
4
4
|
readonly async: API.Async;
|
|
5
|
+
readonly batches: API.Batches;
|
|
5
6
|
readonly browser: API.Browser;
|
|
6
7
|
readonly chat: API.Chat;
|
|
7
8
|
readonly contextualizedEmbeddings: API.ContextualizedEmbeddings;
|
|
8
9
|
readonly decisions: API.Decisions;
|
|
9
10
|
readonly embeddings: API.Embeddings;
|
|
11
|
+
readonly files: API.Files;
|
|
10
12
|
readonly models: API.Models;
|
|
11
13
|
readonly responses: API.Responses;
|
|
12
14
|
readonly search: API.Search;
|
|
@@ -14,11 +16,13 @@ export interface ClientResources {
|
|
|
14
16
|
}
|
|
15
17
|
export const clientResourceClasses = {
|
|
16
18
|
Async: API.Async,
|
|
19
|
+
Batches: API.Batches,
|
|
17
20
|
Browser: API.Browser,
|
|
18
21
|
Chat: API.Chat,
|
|
19
22
|
ContextualizedEmbeddings: API.ContextualizedEmbeddings,
|
|
20
23
|
Decisions: API.Decisions,
|
|
21
24
|
Embeddings: API.Embeddings,
|
|
25
|
+
Files: API.Files,
|
|
22
26
|
Models: API.Models,
|
|
23
27
|
Responses: API.Responses,
|
|
24
28
|
Search: API.Search,
|
|
@@ -27,11 +31,13 @@ export const clientResourceClasses = {
|
|
|
27
31
|
export function createClientResources(client: SdkTransport): ClientResources {
|
|
28
32
|
return {
|
|
29
33
|
async: new API.Async(client),
|
|
34
|
+
batches: new API.Batches(client),
|
|
30
35
|
browser: new API.Browser(client),
|
|
31
36
|
chat: new API.Chat(client),
|
|
32
37
|
contextualizedEmbeddings: new API.ContextualizedEmbeddings(client),
|
|
33
38
|
decisions: new API.Decisions(client),
|
|
34
39
|
embeddings: new API.Embeddings(client),
|
|
40
|
+
files: new API.Files(client),
|
|
35
41
|
models: new API.Models(client),
|
|
36
42
|
responses: new API.Responses(client),
|
|
37
43
|
search: new API.Search(client),
|
|
@@ -43,6 +49,10 @@ declare module '../client.js' {
|
|
|
43
49
|
}
|
|
44
50
|
namespace Perplexity {
|
|
45
51
|
export import Async = API.Async;
|
|
52
|
+
export import Batches = API.Batches;
|
|
53
|
+
export type Batch = API.Batches.Batch;
|
|
54
|
+
export type BatchCreateParams = API.Batches.BatchCreateParams;
|
|
55
|
+
export type BatchListResponse = API.Batches.BatchListResponse;
|
|
46
56
|
export import Browser = API.Browser;
|
|
47
57
|
export type SessionCreateParams = API.Browser.SessionCreateParams;
|
|
48
58
|
export import Chat = API.Chat;
|
|
@@ -61,6 +71,11 @@ declare module '../client.js' {
|
|
|
61
71
|
export import Embeddings = API.Embeddings;
|
|
62
72
|
export type EmbeddingCreateParams = API.Embeddings.EmbeddingCreateParams;
|
|
63
73
|
export type EmbeddingCreateResponse = API.Embeddings.EmbeddingCreateResponse;
|
|
74
|
+
export import Files = API.Files;
|
|
75
|
+
export type FileCreateParams = API.Files.FileCreateParams;
|
|
76
|
+
export type FileDeleted = API.Files.FileDeleted;
|
|
77
|
+
export type FileListResponse = API.Files.FileListResponse;
|
|
78
|
+
export type FileObject = API.Files.FileObject;
|
|
64
79
|
export import Models = API.Models;
|
|
65
80
|
export type Model = API.Models.Model;
|
|
66
81
|
export type ModelListResponse = API.Models.ModelListResponse;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as API from '../generated/api.js';
|
|
2
|
+
export import Files = API.Files;
|
|
3
|
+
export type FileCreateParams = API.Files.FileCreateParams;
|
|
4
|
+
export type FileDeleted = API.Files.FileDeleted;
|
|
5
|
+
export type FileListResponse = API.Files.FileListResponse;
|
|
6
|
+
export type FileObject = API.Files.FileObject;
|
package/src/resources/index.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export * from './shared.js';
|
|
2
2
|
export { Async } from './async/async.js';
|
|
3
|
+
export { Batches, type Batch, type BatchCreateParams, type BatchListResponse } from './batches.js';
|
|
3
4
|
export { Browser, type SessionCreateParams } from './browser/browser.js';
|
|
4
5
|
export { Chat, type CompletionCreateParams, type CompletionCreateParamsBase, type CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming, type StreamChunk } from './chat/chat.js';
|
|
5
6
|
export { ContextualizedEmbeddings, type ContextualizedEmbeddingCreateParams, type ContextualizedEmbeddingCreateResponse } from './contextualized-embeddings.js';
|
|
6
7
|
export { Decisions, type DecisionAnswer, type DecisionCreateParams, type DecisionCreateResponse, type DecisionQuestion } from './decisions.js';
|
|
7
8
|
export { Embeddings, type EmbeddingCreateParams, type EmbeddingCreateResponse } from './embeddings.js';
|
|
9
|
+
export { Files, type FileCreateParams, type FileDeleted, type FileListResponse, type FileObject } from './files.js';
|
|
8
10
|
export { Models, type Model, type ModelListResponse } from './models.js';
|
|
9
11
|
export { Responses, type Annotation, type ContentPart, type ErrorInfo, type FileContentParams, type FunctionCallOutputItem, type FunctionTool, type ImageResult, type ImageSearchResultsOutputItem, type ImageSearchTool, type InputItem, type OutputItem, type ResponseCancelResponse, type ResponseCreateParams, type ResponseCreateParamsBase, type ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming, type ResponseCreateResponse, type ResponseFile, type ResponseFileList, type ResponseRetrieveResponse, type ResponsesCreateParams, type ResponseStreamChunk, type ResponsesUsage } from './responses/responses.js';
|
|
10
12
|
export { Search, type SearchCreateParams, type SearchCreateResponse } from './search.js';
|
package/src/resources/shared.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type * as API from '../generated/api.js';
|
|
2
2
|
export type Annotation = API.Annotation;
|
|
3
3
|
export type APIPublicSearchResult = API.APIPublicSearchResult;
|
|
4
|
+
export type Batch = API.Batch;
|
|
5
|
+
export type BatchCreateParams = API.BatchCreateParams;
|
|
6
|
+
export type BatchListResponse = API.BatchListResponse;
|
|
4
7
|
export type BrowserSessionResponse = API.BrowserSessionResponse;
|
|
5
8
|
export type ChatMessageInput = API.ChatMessageInput;
|
|
6
9
|
export type ChatMessageOutput = API.ChatMessageOutput;
|
|
@@ -18,6 +21,10 @@ export type EmbeddingCreateResponse = API.EmbeddingCreateResponse;
|
|
|
18
21
|
export type EmbeddingObject = API.EmbeddingObject;
|
|
19
22
|
export type EmbeddingsUsage = API.EmbeddingsUsage;
|
|
20
23
|
export type ErrorInfo = API.ErrorInfo;
|
|
24
|
+
export type FileCreateParams = API.FileCreateParams;
|
|
25
|
+
export type FileDeleted = API.FileDeleted;
|
|
26
|
+
export type FileListResponse = API.FileListResponse;
|
|
27
|
+
export type FileObject = API.FileObject;
|
|
21
28
|
export type FunctionCallOutputItem = API.FunctionCallOutputItem;
|
|
22
29
|
export type FunctionTool = API.FunctionTool;
|
|
23
30
|
export type ImageResult = API.ImageResult;
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.41.0'; // x-release-please-version
|