@withone/platform-perplexity 0.0.0-stage → 0.1.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 +64 -2
- package/banner.svg +11 -0
- package/dist/index.d.mts +4071 -0
- package/dist/index.d.ts +4071 -0
- package/dist/index.js +358 -0
- package/dist/index.mjs +304 -0
- package/fingerprint.json +1 -0
- package/package.json +33 -4
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4071 @@
|
|
|
1
|
+
import { Action } from '@withone/sdk/codegen';
|
|
2
|
+
|
|
3
|
+
declare namespace CreateEmbeddingsTypes {
|
|
4
|
+
/**
|
|
5
|
+
* Generates embeddings for one or more input texts. These embeddings can be used for semantic search, clustering, and other machine learning applications.
|
|
6
|
+
*/
|
|
7
|
+
interface Input {
|
|
8
|
+
/**
|
|
9
|
+
* Number of dimensions for output embeddings (Matryoshka). Model-specific ranges: 128–1024 for pplx-embed-v1-0.6b; 128–2560 for pplx-embed-v1-4b. Defaults to the model’s full dimensions (1024 or 2560).
|
|
10
|
+
*/
|
|
11
|
+
dimensions?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Output encoding format for embeddings. base64_int8 returns base64-encoded signed int8 values. base64_binary returns base64-encoded packed binary (1 bit per dimension). Default: base64_int8.
|
|
14
|
+
*/
|
|
15
|
+
encoding_format?: ("base64_int8" | "base64_binary");
|
|
16
|
+
/**
|
|
17
|
+
* Input text(s) to embed.
|
|
18
|
+
*/
|
|
19
|
+
input: (string | string[]);
|
|
20
|
+
/**
|
|
21
|
+
* Embedding model to use.
|
|
22
|
+
*/
|
|
23
|
+
model: ("pplx-embed-v1-0.6b" | "pplx-embed-v1-4b");
|
|
24
|
+
}
|
|
25
|
+
namespace output {
|
|
26
|
+
/**
|
|
27
|
+
* Response structure for embedding creation, including success and validation error responses.
|
|
28
|
+
*/
|
|
29
|
+
interface Output {
|
|
30
|
+
/**
|
|
31
|
+
* List of embedding objects.
|
|
32
|
+
*/
|
|
33
|
+
data?: {
|
|
34
|
+
/**
|
|
35
|
+
* Base64-encoded embedding vector. For base64_int8: decode to a signed int8 array (length = dimensions). For base64_binary: decode to packed bits (length = dimensions / 8 bytes).
|
|
36
|
+
*/
|
|
37
|
+
embedding?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Index of the input text this embedding corresponds to.
|
|
40
|
+
*/
|
|
41
|
+
index?: number;
|
|
42
|
+
/**
|
|
43
|
+
* The object type for the embedding item.
|
|
44
|
+
*/
|
|
45
|
+
object?: string;
|
|
46
|
+
[k: string]: unknown;
|
|
47
|
+
}[];
|
|
48
|
+
/**
|
|
49
|
+
* Validation error details for a 422 Unprocessable Entity response.
|
|
50
|
+
*/
|
|
51
|
+
detail?: {
|
|
52
|
+
/**
|
|
53
|
+
* Location of the validation error.
|
|
54
|
+
*/
|
|
55
|
+
loc?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* Validation error message.
|
|
58
|
+
*/
|
|
59
|
+
msg?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Validation error type.
|
|
62
|
+
*/
|
|
63
|
+
type?: string;
|
|
64
|
+
[k: string]: unknown;
|
|
65
|
+
}[];
|
|
66
|
+
/**
|
|
67
|
+
* The model used to generate embeddings.
|
|
68
|
+
*/
|
|
69
|
+
model?: string;
|
|
70
|
+
/**
|
|
71
|
+
* The object type. Example: "list".
|
|
72
|
+
*/
|
|
73
|
+
object?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Token usage and cost information.
|
|
76
|
+
*/
|
|
77
|
+
usage?: {
|
|
78
|
+
/**
|
|
79
|
+
* Cost breakdown for the request.
|
|
80
|
+
*/
|
|
81
|
+
cost?: {
|
|
82
|
+
/**
|
|
83
|
+
* Currency of the cost values.
|
|
84
|
+
*/
|
|
85
|
+
currency?: "USD";
|
|
86
|
+
/**
|
|
87
|
+
* Cost for input tokens in USD.
|
|
88
|
+
*/
|
|
89
|
+
input_cost?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Total cost for the request in USD.
|
|
92
|
+
*/
|
|
93
|
+
total_cost?: number;
|
|
94
|
+
[k: string]: unknown;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Number of tokens in the input texts.
|
|
98
|
+
*/
|
|
99
|
+
prompt_tokens?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Total number of tokens processed.
|
|
102
|
+
*/
|
|
103
|
+
total_tokens?: number;
|
|
104
|
+
[k: string]: unknown;
|
|
105
|
+
};
|
|
106
|
+
[k: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Builds the `create_embeddings` action.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```json
|
|
115
|
+
* {
|
|
116
|
+
* "dimensions": 512,
|
|
117
|
+
* "encoding_format": "base64_binary",
|
|
118
|
+
* "input": [
|
|
119
|
+
* "First text",
|
|
120
|
+
* "Second text",
|
|
121
|
+
* "Third text"
|
|
122
|
+
* ],
|
|
123
|
+
* "model": "pplx-embed-v1-4b"
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare function createEmbeddings(input: CreateEmbeddingsTypes.Input): Action<CreateEmbeddingsTypes.output.Output>;
|
|
128
|
+
declare namespace GetAsyncChatCompletionResponseTypes {
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves the result of a previously created asynchronous chat completion request. The response includes the request status and, when completed, the generated chat completion payload.
|
|
131
|
+
*/
|
|
132
|
+
interface Input {
|
|
133
|
+
/**
|
|
134
|
+
* Identifier of the async chat completion request whose response you want to retrieve. Must be a non-empty string. CLI --path-vars key must be apiRequest (camelCase, NOT api_request).
|
|
135
|
+
*/
|
|
136
|
+
apiRequest: string;
|
|
137
|
+
}
|
|
138
|
+
namespace output {
|
|
139
|
+
/**
|
|
140
|
+
* Successful or error response returned by the API.
|
|
141
|
+
*/
|
|
142
|
+
interface Output {
|
|
143
|
+
/**
|
|
144
|
+
* Unix timestamp when processing completed (if available).
|
|
145
|
+
*/
|
|
146
|
+
completed_at?: (number | null);
|
|
147
|
+
/**
|
|
148
|
+
* Unix timestamp when the request was created.
|
|
149
|
+
*/
|
|
150
|
+
created_at?: number;
|
|
151
|
+
/**
|
|
152
|
+
* 422 Unprocessable Entity error details for missing or invalid path parameter.
|
|
153
|
+
*/
|
|
154
|
+
detail?: {
|
|
155
|
+
/**
|
|
156
|
+
* Location of the validation error.
|
|
157
|
+
*/
|
|
158
|
+
loc?: string[];
|
|
159
|
+
/**
|
|
160
|
+
* Validation error message.
|
|
161
|
+
*/
|
|
162
|
+
msg?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Validation error type.
|
|
165
|
+
*/
|
|
166
|
+
type?: string;
|
|
167
|
+
[k: string]: unknown;
|
|
168
|
+
}[];
|
|
169
|
+
/**
|
|
170
|
+
* Error message if the request failed.
|
|
171
|
+
*/
|
|
172
|
+
error_message?: (string | null);
|
|
173
|
+
/**
|
|
174
|
+
* Unix timestamp when the request failed (if it failed).
|
|
175
|
+
*/
|
|
176
|
+
failed_at?: (number | null);
|
|
177
|
+
/**
|
|
178
|
+
* Unique identifier for the async request.
|
|
179
|
+
*/
|
|
180
|
+
id?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Model used for the request.
|
|
183
|
+
*/
|
|
184
|
+
model?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The chat completion response payload (present when available).
|
|
187
|
+
*/
|
|
188
|
+
response?: ({
|
|
189
|
+
/**
|
|
190
|
+
* Array of completion choices.
|
|
191
|
+
*/
|
|
192
|
+
choices?: {
|
|
193
|
+
/**
|
|
194
|
+
* Chat message delta output (schema referenced as ChatMessage-Output).
|
|
195
|
+
*/
|
|
196
|
+
delta?: {
|
|
197
|
+
[k: string]: unknown;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Reason generation finished. Allowed: "stop", "length".
|
|
201
|
+
*/
|
|
202
|
+
finish_reason?: ("stop" | "length" | null);
|
|
203
|
+
/**
|
|
204
|
+
* Index of the choice in the array.
|
|
205
|
+
*/
|
|
206
|
+
index?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Chat message output (schema referenced as ChatMessage-Output).
|
|
209
|
+
*/
|
|
210
|
+
message?: {
|
|
211
|
+
[k: string]: unknown;
|
|
212
|
+
};
|
|
213
|
+
[k: string]: unknown;
|
|
214
|
+
}[];
|
|
215
|
+
/**
|
|
216
|
+
* List of citation strings, if provided.
|
|
217
|
+
*/
|
|
218
|
+
citations?: (string[] | null);
|
|
219
|
+
/**
|
|
220
|
+
* Unix timestamp when the completion was created.
|
|
221
|
+
*/
|
|
222
|
+
created?: number;
|
|
223
|
+
/**
|
|
224
|
+
* Unique identifier for the completion.
|
|
225
|
+
*/
|
|
226
|
+
id?: string;
|
|
227
|
+
/**
|
|
228
|
+
* Images returned by the model, if any.
|
|
229
|
+
*/
|
|
230
|
+
images?: ({
|
|
231
|
+
/**
|
|
232
|
+
* Height of the image in pixels.
|
|
233
|
+
*/
|
|
234
|
+
height?: number;
|
|
235
|
+
/**
|
|
236
|
+
* URL of the image.
|
|
237
|
+
*/
|
|
238
|
+
image_url?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Original URL where the image was found.
|
|
241
|
+
*/
|
|
242
|
+
origin_url?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Width of the image in pixels.
|
|
245
|
+
*/
|
|
246
|
+
width?: number;
|
|
247
|
+
[k: string]: unknown;
|
|
248
|
+
}[] | null);
|
|
249
|
+
/**
|
|
250
|
+
* Model used for generation.
|
|
251
|
+
*/
|
|
252
|
+
model?: string;
|
|
253
|
+
/**
|
|
254
|
+
* Object type identifier. Default: "chat.completion".
|
|
255
|
+
*/
|
|
256
|
+
object?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Related questions, if any.
|
|
259
|
+
*/
|
|
260
|
+
related_questions?: (string[] | null);
|
|
261
|
+
/**
|
|
262
|
+
* Search results used/returned by the model, if any.
|
|
263
|
+
*/
|
|
264
|
+
search_results?: ({
|
|
265
|
+
/**
|
|
266
|
+
* Date associated with the result (if provided).
|
|
267
|
+
*/
|
|
268
|
+
date?: (string | null);
|
|
269
|
+
/**
|
|
270
|
+
* Last updated timestamp/date for the result (if provided).
|
|
271
|
+
*/
|
|
272
|
+
last_updated?: (string | null);
|
|
273
|
+
/**
|
|
274
|
+
* Text snippet from the search result. Default: "".
|
|
275
|
+
*/
|
|
276
|
+
snippet?: string;
|
|
277
|
+
/**
|
|
278
|
+
* Source type. Allowed: web, attachment. Default: "web".
|
|
279
|
+
*/
|
|
280
|
+
source?: ("web" | "attachment");
|
|
281
|
+
/**
|
|
282
|
+
* URL of the search result page.
|
|
283
|
+
*/
|
|
284
|
+
url?: string;
|
|
285
|
+
[k: string]: unknown;
|
|
286
|
+
}[] | null);
|
|
287
|
+
/**
|
|
288
|
+
* Usage information (schema referenced as UsageInfo).
|
|
289
|
+
*/
|
|
290
|
+
usage?: ({
|
|
291
|
+
[k: string]: unknown;
|
|
292
|
+
} | null);
|
|
293
|
+
[k: string]: unknown;
|
|
294
|
+
} | null);
|
|
295
|
+
/**
|
|
296
|
+
* Unix timestamp when processing started (if available).
|
|
297
|
+
*/
|
|
298
|
+
started_at?: (number | null);
|
|
299
|
+
/**
|
|
300
|
+
* Async request status. Allowed: "CREATED", "IN_PROGRESS", "COMPLETED", "FAILED".
|
|
301
|
+
*/
|
|
302
|
+
status?: ("CREATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED");
|
|
303
|
+
[k: string]: unknown;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Builds the `get_async_chat_completion_response` action.
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```json
|
|
312
|
+
* {
|
|
313
|
+
* "apiRequest": "req_abc123"
|
|
314
|
+
* }
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
declare function getAsyncChatCompletionResponse(input: GetAsyncChatCompletionResponseTypes.Input): Action<GetAsyncChatCompletionResponseTypes.output.Output>;
|
|
318
|
+
declare namespace SearchWebTypes {
|
|
319
|
+
/**
|
|
320
|
+
* Searches the web for the given query and returns a list of relevant web pages with extracted snippets and optional date metadata.
|
|
321
|
+
*/
|
|
322
|
+
interface Input {
|
|
323
|
+
/**
|
|
324
|
+
* ISO 3166-1 alpha-2 country code.
|
|
325
|
+
*/
|
|
326
|
+
country?: string;
|
|
327
|
+
/**
|
|
328
|
+
* Filter results to pages last updated after this value. Format not specified in source.
|
|
329
|
+
*/
|
|
330
|
+
last_updated_after_filter?: string;
|
|
331
|
+
/**
|
|
332
|
+
* Filter results to pages last updated before this value. Format not specified in source.
|
|
333
|
+
*/
|
|
334
|
+
last_updated_before_filter?: string;
|
|
335
|
+
/**
|
|
336
|
+
* Maximum number of results to return. Default: 10.
|
|
337
|
+
*/
|
|
338
|
+
max_results?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Maximum tokens for context. Default: 10000.
|
|
341
|
+
*/
|
|
342
|
+
max_tokens?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Maximum tokens per page. Default: 4096.
|
|
345
|
+
*/
|
|
346
|
+
max_tokens_per_page?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Search query text. Can be a single string or an array of strings.
|
|
349
|
+
*/
|
|
350
|
+
query: (string | string[]);
|
|
351
|
+
/**
|
|
352
|
+
* Filter results to pages with dates after this value. Format not specified in source.
|
|
353
|
+
*/
|
|
354
|
+
search_after_date_filter?: string;
|
|
355
|
+
/**
|
|
356
|
+
* Filter results to pages with dates before this value. Format not specified in source.
|
|
357
|
+
*/
|
|
358
|
+
search_before_date_filter?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Filter results to specific domain(s).
|
|
361
|
+
*/
|
|
362
|
+
search_domain_filter?: string[];
|
|
363
|
+
/**
|
|
364
|
+
* Filter results by language(s).
|
|
365
|
+
*/
|
|
366
|
+
search_language_filter?: string[];
|
|
367
|
+
/**
|
|
368
|
+
* Recency filter.
|
|
369
|
+
*/
|
|
370
|
+
search_recency_filter?: ("hour" | "day" | "week" | "month" | "year");
|
|
371
|
+
}
|
|
372
|
+
namespace output {
|
|
373
|
+
/**
|
|
374
|
+
* Response structure for web search, including success and validation error responses.
|
|
375
|
+
*/
|
|
376
|
+
interface Output {
|
|
377
|
+
/**
|
|
378
|
+
* Validation error details returned on 422 Client Error.
|
|
379
|
+
*/
|
|
380
|
+
detail?: {
|
|
381
|
+
/**
|
|
382
|
+
* Location of the validation error.
|
|
383
|
+
*/
|
|
384
|
+
loc?: string[];
|
|
385
|
+
/**
|
|
386
|
+
* Validation error message.
|
|
387
|
+
*/
|
|
388
|
+
msg?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Validation error type.
|
|
391
|
+
*/
|
|
392
|
+
type?: string;
|
|
393
|
+
[k: string]: unknown;
|
|
394
|
+
}[];
|
|
395
|
+
/**
|
|
396
|
+
* Identifier for this search request/response.
|
|
397
|
+
*/
|
|
398
|
+
id?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Array of search results.
|
|
401
|
+
*/
|
|
402
|
+
results?: {
|
|
403
|
+
/**
|
|
404
|
+
* Page date (if available).
|
|
405
|
+
*/
|
|
406
|
+
date?: (string | null);
|
|
407
|
+
/**
|
|
408
|
+
* Page last-updated timestamp (if available).
|
|
409
|
+
*/
|
|
410
|
+
last_updated?: (string | null);
|
|
411
|
+
/**
|
|
412
|
+
* Content snippet extracted from the page.
|
|
413
|
+
*/
|
|
414
|
+
snippet?: string;
|
|
415
|
+
/**
|
|
416
|
+
* URL of the page.
|
|
417
|
+
*/
|
|
418
|
+
url?: string;
|
|
419
|
+
[k: string]: unknown;
|
|
420
|
+
}[];
|
|
421
|
+
/**
|
|
422
|
+
* Server time (if provided).
|
|
423
|
+
*/
|
|
424
|
+
server_time?: (string | null);
|
|
425
|
+
[k: string]: unknown;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Builds the `search_web` action.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```json
|
|
434
|
+
* {
|
|
435
|
+
* "country": "US",
|
|
436
|
+
* "last_updated_after_filter": "2025-01-01T00:00:00Z",
|
|
437
|
+
* "last_updated_before_filter": "2025-12-31T23:59:59Z",
|
|
438
|
+
* "max_results": 10,
|
|
439
|
+
* "max_tokens": 10000,
|
|
440
|
+
* "max_tokens_per_page": 4096,
|
|
441
|
+
* "query": [
|
|
442
|
+
* "site:who.int mpox guidance",
|
|
443
|
+
* "CDC mpox vaccine recommendations"
|
|
444
|
+
* ],
|
|
445
|
+
* "search_after_date_filter": "2025-01-01",
|
|
446
|
+
* "search_before_date_filter": "2025-12-31",
|
|
447
|
+
* "search_domain_filter": [
|
|
448
|
+
* "who.int",
|
|
449
|
+
* "cdc.gov"
|
|
450
|
+
* ],
|
|
451
|
+
* "search_language_filter": [
|
|
452
|
+
* "en"
|
|
453
|
+
* ],
|
|
454
|
+
* "search_recency_filter": "month"
|
|
455
|
+
* }
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
declare function searchWeb(input: SearchWebTypes.Input): Action<SearchWebTypes.output.Output>;
|
|
459
|
+
declare namespace ListAsyncChatCompletionsAuthenticatedUserTypes {
|
|
460
|
+
/**
|
|
461
|
+
* Retrieves a list of all asynchronous chat completion requests for the current user, including each request’s timestamps, model, and processing status.
|
|
462
|
+
*/
|
|
463
|
+
interface Input {
|
|
464
|
+
}
|
|
465
|
+
namespace output {
|
|
466
|
+
/**
|
|
467
|
+
* Response returned when listing asynchronous chat completion requests for the authenticated user.
|
|
468
|
+
*/
|
|
469
|
+
interface Output {
|
|
470
|
+
/**
|
|
471
|
+
* Validation error details returned for an unprocessable request.
|
|
472
|
+
*/
|
|
473
|
+
detail?: {
|
|
474
|
+
/**
|
|
475
|
+
* Location of the validation error.
|
|
476
|
+
*/
|
|
477
|
+
loc?: string[];
|
|
478
|
+
/**
|
|
479
|
+
* Validation error message.
|
|
480
|
+
*/
|
|
481
|
+
msg?: string;
|
|
482
|
+
/**
|
|
483
|
+
* Validation error type.
|
|
484
|
+
*/
|
|
485
|
+
type?: string;
|
|
486
|
+
[k: string]: unknown;
|
|
487
|
+
}[];
|
|
488
|
+
/**
|
|
489
|
+
* Pagination token for retrieving the next page of results (if any).
|
|
490
|
+
*/
|
|
491
|
+
next_token?: (string | null);
|
|
492
|
+
/**
|
|
493
|
+
* List of asynchronous chat completion requests.
|
|
494
|
+
*/
|
|
495
|
+
requests?: {
|
|
496
|
+
/**
|
|
497
|
+
* Unix timestamp (seconds) when processing completed successfully, if completed.
|
|
498
|
+
*/
|
|
499
|
+
completed_at?: (number | null);
|
|
500
|
+
/**
|
|
501
|
+
* Unix timestamp (seconds) when the request was created.
|
|
502
|
+
*/
|
|
503
|
+
created_at?: number;
|
|
504
|
+
/**
|
|
505
|
+
* Unix timestamp (seconds) when processing failed, if failed.
|
|
506
|
+
*/
|
|
507
|
+
failed_at?: (number | null);
|
|
508
|
+
/**
|
|
509
|
+
* Unique identifier for the async request.
|
|
510
|
+
*/
|
|
511
|
+
id?: string;
|
|
512
|
+
/**
|
|
513
|
+
* Model used for the request.
|
|
514
|
+
*/
|
|
515
|
+
model?: string;
|
|
516
|
+
/**
|
|
517
|
+
* Unix timestamp (seconds) when processing started, if started.
|
|
518
|
+
*/
|
|
519
|
+
started_at?: (number | null);
|
|
520
|
+
/**
|
|
521
|
+
* Current processing status of the async request (AsyncProcessingStatus enum; exact values not provided in scraped content).
|
|
522
|
+
*/
|
|
523
|
+
status?: string;
|
|
524
|
+
[k: string]: unknown;
|
|
525
|
+
}[];
|
|
526
|
+
[k: string]: unknown;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Builds the `list_async_chat_completions_authenticated_user` action.
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```json
|
|
535
|
+
* {}
|
|
536
|
+
* ```
|
|
537
|
+
*/
|
|
538
|
+
declare function listAsyncChatCompletionsAuthenticatedUser(input: ListAsyncChatCompletionsAuthenticatedUserTypes.Input): Action<ListAsyncChatCompletionsAuthenticatedUserTypes.output.Output>;
|
|
539
|
+
declare namespace CreateContextualizedEmbeddingsTypes {
|
|
540
|
+
/**
|
|
541
|
+
* Generates contextualized embeddings for chunked documents. Chunks within the same document are embedded with document-level context awareness, improving retrieval quality for document-based applications.
|
|
542
|
+
*/
|
|
543
|
+
interface Input {
|
|
544
|
+
/**
|
|
545
|
+
* Output embedding dimensionality (Matryoshka). Valid ranges depend on model: for pplx-embed-context-v1-0.6b → 128–1024; for pplx-embed-context-v1-4b → 128–2560. Defaults to full dimensions (1024 for 0.6b, 2560 for 4b).
|
|
546
|
+
*/
|
|
547
|
+
dimensions?: number;
|
|
548
|
+
/**
|
|
549
|
+
* Output encoding format for embeddings. Default: base64_int8. base64_int8 decodes to signed int8 array (length = dimensions). base64_binary decodes to packed bits (length = dimensions / 8 bytes).
|
|
550
|
+
*/
|
|
551
|
+
encoding_format?: ("base64_int8" | "base64_binary");
|
|
552
|
+
/**
|
|
553
|
+
* Nested array of document chunks. Each inner array represents one document, containing chunk strings for that document. Constraints: max 512 documents; total chunks across all documents ≤ 16,000; total tokens per document ≤ 32K; all chunks in a request combined ≤ 120,000 tokens; empty strings not allowed.
|
|
554
|
+
*
|
|
555
|
+
* @maxItems 512
|
|
556
|
+
*/
|
|
557
|
+
input: string[][];
|
|
558
|
+
/**
|
|
559
|
+
* Contextualized embedding model.
|
|
560
|
+
*/
|
|
561
|
+
model: ("pplx-embed-context-v1-0.6b" | "pplx-embed-context-v1-4b");
|
|
562
|
+
}
|
|
563
|
+
namespace output {
|
|
564
|
+
/**
|
|
565
|
+
* Response for contextualized embeddings creation, including successful embedding results or validation errors.
|
|
566
|
+
*/
|
|
567
|
+
interface Output {
|
|
568
|
+
/**
|
|
569
|
+
* List of contextualized embedding results, one per input document.
|
|
570
|
+
*/
|
|
571
|
+
data?: {
|
|
572
|
+
/**
|
|
573
|
+
* List of embedding objects for chunks in this document.
|
|
574
|
+
*/
|
|
575
|
+
data?: {
|
|
576
|
+
/**
|
|
577
|
+
* Base64-encoded embedding vector. Interpretation depends on encoding_format.
|
|
578
|
+
*/
|
|
579
|
+
embedding?: string;
|
|
580
|
+
/**
|
|
581
|
+
* Index of the chunk within the document (matches the inner array index).
|
|
582
|
+
*/
|
|
583
|
+
index?: number;
|
|
584
|
+
/**
|
|
585
|
+
* Object type for an embedding item.
|
|
586
|
+
*/
|
|
587
|
+
object?: string;
|
|
588
|
+
[k: string]: unknown;
|
|
589
|
+
}[];
|
|
590
|
+
/**
|
|
591
|
+
* Index of the document this result corresponds to (matches the outer input array index).
|
|
592
|
+
*/
|
|
593
|
+
index?: number;
|
|
594
|
+
/**
|
|
595
|
+
* Object type for the document-level embedding container.
|
|
596
|
+
*/
|
|
597
|
+
object?: string;
|
|
598
|
+
[k: string]: unknown;
|
|
599
|
+
}[];
|
|
600
|
+
/**
|
|
601
|
+
* Validation error details for 422 Unprocessable Entity responses.
|
|
602
|
+
*/
|
|
603
|
+
detail?: {
|
|
604
|
+
/**
|
|
605
|
+
* Location of the validation issue.
|
|
606
|
+
*/
|
|
607
|
+
loc?: (string | number)[];
|
|
608
|
+
/**
|
|
609
|
+
* Validation error message.
|
|
610
|
+
*/
|
|
611
|
+
msg?: string;
|
|
612
|
+
/**
|
|
613
|
+
* Validation error type.
|
|
614
|
+
*/
|
|
615
|
+
type?: string;
|
|
616
|
+
[k: string]: unknown;
|
|
617
|
+
}[];
|
|
618
|
+
/**
|
|
619
|
+
* Model used to generate embeddings.
|
|
620
|
+
*/
|
|
621
|
+
model?: string;
|
|
622
|
+
/**
|
|
623
|
+
* Top-level object type. Example: "list".
|
|
624
|
+
*/
|
|
625
|
+
object?: string;
|
|
626
|
+
/**
|
|
627
|
+
* Token usage and cost details.
|
|
628
|
+
*/
|
|
629
|
+
usage?: {
|
|
630
|
+
/**
|
|
631
|
+
* Cost breakdown.
|
|
632
|
+
*/
|
|
633
|
+
cost?: {
|
|
634
|
+
/**
|
|
635
|
+
* Currency for cost values. Allowed value shown: USD.
|
|
636
|
+
*/
|
|
637
|
+
currency?: "USD";
|
|
638
|
+
/**
|
|
639
|
+
* Cost for input tokens (USD).
|
|
640
|
+
*/
|
|
641
|
+
input_cost?: number;
|
|
642
|
+
/**
|
|
643
|
+
* Total cost for the request (USD).
|
|
644
|
+
*/
|
|
645
|
+
total_cost?: number;
|
|
646
|
+
[k: string]: unknown;
|
|
647
|
+
};
|
|
648
|
+
/**
|
|
649
|
+
* Number of tokens in the input texts.
|
|
650
|
+
*/
|
|
651
|
+
prompt_tokens?: number;
|
|
652
|
+
/**
|
|
653
|
+
* Total tokens processed.
|
|
654
|
+
*/
|
|
655
|
+
total_tokens?: number;
|
|
656
|
+
[k: string]: unknown;
|
|
657
|
+
};
|
|
658
|
+
[k: string]: unknown;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Builds the `create_contextualized_embeddings` action.
|
|
664
|
+
*
|
|
665
|
+
* @example
|
|
666
|
+
* ```json
|
|
667
|
+
* {
|
|
668
|
+
* "dimensions": 2560,
|
|
669
|
+
* "encoding_format": "base64_int8",
|
|
670
|
+
* "input": [
|
|
671
|
+
* [
|
|
672
|
+
* "Chunk 1 from document A",
|
|
673
|
+
* "Chunk 2 from document A"
|
|
674
|
+
* ],
|
|
675
|
+
* [
|
|
676
|
+
* "Chunk 1 from document B"
|
|
677
|
+
* ]
|
|
678
|
+
* ],
|
|
679
|
+
* "model": "pplx-embed-context-v1-4b"
|
|
680
|
+
* }
|
|
681
|
+
* ```
|
|
682
|
+
*/
|
|
683
|
+
declare function createContextualizedEmbeddings(input: CreateContextualizedEmbeddingsTypes.Input): Action<CreateContextualizedEmbeddingsTypes.output.Output>;
|
|
684
|
+
declare namespace CreateAgentResponseTypes {
|
|
685
|
+
/**
|
|
686
|
+
* Generates a response for the provided input, with optional web search, tool usage, and configurable reasoning. Returns either a JSON response (default) or an SSE stream when `stream` is `true`.
|
|
687
|
+
*/
|
|
688
|
+
interface Input {
|
|
689
|
+
/**
|
|
690
|
+
* JSON request body for creating an agent response.
|
|
691
|
+
*/
|
|
692
|
+
body: {
|
|
693
|
+
[k: string]: unknown;
|
|
694
|
+
};
|
|
695
|
+
headers: {
|
|
696
|
+
/**
|
|
697
|
+
* Accepted response content type. Use `application/json` for JSON responses or `text/event-stream` for SSE streaming.
|
|
698
|
+
*/
|
|
699
|
+
Accept: string;
|
|
700
|
+
[k: string]: unknown;
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
namespace output {
|
|
704
|
+
/**
|
|
705
|
+
* Successful response structure from the Perplexity Agent API. Returns either a JSON response or an SSE stream depending on the `stream` setting.
|
|
706
|
+
*/
|
|
707
|
+
interface Output {
|
|
708
|
+
/**
|
|
709
|
+
* Response payload, either a JSON response object or an SSE event stream represented as an array of event objects.
|
|
710
|
+
*/
|
|
711
|
+
body?: ({
|
|
712
|
+
/**
|
|
713
|
+
* Unix timestamp when the response was created.
|
|
714
|
+
*/
|
|
715
|
+
created_at?: number;
|
|
716
|
+
/**
|
|
717
|
+
* Error information (present when an error occurs).
|
|
718
|
+
*/
|
|
719
|
+
error?: {
|
|
720
|
+
/**
|
|
721
|
+
* Error code.
|
|
722
|
+
*/
|
|
723
|
+
code?: string;
|
|
724
|
+
/**
|
|
725
|
+
* Human-readable error message.
|
|
726
|
+
*/
|
|
727
|
+
message?: string;
|
|
728
|
+
/**
|
|
729
|
+
* Error type category.
|
|
730
|
+
*/
|
|
731
|
+
type?: string;
|
|
732
|
+
[k: string]: unknown;
|
|
733
|
+
};
|
|
734
|
+
/**
|
|
735
|
+
* Unique identifier for the response.
|
|
736
|
+
*/
|
|
737
|
+
id?: string;
|
|
738
|
+
/**
|
|
739
|
+
* Model used for generation.
|
|
740
|
+
*/
|
|
741
|
+
model?: string;
|
|
742
|
+
/**
|
|
743
|
+
* Object type.
|
|
744
|
+
*/
|
|
745
|
+
object?: "response";
|
|
746
|
+
/**
|
|
747
|
+
* Array of output items (messages, search results, tool calls).
|
|
748
|
+
*/
|
|
749
|
+
output?: {
|
|
750
|
+
[k: string]: unknown;
|
|
751
|
+
}[];
|
|
752
|
+
/**
|
|
753
|
+
* Response status.
|
|
754
|
+
*/
|
|
755
|
+
status?: ("completed" | "failed" | "in_progress" | "requires_action");
|
|
756
|
+
/**
|
|
757
|
+
* Token usage and cost metadata.
|
|
758
|
+
*/
|
|
759
|
+
usage?: {
|
|
760
|
+
/**
|
|
761
|
+
* A ResponsesCost object (shape not specified in scraped content).
|
|
762
|
+
*/
|
|
763
|
+
cost?: {
|
|
764
|
+
[k: string]: unknown;
|
|
765
|
+
};
|
|
766
|
+
/**
|
|
767
|
+
* Number of input tokens used.
|
|
768
|
+
*/
|
|
769
|
+
input_tokens?: number;
|
|
770
|
+
/**
|
|
771
|
+
* Input token breakdown.
|
|
772
|
+
*/
|
|
773
|
+
input_tokens_details?: {
|
|
774
|
+
/**
|
|
775
|
+
* Tokens used for cache creation.
|
|
776
|
+
*/
|
|
777
|
+
cache_creation_input_tokens?: number;
|
|
778
|
+
/**
|
|
779
|
+
* Tokens read from cache.
|
|
780
|
+
*/
|
|
781
|
+
cache_read_input_tokens?: number;
|
|
782
|
+
[k: string]: unknown;
|
|
783
|
+
};
|
|
784
|
+
/**
|
|
785
|
+
* Number of output tokens generated.
|
|
786
|
+
*/
|
|
787
|
+
output_tokens?: number;
|
|
788
|
+
/**
|
|
789
|
+
* Map of tool call details keyed by string. Values are ToolCallDetails (shape not specified in scraped content).
|
|
790
|
+
*/
|
|
791
|
+
tool_calls_details?: {
|
|
792
|
+
[k: string]: unknown;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* Total tokens used (`input + output`).
|
|
796
|
+
*/
|
|
797
|
+
total_tokens?: number;
|
|
798
|
+
[k: string]: unknown;
|
|
799
|
+
};
|
|
800
|
+
[k: string]: unknown;
|
|
801
|
+
} | {
|
|
802
|
+
/**
|
|
803
|
+
* Fetched contents included in some events.
|
|
804
|
+
*/
|
|
805
|
+
contents?: {
|
|
806
|
+
[k: string]: unknown;
|
|
807
|
+
}[];
|
|
808
|
+
/**
|
|
809
|
+
* Delta payload for streaming events.
|
|
810
|
+
*/
|
|
811
|
+
delta?: (string | {
|
|
812
|
+
[k: string]: unknown;
|
|
813
|
+
});
|
|
814
|
+
/**
|
|
815
|
+
* Error payload for error events.
|
|
816
|
+
*/
|
|
817
|
+
error?: {
|
|
818
|
+
code?: string;
|
|
819
|
+
message?: string;
|
|
820
|
+
type?: string;
|
|
821
|
+
[k: string]: unknown;
|
|
822
|
+
};
|
|
823
|
+
/**
|
|
824
|
+
* Output item included in some events.
|
|
825
|
+
*/
|
|
826
|
+
item?: {
|
|
827
|
+
[k: string]: unknown;
|
|
828
|
+
};
|
|
829
|
+
/**
|
|
830
|
+
* Output item index for item/delta events.
|
|
831
|
+
*/
|
|
832
|
+
output_index?: number;
|
|
833
|
+
/**
|
|
834
|
+
* Search-related queries included in some events.
|
|
835
|
+
*/
|
|
836
|
+
queries?: string[];
|
|
837
|
+
/**
|
|
838
|
+
* Response object included in some events.
|
|
839
|
+
*/
|
|
840
|
+
response?: {
|
|
841
|
+
[k: string]: unknown;
|
|
842
|
+
};
|
|
843
|
+
/**
|
|
844
|
+
* Search or fetch results included in some events.
|
|
845
|
+
*/
|
|
846
|
+
results?: {
|
|
847
|
+
[k: string]: unknown;
|
|
848
|
+
}[];
|
|
849
|
+
/**
|
|
850
|
+
* Sequence number for event ordering.
|
|
851
|
+
*/
|
|
852
|
+
sequence_number?: number;
|
|
853
|
+
/**
|
|
854
|
+
* Event type.
|
|
855
|
+
*/
|
|
856
|
+
type?: string;
|
|
857
|
+
/**
|
|
858
|
+
* URLs included in some fetch-related events.
|
|
859
|
+
*/
|
|
860
|
+
urls?: string[];
|
|
861
|
+
[k: string]: unknown;
|
|
862
|
+
}[]);
|
|
863
|
+
/**
|
|
864
|
+
* Response content type depends on `stream`: `application/json` for non-streaming responses, `text/event-stream` for SSE streaming.
|
|
865
|
+
*/
|
|
866
|
+
contentType?: ("application/json" | "text/event-stream");
|
|
867
|
+
[k: string]: unknown;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Builds the `create_agent_response` action.
|
|
873
|
+
*
|
|
874
|
+
* @example
|
|
875
|
+
* ```json
|
|
876
|
+
* {
|
|
877
|
+
* "body": {
|
|
878
|
+
* "input": "Summarize the main points of the latest AI safety discussions.",
|
|
879
|
+
* "instructions": "Provide a concise summary with bullet points.",
|
|
880
|
+
* "language_preference": "en",
|
|
881
|
+
* "max_output_tokens": 300,
|
|
882
|
+
* "max_steps": 3,
|
|
883
|
+
* "model": "openai/gpt-4o",
|
|
884
|
+
* "models": [
|
|
885
|
+
* "openai/gpt-4o",
|
|
886
|
+
* "xai/grok-4-1"
|
|
887
|
+
* ],
|
|
888
|
+
* "preset": "fast-search",
|
|
889
|
+
* "reasoning": {
|
|
890
|
+
* "effort": "medium"
|
|
891
|
+
* },
|
|
892
|
+
* "response_format": {
|
|
893
|
+
* "json_schema": {
|
|
894
|
+
* "name": "summary_response",
|
|
895
|
+
* "schema": {
|
|
896
|
+
* "properties": {
|
|
897
|
+
* "summary": {
|
|
898
|
+
* "type": "string"
|
|
899
|
+
* }
|
|
900
|
+
* },
|
|
901
|
+
* "type": "object"
|
|
902
|
+
* }
|
|
903
|
+
* },
|
|
904
|
+
* "type": "json_schema"
|
|
905
|
+
* },
|
|
906
|
+
* "stream": false,
|
|
907
|
+
* "tools": [
|
|
908
|
+
* {
|
|
909
|
+
* "type": "web_search"
|
|
910
|
+
* },
|
|
911
|
+
* {
|
|
912
|
+
* "type": "fetch_url"
|
|
913
|
+
* },
|
|
914
|
+
* {
|
|
915
|
+
* "name": "lookup_fact",
|
|
916
|
+
* "type": "function"
|
|
917
|
+
* }
|
|
918
|
+
* ]
|
|
919
|
+
* },
|
|
920
|
+
* "headers": {
|
|
921
|
+
* "Accept": "application/json",
|
|
922
|
+
* "Content-Type": "application/json"
|
|
923
|
+
* }
|
|
924
|
+
* }
|
|
925
|
+
* ```
|
|
926
|
+
*/
|
|
927
|
+
declare function createAgentResponse(input: CreateAgentResponseTypes.Input): Action<CreateAgentResponseTypes.output.Output>;
|
|
928
|
+
declare namespace CreateChatCompletionTypes {
|
|
929
|
+
/**
|
|
930
|
+
* Generates a chat completion response for a provided conversation history (`messages`). Supports optional streaming, response formatting (plain text or JSON schema), and web search configuration.
|
|
931
|
+
*/
|
|
932
|
+
interface Input {
|
|
933
|
+
/**
|
|
934
|
+
* Disable search.
|
|
935
|
+
*/
|
|
936
|
+
disable_search?: (boolean | null);
|
|
937
|
+
/**
|
|
938
|
+
* Enable search classifier.
|
|
939
|
+
*/
|
|
940
|
+
enable_search_classifier?: (boolean | null);
|
|
941
|
+
/**
|
|
942
|
+
* Image domain filter list.
|
|
943
|
+
*/
|
|
944
|
+
image_domain_filter?: (string[] | null);
|
|
945
|
+
/**
|
|
946
|
+
* Image format filter list.
|
|
947
|
+
*/
|
|
948
|
+
image_format_filter?: (string[] | null);
|
|
949
|
+
/**
|
|
950
|
+
* Language preference (string format not specified).
|
|
951
|
+
*/
|
|
952
|
+
language_preference?: (string | null);
|
|
953
|
+
/**
|
|
954
|
+
* Last-updated-after filter (string format not specified).
|
|
955
|
+
*/
|
|
956
|
+
last_updated_after_filter?: (string | null);
|
|
957
|
+
/**
|
|
958
|
+
* Last-updated-before filter (string format not specified).
|
|
959
|
+
*/
|
|
960
|
+
last_updated_before_filter?: (string | null);
|
|
961
|
+
/**
|
|
962
|
+
* Maximum tokens to generate.
|
|
963
|
+
*/
|
|
964
|
+
max_tokens?: (number | null);
|
|
965
|
+
/**
|
|
966
|
+
* Array of messages forming the conversation history.
|
|
967
|
+
*/
|
|
968
|
+
messages: {
|
|
969
|
+
/**
|
|
970
|
+
* Message content. Can be a string, or an array of chunks (text/image/file/pdf/video chunk types), or null.
|
|
971
|
+
*/
|
|
972
|
+
content?: (string | {
|
|
973
|
+
[k: string]: unknown;
|
|
974
|
+
}[] | null);
|
|
975
|
+
/**
|
|
976
|
+
* Role for the message (exact enum values not provided in scraped content).
|
|
977
|
+
*/
|
|
978
|
+
role?: string;
|
|
979
|
+
}[];
|
|
980
|
+
/**
|
|
981
|
+
* Model to use. Supported values for sync: `sonar`, `sonar-pro`, `sonar-reasoning-pro`. Do NOT use `sonar-deep-research` on this endpoint because it will timeout with 502 Bad Gateway.
|
|
982
|
+
*/
|
|
983
|
+
model: ("sonar" | "sonar-pro" | "sonar-deep-research" | "sonar-reasoning-pro");
|
|
984
|
+
/**
|
|
985
|
+
* Reasoning effort.
|
|
986
|
+
*/
|
|
987
|
+
reasoning_effort?: ("minimal" | "low" | "medium" | "high" | null);
|
|
988
|
+
/**
|
|
989
|
+
* Response formatting control. One of: `{ "type": "text" }` or `{ "type": "json_schema", "json_schema": <JSONSchema> }` or `null`.
|
|
990
|
+
*/
|
|
991
|
+
response_format?: ({
|
|
992
|
+
/**
|
|
993
|
+
* JSON Schema to use when `type` is `json_schema`.
|
|
994
|
+
*/
|
|
995
|
+
json_schema?: {
|
|
996
|
+
[k: string]: unknown;
|
|
997
|
+
};
|
|
998
|
+
/**
|
|
999
|
+
* Response format type.
|
|
1000
|
+
*/
|
|
1001
|
+
type: ("text" | "json_schema");
|
|
1002
|
+
} | null);
|
|
1003
|
+
/**
|
|
1004
|
+
* Whether to return images.
|
|
1005
|
+
*/
|
|
1006
|
+
return_images?: (boolean | null);
|
|
1007
|
+
/**
|
|
1008
|
+
* Whether to return related questions.
|
|
1009
|
+
*/
|
|
1010
|
+
return_related_questions?: (boolean | null);
|
|
1011
|
+
/**
|
|
1012
|
+
* Search after date filter (string format not specified).
|
|
1013
|
+
*/
|
|
1014
|
+
search_after_date_filter?: (string | null);
|
|
1015
|
+
/**
|
|
1016
|
+
* Search before date filter (string format not specified).
|
|
1017
|
+
*/
|
|
1018
|
+
search_before_date_filter?: (string | null);
|
|
1019
|
+
/**
|
|
1020
|
+
* Domain filter list.
|
|
1021
|
+
*/
|
|
1022
|
+
search_domain_filter?: (string[] | null);
|
|
1023
|
+
/**
|
|
1024
|
+
* Language filter list.
|
|
1025
|
+
*/
|
|
1026
|
+
search_language_filter?: (string[] | null);
|
|
1027
|
+
/**
|
|
1028
|
+
* Search mode.
|
|
1029
|
+
*/
|
|
1030
|
+
search_mode?: ("web" | "academic" | "sec" | null);
|
|
1031
|
+
/**
|
|
1032
|
+
* Search recency filter.
|
|
1033
|
+
*/
|
|
1034
|
+
search_recency_filter?: ("hour" | "day" | "week" | "month" | "year" | null);
|
|
1035
|
+
/**
|
|
1036
|
+
* Stop sequence(s).
|
|
1037
|
+
*/
|
|
1038
|
+
stop?: (string | string[] | null);
|
|
1039
|
+
/**
|
|
1040
|
+
* Whether to stream the response.
|
|
1041
|
+
*/
|
|
1042
|
+
stream?: (boolean | null);
|
|
1043
|
+
/**
|
|
1044
|
+
* Streaming event format mode. Default: `full`.
|
|
1045
|
+
*/
|
|
1046
|
+
stream_mode?: ("full" | "concise");
|
|
1047
|
+
/**
|
|
1048
|
+
* Sampling temperature.
|
|
1049
|
+
*/
|
|
1050
|
+
temperature?: (number | null);
|
|
1051
|
+
/**
|
|
1052
|
+
* Nucleus sampling parameter.
|
|
1053
|
+
*/
|
|
1054
|
+
top_p?: (number | null);
|
|
1055
|
+
/**
|
|
1056
|
+
* Web search configuration object.
|
|
1057
|
+
*/
|
|
1058
|
+
web_search_options?: {
|
|
1059
|
+
/**
|
|
1060
|
+
* When `true`, applies enhanced relevance filtering to image results. Default: `false`.
|
|
1061
|
+
*/
|
|
1062
|
+
image_results_enhanced_relevance?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* Amount of search context to include. Default: `low`.
|
|
1065
|
+
*/
|
|
1066
|
+
search_context_size?: ("low" | "medium" | "high");
|
|
1067
|
+
/**
|
|
1068
|
+
* Search type.
|
|
1069
|
+
*/
|
|
1070
|
+
search_type?: ("fast" | "pro" | "auto" | null);
|
|
1071
|
+
/**
|
|
1072
|
+
* User location object (schema not expanded in scraped content).
|
|
1073
|
+
*/
|
|
1074
|
+
user_location?: ({
|
|
1075
|
+
[k: string]: unknown;
|
|
1076
|
+
} | null);
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
namespace output {
|
|
1080
|
+
/**
|
|
1081
|
+
* Response structure for chat completion creation, including success and validation error shapes.
|
|
1082
|
+
*/
|
|
1083
|
+
interface Output {
|
|
1084
|
+
/**
|
|
1085
|
+
* Array of completion choices.
|
|
1086
|
+
*/
|
|
1087
|
+
choices?: {
|
|
1088
|
+
/**
|
|
1089
|
+
* Streaming delta object (schema not provided in scraped content).
|
|
1090
|
+
*/
|
|
1091
|
+
delta?: {
|
|
1092
|
+
[k: string]: unknown;
|
|
1093
|
+
};
|
|
1094
|
+
/**
|
|
1095
|
+
* Why generation stopped.
|
|
1096
|
+
*/
|
|
1097
|
+
finish_reason?: ("stop" | "length" | null);
|
|
1098
|
+
/**
|
|
1099
|
+
* Index of the choice in the array.
|
|
1100
|
+
*/
|
|
1101
|
+
index?: number;
|
|
1102
|
+
/**
|
|
1103
|
+
* Output message object (schema not provided in scraped content).
|
|
1104
|
+
*/
|
|
1105
|
+
message?: {
|
|
1106
|
+
[k: string]: unknown;
|
|
1107
|
+
};
|
|
1108
|
+
[k: string]: unknown;
|
|
1109
|
+
}[];
|
|
1110
|
+
/**
|
|
1111
|
+
* Citations (if any).
|
|
1112
|
+
*/
|
|
1113
|
+
citations?: (string[] | null);
|
|
1114
|
+
/**
|
|
1115
|
+
* Unix timestamp when the completion was created.
|
|
1116
|
+
*/
|
|
1117
|
+
created?: number;
|
|
1118
|
+
/**
|
|
1119
|
+
* Validation error details for 422 Unprocessable Entity responses.
|
|
1120
|
+
*/
|
|
1121
|
+
detail?: {
|
|
1122
|
+
/**
|
|
1123
|
+
* Error location.
|
|
1124
|
+
*/
|
|
1125
|
+
loc?: string[];
|
|
1126
|
+
/**
|
|
1127
|
+
* Error message.
|
|
1128
|
+
*/
|
|
1129
|
+
msg?: string;
|
|
1130
|
+
/**
|
|
1131
|
+
* Error type.
|
|
1132
|
+
*/
|
|
1133
|
+
type?: string;
|
|
1134
|
+
[k: string]: unknown;
|
|
1135
|
+
}[];
|
|
1136
|
+
/**
|
|
1137
|
+
* Unique identifier for the completion.
|
|
1138
|
+
*/
|
|
1139
|
+
id?: string;
|
|
1140
|
+
/**
|
|
1141
|
+
* Images (if any).
|
|
1142
|
+
*/
|
|
1143
|
+
images?: ({
|
|
1144
|
+
/**
|
|
1145
|
+
* Height in pixels.
|
|
1146
|
+
*/
|
|
1147
|
+
height?: number;
|
|
1148
|
+
/**
|
|
1149
|
+
* URL of the image.
|
|
1150
|
+
*/
|
|
1151
|
+
image_url?: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* Original URL where the image was found.
|
|
1154
|
+
*/
|
|
1155
|
+
origin_url?: string;
|
|
1156
|
+
/**
|
|
1157
|
+
* Width in pixels.
|
|
1158
|
+
*/
|
|
1159
|
+
width?: number;
|
|
1160
|
+
[k: string]: unknown;
|
|
1161
|
+
}[] | null);
|
|
1162
|
+
/**
|
|
1163
|
+
* Model used for generation.
|
|
1164
|
+
*/
|
|
1165
|
+
model?: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* Object type identifier. Default: `chat.completion`.
|
|
1168
|
+
*/
|
|
1169
|
+
object?: string;
|
|
1170
|
+
/**
|
|
1171
|
+
* Related questions (if any).
|
|
1172
|
+
*/
|
|
1173
|
+
related_questions?: (string[] | null);
|
|
1174
|
+
/**
|
|
1175
|
+
* Search results (if any).
|
|
1176
|
+
*/
|
|
1177
|
+
search_results?: ({
|
|
1178
|
+
/**
|
|
1179
|
+
* Date (format not specified).
|
|
1180
|
+
*/
|
|
1181
|
+
date?: (string | null);
|
|
1182
|
+
/**
|
|
1183
|
+
* Last updated timestamp/date (format not specified).
|
|
1184
|
+
*/
|
|
1185
|
+
last_updated?: (string | null);
|
|
1186
|
+
/**
|
|
1187
|
+
* Text snippet from the search result. Default: `""`.
|
|
1188
|
+
*/
|
|
1189
|
+
snippet?: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* Source type. Default: `web`.
|
|
1192
|
+
*/
|
|
1193
|
+
source?: ("web" | "attachment");
|
|
1194
|
+
/**
|
|
1195
|
+
* URL of the search result page.
|
|
1196
|
+
*/
|
|
1197
|
+
url?: string;
|
|
1198
|
+
[k: string]: unknown;
|
|
1199
|
+
}[] | null);
|
|
1200
|
+
/**
|
|
1201
|
+
* Usage object (token counts and cost).
|
|
1202
|
+
*/
|
|
1203
|
+
usage?: ({
|
|
1204
|
+
/**
|
|
1205
|
+
* Citation tokens (if applicable).
|
|
1206
|
+
*/
|
|
1207
|
+
citation_tokens?: (number | null);
|
|
1208
|
+
/**
|
|
1209
|
+
* Number of tokens in the completion/output.
|
|
1210
|
+
*/
|
|
1211
|
+
completion_tokens?: number;
|
|
1212
|
+
/**
|
|
1213
|
+
* Cost object (schema not provided in scraped content).
|
|
1214
|
+
*/
|
|
1215
|
+
cost?: {
|
|
1216
|
+
[k: string]: unknown;
|
|
1217
|
+
};
|
|
1218
|
+
/**
|
|
1219
|
+
* Number of search queries performed (if applicable).
|
|
1220
|
+
*/
|
|
1221
|
+
num_search_queries?: (number | null);
|
|
1222
|
+
/**
|
|
1223
|
+
* Number of tokens in the prompt/input.
|
|
1224
|
+
*/
|
|
1225
|
+
prompt_tokens?: number;
|
|
1226
|
+
/**
|
|
1227
|
+
* Reasoning tokens (if applicable).
|
|
1228
|
+
*/
|
|
1229
|
+
reasoning_tokens?: (number | null);
|
|
1230
|
+
/**
|
|
1231
|
+
* Search context size used (if applicable).
|
|
1232
|
+
*/
|
|
1233
|
+
search_context_size?: (string | null);
|
|
1234
|
+
/**
|
|
1235
|
+
* Total tokens used (prompt + completion).
|
|
1236
|
+
*/
|
|
1237
|
+
total_tokens?: number;
|
|
1238
|
+
[k: string]: unknown;
|
|
1239
|
+
} | null);
|
|
1240
|
+
[k: string]: unknown;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
/**
|
|
1245
|
+
* Builds the `create_chat_completion` action.
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```json
|
|
1249
|
+
* {
|
|
1250
|
+
* "disable_search": false,
|
|
1251
|
+
* "enable_search_classifier": true,
|
|
1252
|
+
* "image_domain_filter": [
|
|
1253
|
+
* "images.example.com"
|
|
1254
|
+
* ],
|
|
1255
|
+
* "image_format_filter": [
|
|
1256
|
+
* "jpg",
|
|
1257
|
+
* "png"
|
|
1258
|
+
* ],
|
|
1259
|
+
* "language_preference": "en-US",
|
|
1260
|
+
* "last_updated_after_filter": "2024-01-01",
|
|
1261
|
+
* "last_updated_before_filter": "2024-12-31",
|
|
1262
|
+
* "max_tokens": 300,
|
|
1263
|
+
* "messages": [
|
|
1264
|
+
* {
|
|
1265
|
+
* "content": "Explain what a chat completion API does.",
|
|
1266
|
+
* "role": "user"
|
|
1267
|
+
* }
|
|
1268
|
+
* ],
|
|
1269
|
+
* "model": "sonar-pro",
|
|
1270
|
+
* "reasoning_effort": "medium",
|
|
1271
|
+
* "response_format": {
|
|
1272
|
+
* "json_schema": {
|
|
1273
|
+
* "properties": {
|
|
1274
|
+
* "summary": {
|
|
1275
|
+
* "type": "string"
|
|
1276
|
+
* }
|
|
1277
|
+
* },
|
|
1278
|
+
* "required": [
|
|
1279
|
+
* "summary"
|
|
1280
|
+
* ],
|
|
1281
|
+
* "type": "object"
|
|
1282
|
+
* },
|
|
1283
|
+
* "type": "json_schema"
|
|
1284
|
+
* },
|
|
1285
|
+
* "return_images": false,
|
|
1286
|
+
* "return_related_questions": true,
|
|
1287
|
+
* "search_after_date_filter": "2024-01-01",
|
|
1288
|
+
* "search_before_date_filter": "2024-12-31",
|
|
1289
|
+
* "search_domain_filter": [
|
|
1290
|
+
* "example.com"
|
|
1291
|
+
* ],
|
|
1292
|
+
* "search_language_filter": [
|
|
1293
|
+
* "en"
|
|
1294
|
+
* ],
|
|
1295
|
+
* "search_mode": "web",
|
|
1296
|
+
* "search_recency_filter": "week",
|
|
1297
|
+
* "stop": [
|
|
1298
|
+
* "END"
|
|
1299
|
+
* ],
|
|
1300
|
+
* "stream": false,
|
|
1301
|
+
* "stream_mode": "full",
|
|
1302
|
+
* "temperature": 0.2,
|
|
1303
|
+
* "top_p": 0.9,
|
|
1304
|
+
* "web_search_options": {
|
|
1305
|
+
* "image_results_enhanced_relevance": false,
|
|
1306
|
+
* "search_context_size": "high",
|
|
1307
|
+
* "search_type": "auto",
|
|
1308
|
+
* "user_location": {
|
|
1309
|
+
* "city": "San Francisco",
|
|
1310
|
+
* "country": "US",
|
|
1311
|
+
* "region": "CA"
|
|
1312
|
+
* }
|
|
1313
|
+
* }
|
|
1314
|
+
* }
|
|
1315
|
+
* ```
|
|
1316
|
+
*/
|
|
1317
|
+
declare function createChatCompletion(input: CreateChatCompletionTypes.Input): Action<CreateChatCompletionTypes.output.Output>;
|
|
1318
|
+
declare namespace CreateAsyncChatCompletionSonarTypes {
|
|
1319
|
+
/**
|
|
1320
|
+
* Submits an asynchronous chat completion request to a Sonar model. The API returns an async request object with an `id` and `status`, and may include a `response` object when completed.
|
|
1321
|
+
*/
|
|
1322
|
+
interface Input {
|
|
1323
|
+
/**
|
|
1324
|
+
* Optional idempotency key.
|
|
1325
|
+
*/
|
|
1326
|
+
idempotency_key?: (string | null);
|
|
1327
|
+
/**
|
|
1328
|
+
* Request payload container.
|
|
1329
|
+
*/
|
|
1330
|
+
request: {
|
|
1331
|
+
/**
|
|
1332
|
+
* Disable search.
|
|
1333
|
+
*/
|
|
1334
|
+
disable_search?: (boolean | null);
|
|
1335
|
+
/**
|
|
1336
|
+
* Enable search classifier.
|
|
1337
|
+
*/
|
|
1338
|
+
enable_search_classifier?: (boolean | null);
|
|
1339
|
+
/**
|
|
1340
|
+
* Image domain filter list.
|
|
1341
|
+
*/
|
|
1342
|
+
image_domain_filter?: (string[] | null);
|
|
1343
|
+
/**
|
|
1344
|
+
* Image format filter list.
|
|
1345
|
+
*/
|
|
1346
|
+
image_format_filter?: (string[] | null);
|
|
1347
|
+
/**
|
|
1348
|
+
* Language preference.
|
|
1349
|
+
*/
|
|
1350
|
+
language_preference?: (string | null);
|
|
1351
|
+
/**
|
|
1352
|
+
* Last-updated-after filter (string).
|
|
1353
|
+
*/
|
|
1354
|
+
last_updated_after_filter?: (string | null);
|
|
1355
|
+
/**
|
|
1356
|
+
* Last-updated-before filter (string).
|
|
1357
|
+
*/
|
|
1358
|
+
last_updated_before_filter?: (string | null);
|
|
1359
|
+
/**
|
|
1360
|
+
* Maximum tokens to generate.
|
|
1361
|
+
*/
|
|
1362
|
+
max_tokens?: (number | null);
|
|
1363
|
+
/**
|
|
1364
|
+
* Array of messages forming the conversation history.
|
|
1365
|
+
*/
|
|
1366
|
+
messages: {
|
|
1367
|
+
/**
|
|
1368
|
+
* Message content. Can be a string, or an array of content chunks, or `null`.
|
|
1369
|
+
*/
|
|
1370
|
+
content: (string | {
|
|
1371
|
+
[k: string]: unknown;
|
|
1372
|
+
}[] | null);
|
|
1373
|
+
/**
|
|
1374
|
+
* Chat message role (`<ChatMessageRole>`).
|
|
1375
|
+
*/
|
|
1376
|
+
role: string;
|
|
1377
|
+
}[];
|
|
1378
|
+
/**
|
|
1379
|
+
* Model to use. Must be `sonar-deep-research`. This is the only model supported for async processing.
|
|
1380
|
+
*/
|
|
1381
|
+
model: "sonar-deep-research";
|
|
1382
|
+
/**
|
|
1383
|
+
* Reasoning effort.
|
|
1384
|
+
*/
|
|
1385
|
+
reasoning_effort?: ("minimal" | "low" | "medium" | "high" | null);
|
|
1386
|
+
/**
|
|
1387
|
+
* Response format. One of `<ResponseFormatText>`, `<ResponseFormatJSONSchema>`, or `null`.
|
|
1388
|
+
*/
|
|
1389
|
+
response_format?: ({
|
|
1390
|
+
[k: string]: unknown;
|
|
1391
|
+
} | null);
|
|
1392
|
+
/**
|
|
1393
|
+
* Whether to return images.
|
|
1394
|
+
*/
|
|
1395
|
+
return_images?: (boolean | null);
|
|
1396
|
+
/**
|
|
1397
|
+
* Whether to return related questions.
|
|
1398
|
+
*/
|
|
1399
|
+
return_related_questions?: (boolean | null);
|
|
1400
|
+
/**
|
|
1401
|
+
* After date filter (string).
|
|
1402
|
+
*/
|
|
1403
|
+
search_after_date_filter?: (string | null);
|
|
1404
|
+
/**
|
|
1405
|
+
* Before date filter (string).
|
|
1406
|
+
*/
|
|
1407
|
+
search_before_date_filter?: (string | null);
|
|
1408
|
+
/**
|
|
1409
|
+
* Domain filter list.
|
|
1410
|
+
*/
|
|
1411
|
+
search_domain_filter?: (string[] | null);
|
|
1412
|
+
/**
|
|
1413
|
+
* Language filter list.
|
|
1414
|
+
*/
|
|
1415
|
+
search_language_filter?: (string[] | null);
|
|
1416
|
+
/**
|
|
1417
|
+
* Search mode.
|
|
1418
|
+
*/
|
|
1419
|
+
search_mode?: ("web" | "academic" | "sec" | null);
|
|
1420
|
+
/**
|
|
1421
|
+
* Recency filter.
|
|
1422
|
+
*/
|
|
1423
|
+
search_recency_filter?: ("hour" | "day" | "week" | "month" | "year" | null);
|
|
1424
|
+
/**
|
|
1425
|
+
* Stop sequence(s).
|
|
1426
|
+
*/
|
|
1427
|
+
stop?: (string | string[] | null);
|
|
1428
|
+
/**
|
|
1429
|
+
* Whether to stream output.
|
|
1430
|
+
*/
|
|
1431
|
+
stream?: (boolean | null);
|
|
1432
|
+
/**
|
|
1433
|
+
* Streaming event format. Allowed values: `full`, `concise`. Default: `full`.
|
|
1434
|
+
*/
|
|
1435
|
+
stream_mode?: ("full" | "concise");
|
|
1436
|
+
/**
|
|
1437
|
+
* Sampling temperature.
|
|
1438
|
+
*/
|
|
1439
|
+
temperature?: (number | null);
|
|
1440
|
+
/**
|
|
1441
|
+
* Nucleus sampling parameter.
|
|
1442
|
+
*/
|
|
1443
|
+
top_p?: (number | null);
|
|
1444
|
+
/**
|
|
1445
|
+
* Web search options (`<WebSearchOptions>`).
|
|
1446
|
+
*/
|
|
1447
|
+
web_search_options?: {};
|
|
1448
|
+
};
|
|
1449
|
+
}
|
|
1450
|
+
namespace output {
|
|
1451
|
+
/**
|
|
1452
|
+
* Response structure for creating an async Sonar chat completion, including success and documented error variants.
|
|
1453
|
+
*/
|
|
1454
|
+
interface Output {
|
|
1455
|
+
/**
|
|
1456
|
+
* Unix timestamp when processing completed.
|
|
1457
|
+
*/
|
|
1458
|
+
completed_at?: (number | null);
|
|
1459
|
+
/**
|
|
1460
|
+
* Unix timestamp when the request was created.
|
|
1461
|
+
*/
|
|
1462
|
+
created_at?: number;
|
|
1463
|
+
/**
|
|
1464
|
+
* Validation error details returned for 422 Unprocessable Entity responses.
|
|
1465
|
+
*/
|
|
1466
|
+
detail?: {
|
|
1467
|
+
/**
|
|
1468
|
+
* Location of the validation error.
|
|
1469
|
+
*/
|
|
1470
|
+
loc?: string[];
|
|
1471
|
+
/**
|
|
1472
|
+
* Validation error message.
|
|
1473
|
+
*/
|
|
1474
|
+
msg?: string;
|
|
1475
|
+
/**
|
|
1476
|
+
* Validation error type.
|
|
1477
|
+
*/
|
|
1478
|
+
type?: string;
|
|
1479
|
+
[k: string]: unknown;
|
|
1480
|
+
}[];
|
|
1481
|
+
/**
|
|
1482
|
+
* Error object returned for invalid model usage.
|
|
1483
|
+
*/
|
|
1484
|
+
error?: {
|
|
1485
|
+
/**
|
|
1486
|
+
* Error code.
|
|
1487
|
+
*/
|
|
1488
|
+
code?: number;
|
|
1489
|
+
/**
|
|
1490
|
+
* Error message.
|
|
1491
|
+
*/
|
|
1492
|
+
message?: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* Error type.
|
|
1495
|
+
*/
|
|
1496
|
+
type?: string;
|
|
1497
|
+
[k: string]: unknown;
|
|
1498
|
+
};
|
|
1499
|
+
/**
|
|
1500
|
+
* Error message if failed.
|
|
1501
|
+
*/
|
|
1502
|
+
error_message?: (string | null);
|
|
1503
|
+
/**
|
|
1504
|
+
* Unix timestamp when the request failed.
|
|
1505
|
+
*/
|
|
1506
|
+
failed_at?: (number | null);
|
|
1507
|
+
/**
|
|
1508
|
+
* Unique identifier for the async request.
|
|
1509
|
+
*/
|
|
1510
|
+
id?: string;
|
|
1511
|
+
/**
|
|
1512
|
+
* Model used for the request.
|
|
1513
|
+
*/
|
|
1514
|
+
model?: string;
|
|
1515
|
+
/**
|
|
1516
|
+
* Completion response object (present when available).
|
|
1517
|
+
*/
|
|
1518
|
+
response?: ({
|
|
1519
|
+
/**
|
|
1520
|
+
* Array of completion choices.
|
|
1521
|
+
*/
|
|
1522
|
+
choices?: {
|
|
1523
|
+
/**
|
|
1524
|
+
* Output delta message (`<ChatMessage-Output>`).
|
|
1525
|
+
*/
|
|
1526
|
+
delta?: {
|
|
1527
|
+
[k: string]: unknown;
|
|
1528
|
+
};
|
|
1529
|
+
/**
|
|
1530
|
+
* Finish reason.
|
|
1531
|
+
*/
|
|
1532
|
+
finish_reason?: ("stop" | "length" | null);
|
|
1533
|
+
/**
|
|
1534
|
+
* Index of the choice in the array.
|
|
1535
|
+
*/
|
|
1536
|
+
index?: number;
|
|
1537
|
+
/**
|
|
1538
|
+
* Output chat message (`<ChatMessage-Output>`).
|
|
1539
|
+
*/
|
|
1540
|
+
message?: {
|
|
1541
|
+
[k: string]: unknown;
|
|
1542
|
+
};
|
|
1543
|
+
[k: string]: unknown;
|
|
1544
|
+
}[];
|
|
1545
|
+
/**
|
|
1546
|
+
* Citations, if any.
|
|
1547
|
+
*/
|
|
1548
|
+
citations?: (string[] | null);
|
|
1549
|
+
/**
|
|
1550
|
+
* Unix timestamp when the completion was created.
|
|
1551
|
+
*/
|
|
1552
|
+
created?: number;
|
|
1553
|
+
/**
|
|
1554
|
+
* Unique identifier for the completion.
|
|
1555
|
+
*/
|
|
1556
|
+
id?: string;
|
|
1557
|
+
/**
|
|
1558
|
+
* Images, if any.
|
|
1559
|
+
*/
|
|
1560
|
+
images?: ({
|
|
1561
|
+
/**
|
|
1562
|
+
* Image height in pixels.
|
|
1563
|
+
*/
|
|
1564
|
+
height?: number;
|
|
1565
|
+
/**
|
|
1566
|
+
* URL of the image.
|
|
1567
|
+
*/
|
|
1568
|
+
image_url?: string;
|
|
1569
|
+
/**
|
|
1570
|
+
* Original URL where the image was found.
|
|
1571
|
+
*/
|
|
1572
|
+
origin_url?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* Image width in pixels.
|
|
1575
|
+
*/
|
|
1576
|
+
width?: number;
|
|
1577
|
+
[k: string]: unknown;
|
|
1578
|
+
}[] | null);
|
|
1579
|
+
/**
|
|
1580
|
+
* Model used for generation.
|
|
1581
|
+
*/
|
|
1582
|
+
model?: string;
|
|
1583
|
+
/**
|
|
1584
|
+
* Object type identifier. Default: `chat.completion`.
|
|
1585
|
+
*/
|
|
1586
|
+
object?: string;
|
|
1587
|
+
/**
|
|
1588
|
+
* Related questions, if any.
|
|
1589
|
+
*/
|
|
1590
|
+
related_questions?: (string[] | null);
|
|
1591
|
+
/**
|
|
1592
|
+
* Search results, if any.
|
|
1593
|
+
*/
|
|
1594
|
+
search_results?: ({
|
|
1595
|
+
/**
|
|
1596
|
+
* Date associated with the result.
|
|
1597
|
+
*/
|
|
1598
|
+
date?: (string | null);
|
|
1599
|
+
/**
|
|
1600
|
+
* Last updated timestamp, if provided.
|
|
1601
|
+
*/
|
|
1602
|
+
last_updated?: (string | null);
|
|
1603
|
+
/**
|
|
1604
|
+
* Text snippet. Default: `""`.
|
|
1605
|
+
*/
|
|
1606
|
+
snippet?: string;
|
|
1607
|
+
/**
|
|
1608
|
+
* Source type. Allowed values: `web`, `attachment`. Default: `web`.
|
|
1609
|
+
*/
|
|
1610
|
+
source?: ("web" | "attachment");
|
|
1611
|
+
/**
|
|
1612
|
+
* URL of the search result page.
|
|
1613
|
+
*/
|
|
1614
|
+
url?: string;
|
|
1615
|
+
[k: string]: unknown;
|
|
1616
|
+
}[] | null);
|
|
1617
|
+
/**
|
|
1618
|
+
* Usage info (`<UsageInfo>`).
|
|
1619
|
+
*/
|
|
1620
|
+
usage?: ({
|
|
1621
|
+
[k: string]: unknown;
|
|
1622
|
+
} | null);
|
|
1623
|
+
[k: string]: unknown;
|
|
1624
|
+
} | null);
|
|
1625
|
+
/**
|
|
1626
|
+
* Unix timestamp when processing started.
|
|
1627
|
+
*/
|
|
1628
|
+
started_at?: (number | null);
|
|
1629
|
+
/**
|
|
1630
|
+
* Request status.
|
|
1631
|
+
*/
|
|
1632
|
+
status?: ("CREATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED");
|
|
1633
|
+
[k: string]: unknown;
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Builds the `create_async_chat_completion_sonar` action.
|
|
1639
|
+
*
|
|
1640
|
+
* @example
|
|
1641
|
+
* ```json
|
|
1642
|
+
* {
|
|
1643
|
+
* "idempotency_key": "idem_12345",
|
|
1644
|
+
* "request": {
|
|
1645
|
+
* "disable_search": false,
|
|
1646
|
+
* "enable_search_classifier": false,
|
|
1647
|
+
* "image_domain_filter": [
|
|
1648
|
+
* "example.com",
|
|
1649
|
+
* "images.example.org"
|
|
1650
|
+
* ],
|
|
1651
|
+
* "image_format_filter": [
|
|
1652
|
+
* "jpg",
|
|
1653
|
+
* "png"
|
|
1654
|
+
* ],
|
|
1655
|
+
* "language_preference": "en-US",
|
|
1656
|
+
* "last_updated_after_filter": "2024-01-01T00:00:00Z",
|
|
1657
|
+
* "last_updated_before_filter": "2024-12-31T23:59:59Z",
|
|
1658
|
+
* "max_tokens": 1024,
|
|
1659
|
+
* "messages": [
|
|
1660
|
+
* {
|
|
1661
|
+
* "content": "Summarize the latest research on battery recycling.",
|
|
1662
|
+
* "role": "user"
|
|
1663
|
+
* },
|
|
1664
|
+
* {
|
|
1665
|
+
* "content": [
|
|
1666
|
+
* {
|
|
1667
|
+
* "text": "Here is a partial summary so far.",
|
|
1668
|
+
* "type": "text"
|
|
1669
|
+
* }
|
|
1670
|
+
* ],
|
|
1671
|
+
* "role": "assistant"
|
|
1672
|
+
* },
|
|
1673
|
+
* {
|
|
1674
|
+
* "content": null,
|
|
1675
|
+
* "role": "user"
|
|
1676
|
+
* }
|
|
1677
|
+
* ],
|
|
1678
|
+
* "model": "sonar-deep-research",
|
|
1679
|
+
* "reasoning_effort": "medium",
|
|
1680
|
+
* "response_format": {
|
|
1681
|
+
* "json_schema": {
|
|
1682
|
+
* "name": "summary_response"
|
|
1683
|
+
* },
|
|
1684
|
+
* "type": "json_schema"
|
|
1685
|
+
* },
|
|
1686
|
+
* "return_images": true,
|
|
1687
|
+
* "return_related_questions": true,
|
|
1688
|
+
* "search_after_date_filter": "2024-01-01",
|
|
1689
|
+
* "search_before_date_filter": "2024-12-31",
|
|
1690
|
+
* "search_domain_filter": [
|
|
1691
|
+
* "nature.com",
|
|
1692
|
+
* "science.org"
|
|
1693
|
+
* ],
|
|
1694
|
+
* "search_language_filter": [
|
|
1695
|
+
* "en",
|
|
1696
|
+
* "es"
|
|
1697
|
+
* ],
|
|
1698
|
+
* "search_mode": "academic",
|
|
1699
|
+
* "search_recency_filter": "month",
|
|
1700
|
+
* "stop": [
|
|
1701
|
+
* "END",
|
|
1702
|
+
* "STOP"
|
|
1703
|
+
* ],
|
|
1704
|
+
* "stream": true,
|
|
1705
|
+
* "stream_mode": "concise",
|
|
1706
|
+
* "temperature": 0.7,
|
|
1707
|
+
* "top_p": 0.9,
|
|
1708
|
+
* "web_search_options": {}
|
|
1709
|
+
* }
|
|
1710
|
+
* }
|
|
1711
|
+
* ```
|
|
1712
|
+
*/
|
|
1713
|
+
declare function createAsyncChatCompletionSonar(input: CreateAsyncChatCompletionSonarTypes.Input): Action<CreateAsyncChatCompletionSonarTypes.output.Output>;
|
|
1714
|
+
declare namespace DownloadFileContentTypes {
|
|
1715
|
+
/**
|
|
1716
|
+
* Streams the raw byte content of an input, output, or error file identified by its file ID.
|
|
1717
|
+
*/
|
|
1718
|
+
interface Input {
|
|
1719
|
+
/**
|
|
1720
|
+
* File identifier to download. Expected format: `file_...`. Send this value in the URL path.
|
|
1721
|
+
*/
|
|
1722
|
+
fileId: string;
|
|
1723
|
+
}
|
|
1724
|
+
namespace output {
|
|
1725
|
+
/**
|
|
1726
|
+
* Successful response is raw binary file content (`application/octet-stream`). If the file does not exist or has expired, the API returns a JSON error object.
|
|
1727
|
+
*/
|
|
1728
|
+
type Output = (string | {
|
|
1729
|
+
error?: {
|
|
1730
|
+
/**
|
|
1731
|
+
* HTTP status code.
|
|
1732
|
+
*/
|
|
1733
|
+
code?: number;
|
|
1734
|
+
/**
|
|
1735
|
+
* Human-readable error message.
|
|
1736
|
+
*/
|
|
1737
|
+
message?: string;
|
|
1738
|
+
/**
|
|
1739
|
+
* Parameter that caused the error, when applicable.
|
|
1740
|
+
*/
|
|
1741
|
+
param?: string;
|
|
1742
|
+
/**
|
|
1743
|
+
* Error type identifier.
|
|
1744
|
+
*/
|
|
1745
|
+
type?: string;
|
|
1746
|
+
[k: string]: unknown;
|
|
1747
|
+
};
|
|
1748
|
+
[k: string]: unknown;
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* Builds the `download_file_content` action.
|
|
1754
|
+
*
|
|
1755
|
+
* @example
|
|
1756
|
+
* ```json
|
|
1757
|
+
* {
|
|
1758
|
+
* "fileId": "file_abc123"
|
|
1759
|
+
* }
|
|
1760
|
+
* ```
|
|
1761
|
+
*/
|
|
1762
|
+
declare function downloadFileContent(input: DownloadFileContentTypes.Input): Action<DownloadFileContentTypes.output.Output>;
|
|
1763
|
+
declare namespace DeleteFileTypes {
|
|
1764
|
+
/**
|
|
1765
|
+
* Deletes a file identified by its file ID. Batches that were already created from the file are not affected.
|
|
1766
|
+
*/
|
|
1767
|
+
interface Input {
|
|
1768
|
+
/**
|
|
1769
|
+
* File identifier. File IDs use the `file_...` format. Send in the URL path.
|
|
1770
|
+
*/
|
|
1771
|
+
fileId: string;
|
|
1772
|
+
}
|
|
1773
|
+
namespace output {
|
|
1774
|
+
/**
|
|
1775
|
+
* Response returned after attempting to delete a file.
|
|
1776
|
+
*/
|
|
1777
|
+
interface Output {
|
|
1778
|
+
/**
|
|
1779
|
+
* Indicates whether the file was deleted.
|
|
1780
|
+
*/
|
|
1781
|
+
deleted?: boolean;
|
|
1782
|
+
/**
|
|
1783
|
+
* Error details returned for failed requests.
|
|
1784
|
+
*/
|
|
1785
|
+
error?: {
|
|
1786
|
+
/**
|
|
1787
|
+
* HTTP status code associated with the error.
|
|
1788
|
+
*/
|
|
1789
|
+
code?: number;
|
|
1790
|
+
/**
|
|
1791
|
+
* Human-readable error message.
|
|
1792
|
+
*/
|
|
1793
|
+
message?: string;
|
|
1794
|
+
/**
|
|
1795
|
+
* Parameter that caused the error, when applicable.
|
|
1796
|
+
*/
|
|
1797
|
+
param?: string;
|
|
1798
|
+
/**
|
|
1799
|
+
* Error type identifier.
|
|
1800
|
+
*/
|
|
1801
|
+
type?: string;
|
|
1802
|
+
[k: string]: unknown;
|
|
1803
|
+
};
|
|
1804
|
+
/**
|
|
1805
|
+
* Identifier of the deleted file.
|
|
1806
|
+
*/
|
|
1807
|
+
id?: string;
|
|
1808
|
+
/**
|
|
1809
|
+
* Object type. Value: `file`.
|
|
1810
|
+
*/
|
|
1811
|
+
object?: "file";
|
|
1812
|
+
[k: string]: unknown;
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* Builds the `delete_file` action.
|
|
1818
|
+
*
|
|
1819
|
+
* @example
|
|
1820
|
+
* ```json
|
|
1821
|
+
* {
|
|
1822
|
+
* "fileId": "file_abc123"
|
|
1823
|
+
* }
|
|
1824
|
+
* ```
|
|
1825
|
+
*/
|
|
1826
|
+
declare function deleteFile(input: DeleteFileTypes.Input): Action<DeleteFileTypes.output.Output>;
|
|
1827
|
+
declare namespace CancelBatchTypes {
|
|
1828
|
+
/**
|
|
1829
|
+
* Moves a batch to the `cancelling` state. The batch becomes `cancelled` after its running items stop. Completed items remain in the output file and are billed.
|
|
1830
|
+
*/
|
|
1831
|
+
interface Input {
|
|
1832
|
+
/**
|
|
1833
|
+
* Batch identifier. Must be sent in the URL path and use the `batch_...` format.
|
|
1834
|
+
*/
|
|
1835
|
+
batchId: string;
|
|
1836
|
+
}
|
|
1837
|
+
namespace output {
|
|
1838
|
+
/**
|
|
1839
|
+
* Successful response structure from the API, or an error response.
|
|
1840
|
+
*/
|
|
1841
|
+
interface Output {
|
|
1842
|
+
/**
|
|
1843
|
+
* Optional Unix timestamp, in seconds, when the batch was cancelled.
|
|
1844
|
+
*/
|
|
1845
|
+
cancelled_at?: (number | null);
|
|
1846
|
+
/**
|
|
1847
|
+
* Optional Unix timestamp, in seconds, when cancellation began.
|
|
1848
|
+
*/
|
|
1849
|
+
cancelling_at?: (number | null);
|
|
1850
|
+
/**
|
|
1851
|
+
* Optional Unix timestamp, in seconds, when the batch completed.
|
|
1852
|
+
*/
|
|
1853
|
+
completed_at?: (number | null);
|
|
1854
|
+
/**
|
|
1855
|
+
* Time window allowed for batch completion.
|
|
1856
|
+
*/
|
|
1857
|
+
completion_window?: string;
|
|
1858
|
+
/**
|
|
1859
|
+
* Unix timestamp, in seconds, when the batch was created.
|
|
1860
|
+
*/
|
|
1861
|
+
created_at?: number;
|
|
1862
|
+
/**
|
|
1863
|
+
* Endpoint processed by the batch.
|
|
1864
|
+
*/
|
|
1865
|
+
endpoint?: string;
|
|
1866
|
+
/**
|
|
1867
|
+
* Error object returned for failed requests.
|
|
1868
|
+
*/
|
|
1869
|
+
error?: {
|
|
1870
|
+
/**
|
|
1871
|
+
* HTTP status code.
|
|
1872
|
+
*/
|
|
1873
|
+
code?: number;
|
|
1874
|
+
/**
|
|
1875
|
+
* Human-readable error message.
|
|
1876
|
+
*/
|
|
1877
|
+
message?: string;
|
|
1878
|
+
/**
|
|
1879
|
+
* Optional parameter that caused the error.
|
|
1880
|
+
*/
|
|
1881
|
+
param?: string;
|
|
1882
|
+
/**
|
|
1883
|
+
* Error type identifier.
|
|
1884
|
+
*/
|
|
1885
|
+
type?: string;
|
|
1886
|
+
[k: string]: unknown;
|
|
1887
|
+
};
|
|
1888
|
+
/**
|
|
1889
|
+
* Optional identifier of the error file.
|
|
1890
|
+
*/
|
|
1891
|
+
error_file_id?: (string | null);
|
|
1892
|
+
/**
|
|
1893
|
+
* Collection of errors associated with the batch.
|
|
1894
|
+
*/
|
|
1895
|
+
errors?: {
|
|
1896
|
+
/**
|
|
1897
|
+
* List of batch input errors.
|
|
1898
|
+
*/
|
|
1899
|
+
data?: {
|
|
1900
|
+
/**
|
|
1901
|
+
* Error code.
|
|
1902
|
+
*/
|
|
1903
|
+
code?: string;
|
|
1904
|
+
/**
|
|
1905
|
+
* Optional 1-based input line to which the error refers.
|
|
1906
|
+
*/
|
|
1907
|
+
line?: number;
|
|
1908
|
+
/**
|
|
1909
|
+
* Error message.
|
|
1910
|
+
*/
|
|
1911
|
+
message?: string;
|
|
1912
|
+
[k: string]: unknown;
|
|
1913
|
+
}[];
|
|
1914
|
+
/**
|
|
1915
|
+
* Error collection object type. Always `list`.
|
|
1916
|
+
*/
|
|
1917
|
+
object?: "list";
|
|
1918
|
+
[k: string]: unknown;
|
|
1919
|
+
};
|
|
1920
|
+
/**
|
|
1921
|
+
* Optional Unix timestamp, in seconds, when the batch expired.
|
|
1922
|
+
*/
|
|
1923
|
+
expired_at?: (number | null);
|
|
1924
|
+
/**
|
|
1925
|
+
* Optional Unix timestamp, in seconds, when the batch expires.
|
|
1926
|
+
*/
|
|
1927
|
+
expires_at?: (number | null);
|
|
1928
|
+
/**
|
|
1929
|
+
* Optional Unix timestamp, in seconds, when the batch failed.
|
|
1930
|
+
*/
|
|
1931
|
+
failed_at?: (number | null);
|
|
1932
|
+
/**
|
|
1933
|
+
* Optional Unix timestamp, in seconds, when finalization began.
|
|
1934
|
+
*/
|
|
1935
|
+
finalizing_at?: (number | null);
|
|
1936
|
+
/**
|
|
1937
|
+
* Unique batch identifier.
|
|
1938
|
+
*/
|
|
1939
|
+
id?: string;
|
|
1940
|
+
/**
|
|
1941
|
+
* Optional Unix timestamp, in seconds, when processing began.
|
|
1942
|
+
*/
|
|
1943
|
+
in_progress_at?: (number | null);
|
|
1944
|
+
/**
|
|
1945
|
+
* Identifier of the input file used to create the batch.
|
|
1946
|
+
*/
|
|
1947
|
+
input_file_id?: string;
|
|
1948
|
+
/**
|
|
1949
|
+
* Optional metadata associated with the batch. Each metadata key and value is a string.
|
|
1950
|
+
*/
|
|
1951
|
+
metadata?: {
|
|
1952
|
+
[k: string]: string;
|
|
1953
|
+
};
|
|
1954
|
+
/**
|
|
1955
|
+
* Object type. Always `batch`.
|
|
1956
|
+
*/
|
|
1957
|
+
object?: "batch";
|
|
1958
|
+
/**
|
|
1959
|
+
* Optional identifier of the output file containing completed batch results.
|
|
1960
|
+
*/
|
|
1961
|
+
output_file_id?: (string | null);
|
|
1962
|
+
/**
|
|
1963
|
+
* Counts of requests in the batch.
|
|
1964
|
+
*/
|
|
1965
|
+
request_counts?: {
|
|
1966
|
+
/**
|
|
1967
|
+
* Number of completed requests.
|
|
1968
|
+
*/
|
|
1969
|
+
completed?: number;
|
|
1970
|
+
/**
|
|
1971
|
+
* Number of failed requests.
|
|
1972
|
+
*/
|
|
1973
|
+
failed?: number;
|
|
1974
|
+
/**
|
|
1975
|
+
* Total number of requests in the batch.
|
|
1976
|
+
*/
|
|
1977
|
+
total?: number;
|
|
1978
|
+
[k: string]: unknown;
|
|
1979
|
+
};
|
|
1980
|
+
/**
|
|
1981
|
+
* Batch status: `validating`, `in_progress`, `finalizing`, `completed`, `expired`, `cancelling`, `cancelled`, or `failed`.
|
|
1982
|
+
*/
|
|
1983
|
+
status?: ("validating" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled" | "failed");
|
|
1984
|
+
/**
|
|
1985
|
+
* Token usage for the batch.
|
|
1986
|
+
*/
|
|
1987
|
+
usage?: {
|
|
1988
|
+
/**
|
|
1989
|
+
* Total number of input tokens.
|
|
1990
|
+
*/
|
|
1991
|
+
input_tokens?: number;
|
|
1992
|
+
/**
|
|
1993
|
+
* Breakdown of input-token usage.
|
|
1994
|
+
*/
|
|
1995
|
+
input_tokens_details?: {
|
|
1996
|
+
/**
|
|
1997
|
+
* Number of cached input tokens.
|
|
1998
|
+
*/
|
|
1999
|
+
cached_tokens?: number;
|
|
2000
|
+
[k: string]: unknown;
|
|
2001
|
+
};
|
|
2002
|
+
/**
|
|
2003
|
+
* Total number of output tokens.
|
|
2004
|
+
*/
|
|
2005
|
+
output_tokens?: number;
|
|
2006
|
+
/**
|
|
2007
|
+
* Breakdown of output-token usage.
|
|
2008
|
+
*/
|
|
2009
|
+
output_tokens_details?: {
|
|
2010
|
+
/**
|
|
2011
|
+
* Number of reasoning tokens included in output-token usage.
|
|
2012
|
+
*/
|
|
2013
|
+
reasoning_tokens?: number;
|
|
2014
|
+
[k: string]: unknown;
|
|
2015
|
+
};
|
|
2016
|
+
/**
|
|
2017
|
+
* Total number of input and output tokens.
|
|
2018
|
+
*/
|
|
2019
|
+
total_tokens?: number;
|
|
2020
|
+
[k: string]: unknown;
|
|
2021
|
+
};
|
|
2022
|
+
[k: string]: unknown;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
/**
|
|
2027
|
+
* Builds the `cancel_batch` action.
|
|
2028
|
+
*
|
|
2029
|
+
* @example
|
|
2030
|
+
* ```json
|
|
2031
|
+
* {
|
|
2032
|
+
* "batchId": "batch_abc123"
|
|
2033
|
+
* }
|
|
2034
|
+
* ```
|
|
2035
|
+
*/
|
|
2036
|
+
declare function cancelBatch(input: CancelBatchTypes.Input): Action<CancelBatchTypes.output.Output>;
|
|
2037
|
+
declare namespace CreateBatchTypes {
|
|
2038
|
+
/**
|
|
2039
|
+
* Creates a batch from a previously uploaded input file. A newly created batch begins with the `validating` status and is processed within the requested completion window.
|
|
2040
|
+
*/
|
|
2041
|
+
interface Input {
|
|
2042
|
+
/**
|
|
2043
|
+
* Target completion time for the batch. The only supported value is `24h`, which is also the default.
|
|
2044
|
+
*/
|
|
2045
|
+
completion_window?: "24h";
|
|
2046
|
+
/**
|
|
2047
|
+
* HTTP headers for the batch creation request.
|
|
2048
|
+
*/
|
|
2049
|
+
headers: {
|
|
2050
|
+
/**
|
|
2051
|
+
* A unique, caller-supplied key for this create operation. Repeating a request with the same key returns the originally created batch, making retries safe.
|
|
2052
|
+
*/
|
|
2053
|
+
"Idempotency-Key"?: string;
|
|
2054
|
+
[k: string]: unknown;
|
|
2055
|
+
};
|
|
2056
|
+
/**
|
|
2057
|
+
* ID of a file uploaded with `purpose=batch`. Send in the request body.
|
|
2058
|
+
*/
|
|
2059
|
+
input_file_id: string;
|
|
2060
|
+
/**
|
|
2061
|
+
* Metadata associated with the batch. Each metadata key and value must be a string.
|
|
2062
|
+
*/
|
|
2063
|
+
metadata?: {
|
|
2064
|
+
[k: string]: string;
|
|
2065
|
+
};
|
|
2066
|
+
}
|
|
2067
|
+
namespace output {
|
|
2068
|
+
/**
|
|
2069
|
+
* Response structure for creating a batch, including success and error responses.
|
|
2070
|
+
*/
|
|
2071
|
+
interface Output {
|
|
2072
|
+
/**
|
|
2073
|
+
* Unix timestamp, in seconds, when cancellation completed.
|
|
2074
|
+
*/
|
|
2075
|
+
cancelled_at?: (number | null);
|
|
2076
|
+
/**
|
|
2077
|
+
* Unix timestamp, in seconds, when cancellation began.
|
|
2078
|
+
*/
|
|
2079
|
+
cancelling_at?: (number | null);
|
|
2080
|
+
/**
|
|
2081
|
+
* Unix timestamp, in seconds, when the batch completed.
|
|
2082
|
+
*/
|
|
2083
|
+
completed_at?: (number | null);
|
|
2084
|
+
/**
|
|
2085
|
+
* Requested target completion time.
|
|
2086
|
+
*/
|
|
2087
|
+
completion_window?: string;
|
|
2088
|
+
/**
|
|
2089
|
+
* Unix timestamp, in seconds, when the batch was created.
|
|
2090
|
+
*/
|
|
2091
|
+
created_at?: number;
|
|
2092
|
+
/**
|
|
2093
|
+
* Endpoint targeted by each request line in the input file.
|
|
2094
|
+
*/
|
|
2095
|
+
endpoint?: "/v1/responses";
|
|
2096
|
+
/**
|
|
2097
|
+
* Error information returned by unsuccessful responses.
|
|
2098
|
+
*/
|
|
2099
|
+
error?: {
|
|
2100
|
+
/**
|
|
2101
|
+
* HTTP status code.
|
|
2102
|
+
*/
|
|
2103
|
+
code?: number;
|
|
2104
|
+
/**
|
|
2105
|
+
* Human-readable error message.
|
|
2106
|
+
*/
|
|
2107
|
+
message?: string;
|
|
2108
|
+
/**
|
|
2109
|
+
* Parameter that caused the error, when applicable.
|
|
2110
|
+
*/
|
|
2111
|
+
param?: (string | null);
|
|
2112
|
+
/**
|
|
2113
|
+
* Error type identifier.
|
|
2114
|
+
*/
|
|
2115
|
+
type?: string;
|
|
2116
|
+
[k: string]: unknown;
|
|
2117
|
+
};
|
|
2118
|
+
/**
|
|
2119
|
+
* ID of the generated error file, when available.
|
|
2120
|
+
*/
|
|
2121
|
+
error_file_id?: (string | null);
|
|
2122
|
+
/**
|
|
2123
|
+
* Validation and processing errors associated with the batch.
|
|
2124
|
+
*/
|
|
2125
|
+
errors?: {
|
|
2126
|
+
/**
|
|
2127
|
+
* List of errors associated with individual input lines.
|
|
2128
|
+
*/
|
|
2129
|
+
data?: {
|
|
2130
|
+
/**
|
|
2131
|
+
* Error code.
|
|
2132
|
+
*/
|
|
2133
|
+
code?: string;
|
|
2134
|
+
/**
|
|
2135
|
+
* One-based input-file line number to which the error refers.
|
|
2136
|
+
*/
|
|
2137
|
+
line?: number;
|
|
2138
|
+
/**
|
|
2139
|
+
* Human-readable error message.
|
|
2140
|
+
*/
|
|
2141
|
+
message?: string;
|
|
2142
|
+
[k: string]: unknown;
|
|
2143
|
+
}[];
|
|
2144
|
+
/**
|
|
2145
|
+
* Error collection object type. Always `list`.
|
|
2146
|
+
*/
|
|
2147
|
+
object?: "list";
|
|
2148
|
+
[k: string]: unknown;
|
|
2149
|
+
};
|
|
2150
|
+
/**
|
|
2151
|
+
* Unix timestamp, in seconds, when the batch expired.
|
|
2152
|
+
*/
|
|
2153
|
+
expired_at?: (number | null);
|
|
2154
|
+
/**
|
|
2155
|
+
* Unix timestamp, in seconds, when the batch expired.
|
|
2156
|
+
*/
|
|
2157
|
+
expires_at?: (number | null);
|
|
2158
|
+
/**
|
|
2159
|
+
* Unix timestamp, in seconds, when the batch failed.
|
|
2160
|
+
*/
|
|
2161
|
+
failed_at?: (number | null);
|
|
2162
|
+
/**
|
|
2163
|
+
* Unix timestamp, in seconds, when the batch entered finalization.
|
|
2164
|
+
*/
|
|
2165
|
+
finalizing_at?: (number | null);
|
|
2166
|
+
/**
|
|
2167
|
+
* Unique identifier of the created batch.
|
|
2168
|
+
*/
|
|
2169
|
+
id?: string;
|
|
2170
|
+
/**
|
|
2171
|
+
* Unix timestamp, in seconds, when processing began.
|
|
2172
|
+
*/
|
|
2173
|
+
in_progress_at?: (number | null);
|
|
2174
|
+
/**
|
|
2175
|
+
* ID of the uploaded batch input file.
|
|
2176
|
+
*/
|
|
2177
|
+
input_file_id?: string;
|
|
2178
|
+
/**
|
|
2179
|
+
* Batch metadata containing string keys and string values.
|
|
2180
|
+
*/
|
|
2181
|
+
metadata?: {
|
|
2182
|
+
[k: string]: string;
|
|
2183
|
+
};
|
|
2184
|
+
/**
|
|
2185
|
+
* Object type. Always `batch`.
|
|
2186
|
+
*/
|
|
2187
|
+
object?: "batch";
|
|
2188
|
+
/**
|
|
2189
|
+
* ID of the generated output file, when available.
|
|
2190
|
+
*/
|
|
2191
|
+
output_file_id?: (string | null);
|
|
2192
|
+
/**
|
|
2193
|
+
* Counts of requests in the batch.
|
|
2194
|
+
*/
|
|
2195
|
+
request_counts?: {
|
|
2196
|
+
/**
|
|
2197
|
+
* Number of successfully completed requests.
|
|
2198
|
+
*/
|
|
2199
|
+
completed?: number;
|
|
2200
|
+
/**
|
|
2201
|
+
* Number of failed requests.
|
|
2202
|
+
*/
|
|
2203
|
+
failed?: number;
|
|
2204
|
+
/**
|
|
2205
|
+
* Total number of requests in the batch.
|
|
2206
|
+
*/
|
|
2207
|
+
total?: number;
|
|
2208
|
+
[k: string]: unknown;
|
|
2209
|
+
};
|
|
2210
|
+
/**
|
|
2211
|
+
* Batch status: `validating`, `in_progress`, `finalizing`, `completed`, `expired`, `cancelling`, `cancelled`, or `failed`.
|
|
2212
|
+
*/
|
|
2213
|
+
status?: ("validating" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled" | "failed");
|
|
2214
|
+
/**
|
|
2215
|
+
* Token usage for the batch.
|
|
2216
|
+
*/
|
|
2217
|
+
usage?: {
|
|
2218
|
+
/**
|
|
2219
|
+
* Total number of input tokens used.
|
|
2220
|
+
*/
|
|
2221
|
+
input_tokens?: number;
|
|
2222
|
+
/**
|
|
2223
|
+
* Detailed input-token usage information.
|
|
2224
|
+
*/
|
|
2225
|
+
input_tokens_details?: {
|
|
2226
|
+
/**
|
|
2227
|
+
* Number of cached input tokens.
|
|
2228
|
+
*/
|
|
2229
|
+
cached_tokens?: number;
|
|
2230
|
+
[k: string]: unknown;
|
|
2231
|
+
};
|
|
2232
|
+
/**
|
|
2233
|
+
* Total number of output tokens used.
|
|
2234
|
+
*/
|
|
2235
|
+
output_tokens?: number;
|
|
2236
|
+
/**
|
|
2237
|
+
* Detailed output-token usage information.
|
|
2238
|
+
*/
|
|
2239
|
+
output_tokens_details?: {
|
|
2240
|
+
/**
|
|
2241
|
+
* Number of reasoning tokens used.
|
|
2242
|
+
*/
|
|
2243
|
+
reasoning_tokens?: number;
|
|
2244
|
+
[k: string]: unknown;
|
|
2245
|
+
};
|
|
2246
|
+
/**
|
|
2247
|
+
* Total number of input and output tokens used.
|
|
2248
|
+
*/
|
|
2249
|
+
total_tokens?: number;
|
|
2250
|
+
[k: string]: unknown;
|
|
2251
|
+
};
|
|
2252
|
+
[k: string]: unknown;
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Builds the `create_batch` action.
|
|
2258
|
+
*
|
|
2259
|
+
* @example
|
|
2260
|
+
* ```json
|
|
2261
|
+
* {
|
|
2262
|
+
* "completion_window": "24h",
|
|
2263
|
+
* "headers": {
|
|
2264
|
+
* "Accept": "application/json",
|
|
2265
|
+
* "Content-Type": "application/json",
|
|
2266
|
+
* "Idempotency-Key": "batch-create-20250213-01"
|
|
2267
|
+
* },
|
|
2268
|
+
* "input_file_id": "file_batch_input_01JQ6M4A7KD3P9N2X8R5",
|
|
2269
|
+
* "metadata": {
|
|
2270
|
+
* "environment": "production",
|
|
2271
|
+
* "project": "support-ticket-classification"
|
|
2272
|
+
* }
|
|
2273
|
+
* }
|
|
2274
|
+
* ```
|
|
2275
|
+
*/
|
|
2276
|
+
declare function createBatch(input: CreateBatchTypes.Input): Action<CreateBatchTypes.output.Output>;
|
|
2277
|
+
declare namespace ListBatchesTypes {
|
|
2278
|
+
/**
|
|
2279
|
+
* Lists the organization's batches in newest-first order. The response is paginated and can be continued by supplying the previous page's `last_id` as the `after_id` query parameter.
|
|
2280
|
+
*/
|
|
2281
|
+
interface Input {
|
|
2282
|
+
/**
|
|
2283
|
+
* Batch ID after which to start the page. Use the `last_id` from the previous page to retrieve the next page. Send as a URL query parameter.
|
|
2284
|
+
*/
|
|
2285
|
+
after_id?: string;
|
|
2286
|
+
/**
|
|
2287
|
+
* Maximum number of batches to return. Send as a URL query parameter.
|
|
2288
|
+
*/
|
|
2289
|
+
limit?: number;
|
|
2290
|
+
}
|
|
2291
|
+
namespace output {
|
|
2292
|
+
/**
|
|
2293
|
+
* Response for listing the organization's batches, including successful paginated results and error responses.
|
|
2294
|
+
*/
|
|
2295
|
+
interface Output {
|
|
2296
|
+
/**
|
|
2297
|
+
* Array of batch objects, ordered newest first.
|
|
2298
|
+
*/
|
|
2299
|
+
data?: {
|
|
2300
|
+
/**
|
|
2301
|
+
* Time cancellation completed, as Unix seconds.
|
|
2302
|
+
*/
|
|
2303
|
+
cancelled_at?: number;
|
|
2304
|
+
/**
|
|
2305
|
+
* Time cancellation began, as Unix seconds.
|
|
2306
|
+
*/
|
|
2307
|
+
cancelling_at?: number;
|
|
2308
|
+
/**
|
|
2309
|
+
* Time completion occurred, as Unix seconds.
|
|
2310
|
+
*/
|
|
2311
|
+
completed_at?: number;
|
|
2312
|
+
/**
|
|
2313
|
+
* Batch completion window.
|
|
2314
|
+
*/
|
|
2315
|
+
completion_window: string;
|
|
2316
|
+
/**
|
|
2317
|
+
* Batch creation time as Unix seconds.
|
|
2318
|
+
*/
|
|
2319
|
+
created_at: number;
|
|
2320
|
+
/**
|
|
2321
|
+
* Endpoint associated with the batch.
|
|
2322
|
+
*/
|
|
2323
|
+
endpoint: string;
|
|
2324
|
+
/**
|
|
2325
|
+
* Identifier of the error file.
|
|
2326
|
+
*/
|
|
2327
|
+
error_file_id?: string;
|
|
2328
|
+
/**
|
|
2329
|
+
* Error collection for the batch.
|
|
2330
|
+
*/
|
|
2331
|
+
errors?: {
|
|
2332
|
+
/**
|
|
2333
|
+
* Array of batch error objects.
|
|
2334
|
+
*/
|
|
2335
|
+
data: {
|
|
2336
|
+
/**
|
|
2337
|
+
* Error code.
|
|
2338
|
+
*/
|
|
2339
|
+
code: string;
|
|
2340
|
+
/**
|
|
2341
|
+
* One-based input line to which the error refers.
|
|
2342
|
+
*/
|
|
2343
|
+
line?: number;
|
|
2344
|
+
/**
|
|
2345
|
+
* Human-readable error message.
|
|
2346
|
+
*/
|
|
2347
|
+
message: string;
|
|
2348
|
+
[k: string]: unknown;
|
|
2349
|
+
}[];
|
|
2350
|
+
/**
|
|
2351
|
+
* Object type for the error collection. Value: `list`.
|
|
2352
|
+
*/
|
|
2353
|
+
object: "list";
|
|
2354
|
+
[k: string]: unknown;
|
|
2355
|
+
};
|
|
2356
|
+
/**
|
|
2357
|
+
* Time expiration occurred, as Unix seconds.
|
|
2358
|
+
*/
|
|
2359
|
+
expired_at?: number;
|
|
2360
|
+
/**
|
|
2361
|
+
* Batch expiration time, as Unix seconds.
|
|
2362
|
+
*/
|
|
2363
|
+
expires_at?: number;
|
|
2364
|
+
/**
|
|
2365
|
+
* Time failure occurred, as Unix seconds.
|
|
2366
|
+
*/
|
|
2367
|
+
failed_at?: number;
|
|
2368
|
+
/**
|
|
2369
|
+
* Time finalization began, as Unix seconds.
|
|
2370
|
+
*/
|
|
2371
|
+
finalizing_at?: number;
|
|
2372
|
+
/**
|
|
2373
|
+
* Unique batch identifier.
|
|
2374
|
+
*/
|
|
2375
|
+
id: string;
|
|
2376
|
+
/**
|
|
2377
|
+
* Time processing began, as Unix seconds.
|
|
2378
|
+
*/
|
|
2379
|
+
in_progress_at?: number;
|
|
2380
|
+
/**
|
|
2381
|
+
* Identifier of the batch input file.
|
|
2382
|
+
*/
|
|
2383
|
+
input_file_id: string;
|
|
2384
|
+
/**
|
|
2385
|
+
* String key-value metadata associated with the batch.
|
|
2386
|
+
*/
|
|
2387
|
+
metadata?: {
|
|
2388
|
+
[k: string]: string;
|
|
2389
|
+
};
|
|
2390
|
+
/**
|
|
2391
|
+
* Object type for the batch. Value: `batch`.
|
|
2392
|
+
*/
|
|
2393
|
+
object: "batch";
|
|
2394
|
+
/**
|
|
2395
|
+
* Identifier of the output file.
|
|
2396
|
+
*/
|
|
2397
|
+
output_file_id?: string;
|
|
2398
|
+
/**
|
|
2399
|
+
* Batch request-count summary (`BatchRequestCounts`). Its nested fields are not specified in the provided documentation.
|
|
2400
|
+
*/
|
|
2401
|
+
request_counts: {
|
|
2402
|
+
[k: string]: unknown;
|
|
2403
|
+
};
|
|
2404
|
+
/**
|
|
2405
|
+
* Batch status.
|
|
2406
|
+
*/
|
|
2407
|
+
status: ("validating" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled" | "failed");
|
|
2408
|
+
/**
|
|
2409
|
+
* Batch usage summary (`BatchUsage`). Its nested fields are not specified in the provided documentation.
|
|
2410
|
+
*/
|
|
2411
|
+
usage: {
|
|
2412
|
+
[k: string]: unknown;
|
|
2413
|
+
};
|
|
2414
|
+
[k: string]: unknown;
|
|
2415
|
+
}[];
|
|
2416
|
+
/**
|
|
2417
|
+
* Error object returned for client errors.
|
|
2418
|
+
*/
|
|
2419
|
+
error?: {
|
|
2420
|
+
/**
|
|
2421
|
+
* HTTP status code.
|
|
2422
|
+
*/
|
|
2423
|
+
code: number;
|
|
2424
|
+
/**
|
|
2425
|
+
* Human-readable error message.
|
|
2426
|
+
*/
|
|
2427
|
+
message: string;
|
|
2428
|
+
/**
|
|
2429
|
+
* Parameter that caused the error.
|
|
2430
|
+
*/
|
|
2431
|
+
param?: string;
|
|
2432
|
+
/**
|
|
2433
|
+
* Error type identifier.
|
|
2434
|
+
*/
|
|
2435
|
+
type: string;
|
|
2436
|
+
[k: string]: unknown;
|
|
2437
|
+
};
|
|
2438
|
+
/**
|
|
2439
|
+
* Identifier of the first batch in the returned page.
|
|
2440
|
+
*/
|
|
2441
|
+
first_id?: string;
|
|
2442
|
+
/**
|
|
2443
|
+
* Whether additional pages of batches are available.
|
|
2444
|
+
*/
|
|
2445
|
+
has_more?: boolean;
|
|
2446
|
+
/**
|
|
2447
|
+
* Identifier of the last batch in the returned page. Use this value as `after_id` to request the next page.
|
|
2448
|
+
*/
|
|
2449
|
+
last_id?: string;
|
|
2450
|
+
/**
|
|
2451
|
+
* Object type for the page. Value: `list`.
|
|
2452
|
+
*/
|
|
2453
|
+
object?: "list";
|
|
2454
|
+
[k: string]: unknown;
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Builds the `list_batches` action.
|
|
2460
|
+
*
|
|
2461
|
+
* @example
|
|
2462
|
+
* ```json
|
|
2463
|
+
* {
|
|
2464
|
+
* "after_id": "batch_01JQ3Y5B8Q3H9R6K2M7N4P1ABC",
|
|
2465
|
+
* "limit": 20
|
|
2466
|
+
* }
|
|
2467
|
+
* ```
|
|
2468
|
+
*/
|
|
2469
|
+
declare function listBatches(input: ListBatchesTypes.Input): Action<ListBatchesTypes.output.Output>;
|
|
2470
|
+
declare namespace RetrieveBatchTypes {
|
|
2471
|
+
/**
|
|
2472
|
+
* Retrieves the current details, processing status, request counts, token usage, timestamps, output files, and errors for a specific batch.
|
|
2473
|
+
*/
|
|
2474
|
+
interface Input {
|
|
2475
|
+
/**
|
|
2476
|
+
* Batch identifier. Expected format: `batch_...`. Send this value in the URL path.
|
|
2477
|
+
*/
|
|
2478
|
+
batchId: string;
|
|
2479
|
+
}
|
|
2480
|
+
namespace output {
|
|
2481
|
+
/**
|
|
2482
|
+
* Response structure for retrieving a specific batch, including success and error responses.
|
|
2483
|
+
*/
|
|
2484
|
+
interface Output {
|
|
2485
|
+
/**
|
|
2486
|
+
* Optional Unix timestamp, in seconds, when the batch was cancelled.
|
|
2487
|
+
*/
|
|
2488
|
+
cancelled_at?: (number | null);
|
|
2489
|
+
/**
|
|
2490
|
+
* Optional Unix timestamp, in seconds, when cancellation began.
|
|
2491
|
+
*/
|
|
2492
|
+
cancelling_at?: (number | null);
|
|
2493
|
+
/**
|
|
2494
|
+
* Optional Unix timestamp, in seconds, when the batch completed.
|
|
2495
|
+
*/
|
|
2496
|
+
completed_at?: (number | null);
|
|
2497
|
+
/**
|
|
2498
|
+
* Time window allowed for batch completion.
|
|
2499
|
+
*/
|
|
2500
|
+
completion_window?: string;
|
|
2501
|
+
/**
|
|
2502
|
+
* Unix timestamp, in seconds, when the batch was created.
|
|
2503
|
+
*/
|
|
2504
|
+
created_at?: number;
|
|
2505
|
+
/**
|
|
2506
|
+
* API endpoint executed by requests in the batch.
|
|
2507
|
+
*/
|
|
2508
|
+
endpoint?: string;
|
|
2509
|
+
/**
|
|
2510
|
+
* Error details.
|
|
2511
|
+
*/
|
|
2512
|
+
error?: {
|
|
2513
|
+
/**
|
|
2514
|
+
* HTTP status code associated with the error.
|
|
2515
|
+
*/
|
|
2516
|
+
code?: number;
|
|
2517
|
+
/**
|
|
2518
|
+
* Human-readable error message.
|
|
2519
|
+
*/
|
|
2520
|
+
message?: string;
|
|
2521
|
+
/**
|
|
2522
|
+
* Optional parameter that caused the error.
|
|
2523
|
+
*/
|
|
2524
|
+
param?: (string | null);
|
|
2525
|
+
/**
|
|
2526
|
+
* Error type identifier.
|
|
2527
|
+
*/
|
|
2528
|
+
type?: string;
|
|
2529
|
+
[k: string]: unknown;
|
|
2530
|
+
};
|
|
2531
|
+
/**
|
|
2532
|
+
* Optional identifier of the error file containing failed request results.
|
|
2533
|
+
*/
|
|
2534
|
+
error_file_id?: string;
|
|
2535
|
+
/**
|
|
2536
|
+
* Collection of batch input-processing errors, if any.
|
|
2537
|
+
*/
|
|
2538
|
+
errors?: {
|
|
2539
|
+
/**
|
|
2540
|
+
* Array of error objects.
|
|
2541
|
+
*/
|
|
2542
|
+
data?: {
|
|
2543
|
+
/**
|
|
2544
|
+
* Error code.
|
|
2545
|
+
*/
|
|
2546
|
+
code?: string;
|
|
2547
|
+
/**
|
|
2548
|
+
* Optional 1-based input line number to which the error refers.
|
|
2549
|
+
*/
|
|
2550
|
+
line?: number;
|
|
2551
|
+
/**
|
|
2552
|
+
* Human-readable error message.
|
|
2553
|
+
*/
|
|
2554
|
+
message?: string;
|
|
2555
|
+
[k: string]: unknown;
|
|
2556
|
+
}[];
|
|
2557
|
+
/**
|
|
2558
|
+
* Error collection object type. Value: `list`.
|
|
2559
|
+
*/
|
|
2560
|
+
object?: "list";
|
|
2561
|
+
[k: string]: unknown;
|
|
2562
|
+
};
|
|
2563
|
+
/**
|
|
2564
|
+
* Optional Unix timestamp, in seconds, when the batch expired.
|
|
2565
|
+
*/
|
|
2566
|
+
expired_at?: (number | null);
|
|
2567
|
+
/**
|
|
2568
|
+
* Optional Unix timestamp, in seconds, when the batch expires.
|
|
2569
|
+
*/
|
|
2570
|
+
expires_at?: (number | null);
|
|
2571
|
+
/**
|
|
2572
|
+
* Optional Unix timestamp, in seconds, when the batch failed.
|
|
2573
|
+
*/
|
|
2574
|
+
failed_at?: (number | null);
|
|
2575
|
+
/**
|
|
2576
|
+
* Optional Unix timestamp, in seconds, when the batch entered finalization.
|
|
2577
|
+
*/
|
|
2578
|
+
finalizing_at?: (number | null);
|
|
2579
|
+
/**
|
|
2580
|
+
* Unique identifier of the batch.
|
|
2581
|
+
*/
|
|
2582
|
+
id?: string;
|
|
2583
|
+
/**
|
|
2584
|
+
* Optional Unix timestamp, in seconds, when batch processing began.
|
|
2585
|
+
*/
|
|
2586
|
+
in_progress_at?: (number | null);
|
|
2587
|
+
/**
|
|
2588
|
+
* Identifier of the input file used to create the batch.
|
|
2589
|
+
*/
|
|
2590
|
+
input_file_id?: string;
|
|
2591
|
+
/**
|
|
2592
|
+
* Optional string key-value metadata associated with the batch.
|
|
2593
|
+
*/
|
|
2594
|
+
metadata?: {
|
|
2595
|
+
[k: string]: string;
|
|
2596
|
+
};
|
|
2597
|
+
/**
|
|
2598
|
+
* Object type. Value: `batch`.
|
|
2599
|
+
*/
|
|
2600
|
+
object?: "batch";
|
|
2601
|
+
/**
|
|
2602
|
+
* Optional identifier of the output file containing successfully completed request results.
|
|
2603
|
+
*/
|
|
2604
|
+
output_file_id?: string;
|
|
2605
|
+
/**
|
|
2606
|
+
* Counts of requests in the batch by outcome.
|
|
2607
|
+
*/
|
|
2608
|
+
request_counts?: {
|
|
2609
|
+
/**
|
|
2610
|
+
* Number of successfully completed requests.
|
|
2611
|
+
*/
|
|
2612
|
+
completed?: number;
|
|
2613
|
+
/**
|
|
2614
|
+
* Number of failed requests.
|
|
2615
|
+
*/
|
|
2616
|
+
failed?: number;
|
|
2617
|
+
/**
|
|
2618
|
+
* Total number of requests in the batch.
|
|
2619
|
+
*/
|
|
2620
|
+
total?: number;
|
|
2621
|
+
[k: string]: unknown;
|
|
2622
|
+
};
|
|
2623
|
+
/**
|
|
2624
|
+
* Current batch status.
|
|
2625
|
+
*/
|
|
2626
|
+
status?: ("validating" | "in_progress" | "finalizing" | "completed" | "expired" | "cancelling" | "cancelled" | "failed");
|
|
2627
|
+
/**
|
|
2628
|
+
* Aggregate token usage for the batch.
|
|
2629
|
+
*/
|
|
2630
|
+
usage?: {
|
|
2631
|
+
/**
|
|
2632
|
+
* Total number of input tokens processed.
|
|
2633
|
+
*/
|
|
2634
|
+
input_tokens?: number;
|
|
2635
|
+
/**
|
|
2636
|
+
* Details about input token usage.
|
|
2637
|
+
*/
|
|
2638
|
+
input_tokens_details?: {
|
|
2639
|
+
/**
|
|
2640
|
+
* Number of input tokens served from cache.
|
|
2641
|
+
*/
|
|
2642
|
+
cached_tokens?: number;
|
|
2643
|
+
[k: string]: unknown;
|
|
2644
|
+
};
|
|
2645
|
+
/**
|
|
2646
|
+
* Total number of output tokens generated.
|
|
2647
|
+
*/
|
|
2648
|
+
output_tokens?: number;
|
|
2649
|
+
/**
|
|
2650
|
+
* Details about output token usage.
|
|
2651
|
+
*/
|
|
2652
|
+
output_tokens_details?: {
|
|
2653
|
+
/**
|
|
2654
|
+
* Number of output tokens used for reasoning.
|
|
2655
|
+
*/
|
|
2656
|
+
reasoning_tokens?: number;
|
|
2657
|
+
[k: string]: unknown;
|
|
2658
|
+
};
|
|
2659
|
+
/**
|
|
2660
|
+
* Total token usage, including input and output tokens.
|
|
2661
|
+
*/
|
|
2662
|
+
total_tokens?: number;
|
|
2663
|
+
[k: string]: unknown;
|
|
2664
|
+
};
|
|
2665
|
+
[k: string]: unknown;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2670
|
+
* Builds the `retrieve_batch` action.
|
|
2671
|
+
*
|
|
2672
|
+
* @example
|
|
2673
|
+
* ```json
|
|
2674
|
+
* {
|
|
2675
|
+
* "batchId": "batch_abc123def456"
|
|
2676
|
+
* }
|
|
2677
|
+
* ```
|
|
2678
|
+
*/
|
|
2679
|
+
declare function retrieveBatch(input: RetrieveBatchTypes.Input): Action<RetrieveBatchTypes.output.Output>;
|
|
2680
|
+
declare namespace RetrieveFileTypes {
|
|
2681
|
+
/**
|
|
2682
|
+
* Retrieves metadata for a specific file. Files may be uploaded batch files or batch output/error files.
|
|
2683
|
+
*/
|
|
2684
|
+
interface Input {
|
|
2685
|
+
/**
|
|
2686
|
+
* File identifier. File IDs use the `file_...` format. Send this value in the URL path.
|
|
2687
|
+
*/
|
|
2688
|
+
fileId: string;
|
|
2689
|
+
}
|
|
2690
|
+
namespace output {
|
|
2691
|
+
/**
|
|
2692
|
+
* Response structure for retrieving metadata for a specific file or an error when the file does not exist or has expired.
|
|
2693
|
+
*/
|
|
2694
|
+
interface Output {
|
|
2695
|
+
/**
|
|
2696
|
+
* File size in bytes.
|
|
2697
|
+
*/
|
|
2698
|
+
bytes?: number;
|
|
2699
|
+
/**
|
|
2700
|
+
* Unix timestamp, in seconds, indicating when the file was created.
|
|
2701
|
+
*/
|
|
2702
|
+
created_at?: number;
|
|
2703
|
+
/**
|
|
2704
|
+
* Error details returned for an unsuccessful request.
|
|
2705
|
+
*/
|
|
2706
|
+
error?: {
|
|
2707
|
+
/**
|
|
2708
|
+
* HTTP status code associated with the error.
|
|
2709
|
+
*/
|
|
2710
|
+
code?: number;
|
|
2711
|
+
/**
|
|
2712
|
+
* Human-readable error message.
|
|
2713
|
+
*/
|
|
2714
|
+
message?: string;
|
|
2715
|
+
/**
|
|
2716
|
+
* Optional parameter that caused the error.
|
|
2717
|
+
*/
|
|
2718
|
+
param?: string;
|
|
2719
|
+
/**
|
|
2720
|
+
* Error type identifier.
|
|
2721
|
+
*/
|
|
2722
|
+
type?: string;
|
|
2723
|
+
[k: string]: unknown;
|
|
2724
|
+
};
|
|
2725
|
+
/**
|
|
2726
|
+
* Optional Unix timestamp, in seconds, indicating when the file expires.
|
|
2727
|
+
*/
|
|
2728
|
+
expires_at?: number;
|
|
2729
|
+
/**
|
|
2730
|
+
* Original filename.
|
|
2731
|
+
*/
|
|
2732
|
+
filename?: string;
|
|
2733
|
+
/**
|
|
2734
|
+
* Unique file identifier.
|
|
2735
|
+
*/
|
|
2736
|
+
id?: string;
|
|
2737
|
+
/**
|
|
2738
|
+
* Object type. Value: `file`.
|
|
2739
|
+
*/
|
|
2740
|
+
object?: "file";
|
|
2741
|
+
/**
|
|
2742
|
+
* File purpose. Possible values: `batch` for uploaded batch files, or `batch_output` for batch output and error files.
|
|
2743
|
+
*/
|
|
2744
|
+
purpose?: ("batch" | "batch_output");
|
|
2745
|
+
[k: string]: unknown;
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Builds the `retrieve_file` action.
|
|
2751
|
+
*
|
|
2752
|
+
* @example
|
|
2753
|
+
* ```json
|
|
2754
|
+
* {
|
|
2755
|
+
* "fileId": "file_abc123def456"
|
|
2756
|
+
* }
|
|
2757
|
+
* ```
|
|
2758
|
+
*/
|
|
2759
|
+
declare function retrieveFile(input: RetrieveFileTypes.Input): Action<RetrieveFileTypes.output.Output>;
|
|
2760
|
+
declare namespace AnswerQuestionsTypes {
|
|
2761
|
+
/**
|
|
2762
|
+
* Evaluates one or more named questions against the provided state content. A single request can mix noul, choice, and score question types; the response returns an answer for every question using the same question name.
|
|
2763
|
+
*/
|
|
2764
|
+
interface Input {
|
|
2765
|
+
/**
|
|
2766
|
+
* Decision model to use.
|
|
2767
|
+
*/
|
|
2768
|
+
model: ("pplx-decider-v1.2" | "pplx-decider-flash-v1.2" | "pplx-decider-latest" | "perplexity/pplx-decider-latest" | "pplx-decider-flash-latest" | "perplexity/pplx-decider-flash-latest" | "pplx-decider-v1.1-27b" | "pplx-decider-v1-27b");
|
|
2769
|
+
/**
|
|
2770
|
+
* Object containing one or more named questions. Each property name is a caller-defined question name, and each value is a NoulQuestion, ChoiceQuestion, or ScoreQuestion.
|
|
2771
|
+
*/
|
|
2772
|
+
questions: {
|
|
2773
|
+
/**
|
|
2774
|
+
* A named question definition.
|
|
2775
|
+
*/
|
|
2776
|
+
[k: string]: {
|
|
2777
|
+
/**
|
|
2778
|
+
* Used by a choice question as an object of possible choices, or by a score question as an ordered array of score legend entries.
|
|
2779
|
+
*/
|
|
2780
|
+
criteria?: ({
|
|
2781
|
+
[k: string]: string;
|
|
2782
|
+
} | string[]);
|
|
2783
|
+
/**
|
|
2784
|
+
* Instructions describing what the model should evaluate or answer.
|
|
2785
|
+
*/
|
|
2786
|
+
instructions?: string;
|
|
2787
|
+
/**
|
|
2788
|
+
* Question type.
|
|
2789
|
+
*/
|
|
2790
|
+
type?: ("noul" | "choice" | "score");
|
|
2791
|
+
};
|
|
2792
|
+
};
|
|
2793
|
+
/**
|
|
2794
|
+
* Content against which questions are evaluated. Can be a string, JSON object, or array.
|
|
2795
|
+
*/
|
|
2796
|
+
state: (string | {} | unknown[]);
|
|
2797
|
+
}
|
|
2798
|
+
namespace output {
|
|
2799
|
+
/**
|
|
2800
|
+
* Successful or error response structure from the decisions endpoint.
|
|
2801
|
+
*/
|
|
2802
|
+
interface Output {
|
|
2803
|
+
/**
|
|
2804
|
+
* Answers keyed by the corresponding question names supplied in questions.
|
|
2805
|
+
*/
|
|
2806
|
+
answers?: {
|
|
2807
|
+
/**
|
|
2808
|
+
* Answer object whose shape corresponds to the type of the named question.
|
|
2809
|
+
*/
|
|
2810
|
+
[k: string]: {
|
|
2811
|
+
/**
|
|
2812
|
+
* Selected choice key for a choice answer.
|
|
2813
|
+
*/
|
|
2814
|
+
choice?: string;
|
|
2815
|
+
/**
|
|
2816
|
+
* Confidence value returned for documented choice and score answers.
|
|
2817
|
+
*/
|
|
2818
|
+
confidence?: number;
|
|
2819
|
+
/**
|
|
2820
|
+
* Score-level legend for a score answer. Keys are score levels and values are their labels.
|
|
2821
|
+
*/
|
|
2822
|
+
legend?: {
|
|
2823
|
+
[k: string]: string;
|
|
2824
|
+
};
|
|
2825
|
+
/**
|
|
2826
|
+
* noul result value for a noul answer.
|
|
2827
|
+
*/
|
|
2828
|
+
noul?: number;
|
|
2829
|
+
/**
|
|
2830
|
+
* Probability distribution. For choice answers, keys correspond to choice criteria. For score answers, keys correspond to score levels.
|
|
2831
|
+
*/
|
|
2832
|
+
probabilities?: {
|
|
2833
|
+
[k: string]: number;
|
|
2834
|
+
};
|
|
2835
|
+
/**
|
|
2836
|
+
* Numeric score for a score answer.
|
|
2837
|
+
*/
|
|
2838
|
+
score?: number;
|
|
2839
|
+
/**
|
|
2840
|
+
* Answer type.
|
|
2841
|
+
*/
|
|
2842
|
+
type?: ("noul" | "choice" | "score");
|
|
2843
|
+
[k: string]: unknown;
|
|
2844
|
+
};
|
|
2845
|
+
};
|
|
2846
|
+
/**
|
|
2847
|
+
* Error response body.
|
|
2848
|
+
*/
|
|
2849
|
+
error?: {
|
|
2850
|
+
/**
|
|
2851
|
+
* Error code, if any.
|
|
2852
|
+
*/
|
|
2853
|
+
code?: (string | null);
|
|
2854
|
+
/**
|
|
2855
|
+
* Human-readable error message.
|
|
2856
|
+
*/
|
|
2857
|
+
message?: string;
|
|
2858
|
+
/**
|
|
2859
|
+
* Associated parameter name, if any.
|
|
2860
|
+
*/
|
|
2861
|
+
param?: (string | null);
|
|
2862
|
+
/**
|
|
2863
|
+
* Error type.
|
|
2864
|
+
*/
|
|
2865
|
+
type?: string;
|
|
2866
|
+
[k: string]: unknown;
|
|
2867
|
+
};
|
|
2868
|
+
/**
|
|
2869
|
+
* The model name sent in the request, echoed back in the response.
|
|
2870
|
+
*/
|
|
2871
|
+
model?: string;
|
|
2872
|
+
/**
|
|
2873
|
+
* Token usage for the request.
|
|
2874
|
+
*/
|
|
2875
|
+
usage?: {
|
|
2876
|
+
/**
|
|
2877
|
+
* Number of input tokens processed for the request.
|
|
2878
|
+
*/
|
|
2879
|
+
input_tokens?: number;
|
|
2880
|
+
/**
|
|
2881
|
+
* Number of output tokens generated for the answers.
|
|
2882
|
+
*/
|
|
2883
|
+
output_tokens?: number;
|
|
2884
|
+
[k: string]: unknown;
|
|
2885
|
+
};
|
|
2886
|
+
[k: string]: unknown;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
/**
|
|
2891
|
+
* Builds the `answer_questions` action.
|
|
2892
|
+
*
|
|
2893
|
+
* @example
|
|
2894
|
+
* ```json
|
|
2895
|
+
* {
|
|
2896
|
+
* "model": "pplx-decider-latest",
|
|
2897
|
+
* "questions": {
|
|
2898
|
+
* "defect": {
|
|
2899
|
+
* "instructions": "Does the review report a product defect?",
|
|
2900
|
+
* "type": "noul"
|
|
2901
|
+
* },
|
|
2902
|
+
* "sentiment": {
|
|
2903
|
+
* "criteria": {
|
|
2904
|
+
* "mixed": "Praise and complaints in one review",
|
|
2905
|
+
* "negative": "Mostly dissatisfied",
|
|
2906
|
+
* "positive": "Mostly satisfied"
|
|
2907
|
+
* },
|
|
2908
|
+
* "instructions": "What is the overall sentiment of the review?",
|
|
2909
|
+
* "type": "choice"
|
|
2910
|
+
* },
|
|
2911
|
+
* "severity": {
|
|
2912
|
+
* "criteria": [
|
|
2913
|
+
* "Cosmetic",
|
|
2914
|
+
* "Inconvenient",
|
|
2915
|
+
* "Product unusable"
|
|
2916
|
+
* ],
|
|
2917
|
+
* "instructions": "How severe is the reported problem?",
|
|
2918
|
+
* "type": "score"
|
|
2919
|
+
* }
|
|
2920
|
+
* },
|
|
2921
|
+
* "state": {
|
|
2922
|
+
* "review": "The headphones sound great, but the battery stopped charging after two weeks.",
|
|
2923
|
+
* "title": "Battery died after two weeks"
|
|
2924
|
+
* }
|
|
2925
|
+
* }
|
|
2926
|
+
* ```
|
|
2927
|
+
*/
|
|
2928
|
+
declare function answerQuestions(input: AnswerQuestionsTypes.Input): Action<AnswerQuestionsTypes.output.Output>;
|
|
2929
|
+
declare namespace UploadBatchInputFileTypes {
|
|
2930
|
+
/**
|
|
2931
|
+
* Uploads a JSONL file for batch processing. Each line in the uploaded file is validated before the file is stored. Uploaded files expire 30 days after creation.
|
|
2932
|
+
*/
|
|
2933
|
+
interface Input {
|
|
2934
|
+
/**
|
|
2935
|
+
* The JSONL batch input file to upload. Send as a multipart file field. Maximum size: 200 MB. Maximum content length: 50,000 JSONL lines.
|
|
2936
|
+
*/
|
|
2937
|
+
file: string;
|
|
2938
|
+
/**
|
|
2939
|
+
* The purpose of the uploaded file. Must be `batch`.
|
|
2940
|
+
*/
|
|
2941
|
+
purpose: "batch";
|
|
2942
|
+
}
|
|
2943
|
+
namespace output {
|
|
2944
|
+
/**
|
|
2945
|
+
* Response structure for successful file upload and documented error responses.
|
|
2946
|
+
*/
|
|
2947
|
+
interface Output {
|
|
2948
|
+
/**
|
|
2949
|
+
* Size of the uploaded file in bytes.
|
|
2950
|
+
*/
|
|
2951
|
+
bytes?: number;
|
|
2952
|
+
/**
|
|
2953
|
+
* Unix timestamp, in seconds, when the file was created.
|
|
2954
|
+
*/
|
|
2955
|
+
created_at?: number;
|
|
2956
|
+
/**
|
|
2957
|
+
* Error information present in error responses.
|
|
2958
|
+
*/
|
|
2959
|
+
error?: {
|
|
2960
|
+
/**
|
|
2961
|
+
* HTTP status code. Present in error responses.
|
|
2962
|
+
*/
|
|
2963
|
+
code?: (400 | 403 | 413 | 429);
|
|
2964
|
+
/**
|
|
2965
|
+
* Human-readable error message. Present in error responses.
|
|
2966
|
+
*/
|
|
2967
|
+
message?: string;
|
|
2968
|
+
/**
|
|
2969
|
+
* Parameter that caused the error, when applicable. Present in error responses.
|
|
2970
|
+
*/
|
|
2971
|
+
param?: string;
|
|
2972
|
+
/**
|
|
2973
|
+
* Error type identifier. Present in error responses.
|
|
2974
|
+
*/
|
|
2975
|
+
type?: ("invalid_request_error" | "forbidden_error" | "request_too_large" | "rate_limit_error");
|
|
2976
|
+
[k: string]: unknown;
|
|
2977
|
+
};
|
|
2978
|
+
/**
|
|
2979
|
+
* Unix timestamp, in seconds, when the file expires.
|
|
2980
|
+
*/
|
|
2981
|
+
expires_at?: number;
|
|
2982
|
+
/**
|
|
2983
|
+
* Original filename of the uploaded file.
|
|
2984
|
+
*/
|
|
2985
|
+
filename?: string;
|
|
2986
|
+
/**
|
|
2987
|
+
* Unique identifier for the stored file.
|
|
2988
|
+
*/
|
|
2989
|
+
id?: string;
|
|
2990
|
+
/**
|
|
2991
|
+
* Object type. Always `file`.
|
|
2992
|
+
*/
|
|
2993
|
+
object?: "file";
|
|
2994
|
+
/**
|
|
2995
|
+
* File purpose. Values include `batch` for uploaded batch input files and `batch_output` for output and error files.
|
|
2996
|
+
*/
|
|
2997
|
+
purpose?: ("batch" | "batch_output");
|
|
2998
|
+
[k: string]: unknown;
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
/**
|
|
3003
|
+
* Builds the `upload_batch_input_file` action.
|
|
3004
|
+
*
|
|
3005
|
+
* @example
|
|
3006
|
+
* ```json
|
|
3007
|
+
* {
|
|
3008
|
+
* "file": "@customer-support-batch.jsonl",
|
|
3009
|
+
* "purpose": "batch"
|
|
3010
|
+
* }
|
|
3011
|
+
* ```
|
|
3012
|
+
*/
|
|
3013
|
+
declare function uploadBatchInputFile(input: UploadBatchInputFileTypes.Input): Action<UploadBatchInputFileTypes.output.Output>;
|
|
3014
|
+
declare namespace ListOrganizationFilesTypes {
|
|
3015
|
+
/**
|
|
3016
|
+
* Lists files belonging to the organization, including uploaded batch files and output or error files produced by batch operations. Deleted and expired files are not included in the response.
|
|
3017
|
+
*/
|
|
3018
|
+
interface Input {
|
|
3019
|
+
/**
|
|
3020
|
+
* File ID after which to begin listing files. Use the last_id value from the previous page to retrieve the next page. Send as a URL query parameter.
|
|
3021
|
+
*/
|
|
3022
|
+
after_id?: string;
|
|
3023
|
+
/**
|
|
3024
|
+
* Maximum number of files to return. Send as a URL query parameter.
|
|
3025
|
+
*/
|
|
3026
|
+
limit?: number;
|
|
3027
|
+
/**
|
|
3028
|
+
* Sort order. Allowed values: asc or desc. Use desc for newest files first. Send as a URL query parameter.
|
|
3029
|
+
*/
|
|
3030
|
+
order?: ("asc" | "desc");
|
|
3031
|
+
/**
|
|
3032
|
+
* Filters files by purpose. Allowed values: batch for uploaded batch files, or batch_output for batch output and error files. Send as a URL query parameter.
|
|
3033
|
+
*/
|
|
3034
|
+
purpose?: ("batch" | "batch_output");
|
|
3035
|
+
}
|
|
3036
|
+
namespace output {
|
|
3037
|
+
/**
|
|
3038
|
+
* Response structure for listing organization files, including success and error responses.
|
|
3039
|
+
*/
|
|
3040
|
+
interface Output {
|
|
3041
|
+
/**
|
|
3042
|
+
* Array of file objects.
|
|
3043
|
+
*/
|
|
3044
|
+
data?: {
|
|
3045
|
+
/**
|
|
3046
|
+
* Size of the file in bytes.
|
|
3047
|
+
*/
|
|
3048
|
+
bytes?: number;
|
|
3049
|
+
/**
|
|
3050
|
+
* Unix timestamp, in seconds, indicating when the file was created.
|
|
3051
|
+
*/
|
|
3052
|
+
created_at?: number;
|
|
3053
|
+
/**
|
|
3054
|
+
* Optional Unix timestamp, in seconds, indicating when the file expires.
|
|
3055
|
+
*/
|
|
3056
|
+
expires_at?: number;
|
|
3057
|
+
/**
|
|
3058
|
+
* Original filename.
|
|
3059
|
+
*/
|
|
3060
|
+
filename?: string;
|
|
3061
|
+
/**
|
|
3062
|
+
* Unique identifier for the file.
|
|
3063
|
+
*/
|
|
3064
|
+
id?: string;
|
|
3065
|
+
/**
|
|
3066
|
+
* Object type for each item. The value is file.
|
|
3067
|
+
*/
|
|
3068
|
+
object?: "file";
|
|
3069
|
+
/**
|
|
3070
|
+
* File purpose. Possible values are batch for uploads and batch_output for output and error files.
|
|
3071
|
+
*/
|
|
3072
|
+
purpose?: ("batch" | "batch_output");
|
|
3073
|
+
[k: string]: unknown;
|
|
3074
|
+
}[];
|
|
3075
|
+
/**
|
|
3076
|
+
* Error object returned for failed requests.
|
|
3077
|
+
*/
|
|
3078
|
+
error?: {
|
|
3079
|
+
/**
|
|
3080
|
+
* HTTP status code associated with the error.
|
|
3081
|
+
*/
|
|
3082
|
+
code?: number;
|
|
3083
|
+
/**
|
|
3084
|
+
* Human-readable error message.
|
|
3085
|
+
*/
|
|
3086
|
+
message?: string;
|
|
3087
|
+
/**
|
|
3088
|
+
* Optional parameter name that caused the error.
|
|
3089
|
+
*/
|
|
3090
|
+
param?: (string | null);
|
|
3091
|
+
/**
|
|
3092
|
+
* Error type identifier.
|
|
3093
|
+
*/
|
|
3094
|
+
type?: string;
|
|
3095
|
+
[k: string]: unknown;
|
|
3096
|
+
};
|
|
3097
|
+
/**
|
|
3098
|
+
* ID of the first file in the returned page, when present.
|
|
3099
|
+
*/
|
|
3100
|
+
first_id?: string;
|
|
3101
|
+
/**
|
|
3102
|
+
* Whether additional files are available after the current page.
|
|
3103
|
+
*/
|
|
3104
|
+
has_more?: boolean;
|
|
3105
|
+
/**
|
|
3106
|
+
* ID of the last file in the returned page, when present. Use this value as after_id to retrieve the next page.
|
|
3107
|
+
*/
|
|
3108
|
+
last_id?: string;
|
|
3109
|
+
/**
|
|
3110
|
+
* Response object type. The value is list.
|
|
3111
|
+
*/
|
|
3112
|
+
object?: "list";
|
|
3113
|
+
[k: string]: unknown;
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Builds the `list_organization_files` action.
|
|
3119
|
+
*
|
|
3120
|
+
* @example
|
|
3121
|
+
* ```json
|
|
3122
|
+
* {
|
|
3123
|
+
* "after_id": "file_01JQZ8J6K9L2M5N8P1R4S7T0V3",
|
|
3124
|
+
* "limit": 20,
|
|
3125
|
+
* "order": "desc",
|
|
3126
|
+
* "purpose": "batch"
|
|
3127
|
+
* }
|
|
3128
|
+
* ```
|
|
3129
|
+
*/
|
|
3130
|
+
declare function listOrganizationFiles(input: ListOrganizationFilesTypes.Input): Action<ListOrganizationFilesTypes.output.Output>;
|
|
3131
|
+
declare namespace ListAvailableAgentApiModelsTypes {
|
|
3132
|
+
/**
|
|
3133
|
+
* Lists the models available for the Agent API.
|
|
3134
|
+
*/
|
|
3135
|
+
interface Input {
|
|
3136
|
+
}
|
|
3137
|
+
namespace output {
|
|
3138
|
+
/**
|
|
3139
|
+
* Lists the models available for the Agent API. The response uses the OpenAI List Models format for compatibility with third-party tools.
|
|
3140
|
+
*/
|
|
3141
|
+
interface Output {
|
|
3142
|
+
/**
|
|
3143
|
+
* List of available model objects.
|
|
3144
|
+
*/
|
|
3145
|
+
data?: {
|
|
3146
|
+
/**
|
|
3147
|
+
* Unix timestamp, in seconds, indicating when the model was created.
|
|
3148
|
+
*/
|
|
3149
|
+
created?: number;
|
|
3150
|
+
/**
|
|
3151
|
+
* Model identifier in `provider/model-name` format. Use this value as the `model` parameter in Agent API requests.
|
|
3152
|
+
*/
|
|
3153
|
+
id?: string;
|
|
3154
|
+
/**
|
|
3155
|
+
* The model object type. Always `model`.
|
|
3156
|
+
*/
|
|
3157
|
+
object?: "model";
|
|
3158
|
+
/**
|
|
3159
|
+
* Provider that owns the model. Examples include `openai`, `anthropic`, `google`, `perplexity`, `xai`, `z-ai`, `moonshotai`, and `nvidia`.
|
|
3160
|
+
*/
|
|
3161
|
+
owned_by?: string;
|
|
3162
|
+
[k: string]: unknown;
|
|
3163
|
+
}[];
|
|
3164
|
+
/**
|
|
3165
|
+
* The response object type. Always `list`.
|
|
3166
|
+
*/
|
|
3167
|
+
object?: "list";
|
|
3168
|
+
[k: string]: unknown;
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3172
|
+
/**
|
|
3173
|
+
* Builds the `list_available_agent_api_models` action.
|
|
3174
|
+
*
|
|
3175
|
+
* @example
|
|
3176
|
+
* ```json
|
|
3177
|
+
* {}
|
|
3178
|
+
* ```
|
|
3179
|
+
*/
|
|
3180
|
+
declare function listAvailableAgentApiModels(input: ListAvailableAgentApiModelsTypes.Input): Action<ListAvailableAgentApiModelsTypes.output.Output>;
|
|
3181
|
+
declare namespace CancelAgentResponseTypes {
|
|
3182
|
+
/**
|
|
3183
|
+
* Requests cancellation of an agent response. Cancellation acts on durable state, so it can cancel background runs that outlive the client connection.
|
|
3184
|
+
*/
|
|
3185
|
+
interface Input {
|
|
3186
|
+
/**
|
|
3187
|
+
* Response ID to cancel. Must use the `resp_<...>` format. Send in the URL path.
|
|
3188
|
+
*/
|
|
3189
|
+
id: string;
|
|
3190
|
+
}
|
|
3191
|
+
namespace output {
|
|
3192
|
+
/**
|
|
3193
|
+
* Asynchronous cancellation acknowledgement or error response for cancelling an agent response.
|
|
3194
|
+
*/
|
|
3195
|
+
interface Output {
|
|
3196
|
+
/**
|
|
3197
|
+
* Error details, present in `400` and `404` responses.
|
|
3198
|
+
*/
|
|
3199
|
+
error?: {
|
|
3200
|
+
/**
|
|
3201
|
+
* Error code.
|
|
3202
|
+
*/
|
|
3203
|
+
code?: ("invalid_request" | "not_found");
|
|
3204
|
+
/**
|
|
3205
|
+
* Human-readable error message.
|
|
3206
|
+
*/
|
|
3207
|
+
message?: string;
|
|
3208
|
+
/**
|
|
3209
|
+
* Error type category.
|
|
3210
|
+
*/
|
|
3211
|
+
type?: ("invalid_request_error" | "not_found_error");
|
|
3212
|
+
[k: string]: unknown;
|
|
3213
|
+
};
|
|
3214
|
+
/**
|
|
3215
|
+
* The cancelled response ID in `resp_<...>` format. Present in successful responses.
|
|
3216
|
+
*/
|
|
3217
|
+
response_id?: string;
|
|
3218
|
+
/**
|
|
3219
|
+
* Always `cancelling` for a successful cancellation request. The response will stop asynchronously.
|
|
3220
|
+
*/
|
|
3221
|
+
status?: "cancelling";
|
|
3222
|
+
[k: string]: unknown;
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
/**
|
|
3227
|
+
* Builds the `cancel_agent_response` action.
|
|
3228
|
+
*
|
|
3229
|
+
* @example
|
|
3230
|
+
* ```json
|
|
3231
|
+
* {
|
|
3232
|
+
* "id": "resp_01JABCDEF123456789"
|
|
3233
|
+
* }
|
|
3234
|
+
* ```
|
|
3235
|
+
*/
|
|
3236
|
+
declare function cancelAgentResponse(input: CancelAgentResponseTypes.Input): Action<CancelAgentResponseTypes.output.Output>;
|
|
3237
|
+
declare namespace DownloadAgentResponseFileTypes {
|
|
3238
|
+
/**
|
|
3239
|
+
* Downloads the raw bytes of a file delivered by an agent response through the `share_file` tool. The response is streamed as file content rather than JSON, with a content type matching the downloaded file and an attachment filename supplied in the `Content-Disposition` response header.
|
|
3240
|
+
*/
|
|
3241
|
+
interface Input {
|
|
3242
|
+
/**
|
|
3243
|
+
* File ID obtained from the file list endpoint. This is distinct from the response ID. Send this value in the URL path.
|
|
3244
|
+
*/
|
|
3245
|
+
fileId: string;
|
|
3246
|
+
/**
|
|
3247
|
+
* Response ID in the format `resp_<...>`. Send this value in the URL path.
|
|
3248
|
+
*/
|
|
3249
|
+
id: string;
|
|
3250
|
+
}
|
|
3251
|
+
namespace output {
|
|
3252
|
+
/**
|
|
3253
|
+
* Successful response returns raw file bytes as binary content rather than JSON. Error responses return a JSON error object.
|
|
3254
|
+
*/
|
|
3255
|
+
interface Output {
|
|
3256
|
+
/**
|
|
3257
|
+
* Successful response body is raw file bytes; error response body is a JSON object.
|
|
3258
|
+
*/
|
|
3259
|
+
body?: (string | {
|
|
3260
|
+
/**
|
|
3261
|
+
* Error details.
|
|
3262
|
+
*/
|
|
3263
|
+
error?: {
|
|
3264
|
+
/**
|
|
3265
|
+
* Error code.
|
|
3266
|
+
*/
|
|
3267
|
+
code?: string;
|
|
3268
|
+
/**
|
|
3269
|
+
* Human-readable error message.
|
|
3270
|
+
*/
|
|
3271
|
+
message?: string;
|
|
3272
|
+
/**
|
|
3273
|
+
* Error type category.
|
|
3274
|
+
*/
|
|
3275
|
+
type?: string;
|
|
3276
|
+
[k: string]: unknown;
|
|
3277
|
+
};
|
|
3278
|
+
[k: string]: unknown;
|
|
3279
|
+
});
|
|
3280
|
+
/**
|
|
3281
|
+
* Response headers. On success, includes a file-specific `Content-Type` and `Content-Disposition: attachment` with the original filename.
|
|
3282
|
+
*/
|
|
3283
|
+
headers?: {
|
|
3284
|
+
/**
|
|
3285
|
+
* Contains attachment information and the original filename for successful downloads.
|
|
3286
|
+
*/
|
|
3287
|
+
"Content-Disposition"?: string;
|
|
3288
|
+
/**
|
|
3289
|
+
* On success, matches the downloaded file's media type. On errors, typically a JSON media type.
|
|
3290
|
+
*/
|
|
3291
|
+
"Content-Type"?: string;
|
|
3292
|
+
[k: string]: unknown;
|
|
3293
|
+
};
|
|
3294
|
+
/**
|
|
3295
|
+
* HTTP status code for the response.
|
|
3296
|
+
*/
|
|
3297
|
+
statusCode?: number;
|
|
3298
|
+
[k: string]: unknown;
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
/**
|
|
3303
|
+
* Builds the `download_agent_response_file` action.
|
|
3304
|
+
*
|
|
3305
|
+
* @example
|
|
3306
|
+
* ```json
|
|
3307
|
+
* {
|
|
3308
|
+
* "fileId": "file_01HFILEDEF",
|
|
3309
|
+
* "id": "resp_01HXYZABC"
|
|
3310
|
+
* }
|
|
3311
|
+
* ```
|
|
3312
|
+
*/
|
|
3313
|
+
declare function downloadAgentResponseFile(input: DownloadAgentResponseFileTypes.Input): Action<DownloadAgentResponseFileTypes.output.Output>;
|
|
3314
|
+
declare namespace ListFilesProducedAgentResponseTypes {
|
|
3315
|
+
/**
|
|
3316
|
+
* Lists files that an agent response produced in its sandbox and delivered through the `share_file` tool. The endpoint returns file metadata only; file content is not included inline and must be retrieved using the file content endpoint.
|
|
3317
|
+
*/
|
|
3318
|
+
interface Input {
|
|
3319
|
+
/**
|
|
3320
|
+
* Agent response ID in the format `resp_<...>`. Send this value in the URL path.
|
|
3321
|
+
*/
|
|
3322
|
+
id: string;
|
|
3323
|
+
}
|
|
3324
|
+
namespace output {
|
|
3325
|
+
/**
|
|
3326
|
+
* Response containing file metadata for files delivered from an agent response sandbox, or an error object for unsuccessful requests.
|
|
3327
|
+
*/
|
|
3328
|
+
interface Output {
|
|
3329
|
+
/**
|
|
3330
|
+
* List of files delivered from the agent response sandbox.
|
|
3331
|
+
*/
|
|
3332
|
+
data?: {
|
|
3333
|
+
/**
|
|
3334
|
+
* File size in bytes.
|
|
3335
|
+
*/
|
|
3336
|
+
bytes?: number;
|
|
3337
|
+
/**
|
|
3338
|
+
* Unix timestamp indicating when the file was created.
|
|
3339
|
+
*/
|
|
3340
|
+
created_at?: number;
|
|
3341
|
+
/**
|
|
3342
|
+
* Filename assigned by the sandbox.
|
|
3343
|
+
*/
|
|
3344
|
+
filename?: string;
|
|
3345
|
+
/**
|
|
3346
|
+
* File identifier used to download the file content. This is distinct from the agent response ID.
|
|
3347
|
+
*/
|
|
3348
|
+
id?: string;
|
|
3349
|
+
/**
|
|
3350
|
+
* Always `file`.
|
|
3351
|
+
*/
|
|
3352
|
+
object?: "file";
|
|
3353
|
+
[k: string]: unknown;
|
|
3354
|
+
}[];
|
|
3355
|
+
/**
|
|
3356
|
+
* Error details returned for an unsuccessful request.
|
|
3357
|
+
*/
|
|
3358
|
+
error?: {
|
|
3359
|
+
/**
|
|
3360
|
+
* Error code, when provided.
|
|
3361
|
+
*/
|
|
3362
|
+
code?: string;
|
|
3363
|
+
/**
|
|
3364
|
+
* Human-readable error message.
|
|
3365
|
+
*/
|
|
3366
|
+
message?: string;
|
|
3367
|
+
/**
|
|
3368
|
+
* Error type category, when provided.
|
|
3369
|
+
*/
|
|
3370
|
+
type?: string;
|
|
3371
|
+
[k: string]: unknown;
|
|
3372
|
+
};
|
|
3373
|
+
/**
|
|
3374
|
+
* Always `list`.
|
|
3375
|
+
*/
|
|
3376
|
+
object?: "list";
|
|
3377
|
+
[k: string]: unknown;
|
|
3378
|
+
}
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
/**
|
|
3382
|
+
* Builds the `list_files_produced_agent_response` action.
|
|
3383
|
+
*
|
|
3384
|
+
* @example
|
|
3385
|
+
* ```json
|
|
3386
|
+
* {
|
|
3387
|
+
* "id": "resp_01HQX2Y3Z4A5B6C7D8E9"
|
|
3388
|
+
* }
|
|
3389
|
+
* ```
|
|
3390
|
+
*/
|
|
3391
|
+
declare function listFilesProducedAgentResponse(input: ListFilesProducedAgentResponseTypes.Input): Action<ListFilesProducedAgentResponseTypes.output.Output>;
|
|
3392
|
+
declare namespace RetrieveAgentResponseTypes {
|
|
3393
|
+
/**
|
|
3394
|
+
* Retrieves a JSON snapshot of an agent response created earlier. Only responses created with `store` omitted or set to `true` can be retrieved; responses created with `store: false` return `404 Not Found`.
|
|
3395
|
+
*/
|
|
3396
|
+
interface Input {
|
|
3397
|
+
/**
|
|
3398
|
+
* Response ID to retrieve. Must use the `resp_<...>` format.
|
|
3399
|
+
*/
|
|
3400
|
+
id: string;
|
|
3401
|
+
}
|
|
3402
|
+
namespace output {
|
|
3403
|
+
/**
|
|
3404
|
+
* Response returned when retrieving a stored agent response snapshot, or an error when the response cannot be found or accessed.
|
|
3405
|
+
*/
|
|
3406
|
+
interface Output {
|
|
3407
|
+
/**
|
|
3408
|
+
* Required. Unix timestamp when the response was created.
|
|
3409
|
+
*/
|
|
3410
|
+
created_at?: number;
|
|
3411
|
+
/**
|
|
3412
|
+
* Effort and version that ran the response, formatted as `name@<version>`, for example `fast@2026-09-29.0`. Present only when the request used an effort level. Streams resumed with `starting_after` omit this field. For an alias, this is the effort and version selected by the alias. Supplying a versioned value as the request `effort` runs that configuration again; released versions may receive bug-fix patches. A value without a version is a bare effort name, indicating the run was created before effort versions or was served without versions.
|
|
3413
|
+
*/
|
|
3414
|
+
effort?: string;
|
|
3415
|
+
/**
|
|
3416
|
+
* Error information associated with the response, when present.
|
|
3417
|
+
*/
|
|
3418
|
+
error?: {
|
|
3419
|
+
/**
|
|
3420
|
+
* Error code.
|
|
3421
|
+
*/
|
|
3422
|
+
code?: string;
|
|
3423
|
+
/**
|
|
3424
|
+
* Required when `error` is present. Human-readable error message.
|
|
3425
|
+
*/
|
|
3426
|
+
message: string;
|
|
3427
|
+
/**
|
|
3428
|
+
* Error type category.
|
|
3429
|
+
*/
|
|
3430
|
+
type?: string;
|
|
3431
|
+
[k: string]: unknown;
|
|
3432
|
+
};
|
|
3433
|
+
/**
|
|
3434
|
+
* Required. Unique identifier for the response.
|
|
3435
|
+
*/
|
|
3436
|
+
id?: string;
|
|
3437
|
+
/**
|
|
3438
|
+
* Required. Model used for generation.
|
|
3439
|
+
*/
|
|
3440
|
+
model?: string;
|
|
3441
|
+
/**
|
|
3442
|
+
* Required. Response object type. Always `response`.
|
|
3443
|
+
*/
|
|
3444
|
+
object?: "response";
|
|
3445
|
+
/**
|
|
3446
|
+
* Required. Array of output items, including messages, search results, tool calls, and tool-related results.
|
|
3447
|
+
*/
|
|
3448
|
+
output?: {
|
|
3449
|
+
/**
|
|
3450
|
+
* Output item type.
|
|
3451
|
+
*/
|
|
3452
|
+
type?: string;
|
|
3453
|
+
[k: string]: unknown;
|
|
3454
|
+
}[];
|
|
3455
|
+
/**
|
|
3456
|
+
* Required. Response status: `completed`, `failed`, `incomplete`, `in_progress`, `queued`, or `cancelled`.
|
|
3457
|
+
*/
|
|
3458
|
+
status?: ("completed" | "failed" | "incomplete" | "in_progress" | "queued" | "cancelled");
|
|
3459
|
+
/**
|
|
3460
|
+
* Token-usage and cost information, when present.
|
|
3461
|
+
*/
|
|
3462
|
+
usage?: {
|
|
3463
|
+
/**
|
|
3464
|
+
* Response cost information.
|
|
3465
|
+
*/
|
|
3466
|
+
cost?: {
|
|
3467
|
+
[k: string]: unknown;
|
|
3468
|
+
};
|
|
3469
|
+
/**
|
|
3470
|
+
* Required when `usage` is present. Number of input tokens used.
|
|
3471
|
+
*/
|
|
3472
|
+
input_tokens: number;
|
|
3473
|
+
/**
|
|
3474
|
+
* Input-token cache details.
|
|
3475
|
+
*/
|
|
3476
|
+
input_tokens_details?: {
|
|
3477
|
+
/**
|
|
3478
|
+
* Tokens used for cache creation.
|
|
3479
|
+
*/
|
|
3480
|
+
cache_creation_input_tokens?: number;
|
|
3481
|
+
/**
|
|
3482
|
+
* Tokens read from cache.
|
|
3483
|
+
*/
|
|
3484
|
+
cache_read_input_tokens?: number;
|
|
3485
|
+
[k: string]: unknown;
|
|
3486
|
+
};
|
|
3487
|
+
/**
|
|
3488
|
+
* Required when `usage` is present. Number of output tokens generated.
|
|
3489
|
+
*/
|
|
3490
|
+
output_tokens: number;
|
|
3491
|
+
/**
|
|
3492
|
+
* Tool-call details keyed by tool-call identifier.
|
|
3493
|
+
*/
|
|
3494
|
+
tool_calls_details?: {
|
|
3495
|
+
[k: string]: unknown;
|
|
3496
|
+
};
|
|
3497
|
+
/**
|
|
3498
|
+
* Required when `usage` is present. Total tokens used: input tokens plus output tokens.
|
|
3499
|
+
*/
|
|
3500
|
+
total_tokens: number;
|
|
3501
|
+
[k: string]: unknown;
|
|
3502
|
+
};
|
|
3503
|
+
[k: string]: unknown;
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
}
|
|
3507
|
+
/**
|
|
3508
|
+
* Builds the `retrieve_agent_response` action.
|
|
3509
|
+
*
|
|
3510
|
+
* @example
|
|
3511
|
+
* ```json
|
|
3512
|
+
* {
|
|
3513
|
+
* "id": "resp_01JQ8YR4C5P9M2K7V6D3X1A0BC"
|
|
3514
|
+
* }
|
|
3515
|
+
* ```
|
|
3516
|
+
*/
|
|
3517
|
+
declare function retrieveAgentResponse(input: RetrieveAgentResponseTypes.Input): Action<RetrieveAgentResponseTypes.output.Output>;
|
|
3518
|
+
declare namespace GetSkillTypes {
|
|
3519
|
+
/**
|
|
3520
|
+
* Returns a skill and its revision metadata. When the optional `revision` query parameter is omitted, the endpoint returns the skill's active revision.
|
|
3521
|
+
*/
|
|
3522
|
+
interface Input {
|
|
3523
|
+
/**
|
|
3524
|
+
* Opaque revision token to retrieve. When omitted, the active revision is returned. Send this value as a URL query parameter.
|
|
3525
|
+
*/
|
|
3526
|
+
revision?: string;
|
|
3527
|
+
/**
|
|
3528
|
+
* Skill identifier returned by skill creation or by `GET /v1/skills`. Send this value in the URL path.
|
|
3529
|
+
*/
|
|
3530
|
+
skillId: string;
|
|
3531
|
+
}
|
|
3532
|
+
namespace output {
|
|
3533
|
+
/**
|
|
3534
|
+
* Successful or error response structure for retrieving a skill and its revision metadata.
|
|
3535
|
+
*/
|
|
3536
|
+
interface Output {
|
|
3537
|
+
/**
|
|
3538
|
+
* Timestamp indicating when the skill was created.
|
|
3539
|
+
*/
|
|
3540
|
+
created_at?: string;
|
|
3541
|
+
/**
|
|
3542
|
+
* Skill description read from the bundle's `SKILL.md` file.
|
|
3543
|
+
*/
|
|
3544
|
+
description?: string;
|
|
3545
|
+
/**
|
|
3546
|
+
* Error object returned for unsuccessful requests.
|
|
3547
|
+
*/
|
|
3548
|
+
error?: {
|
|
3549
|
+
/**
|
|
3550
|
+
* HTTP status code associated with the error.
|
|
3551
|
+
*/
|
|
3552
|
+
code?: number;
|
|
3553
|
+
/**
|
|
3554
|
+
* Human-readable error message.
|
|
3555
|
+
*/
|
|
3556
|
+
message?: string;
|
|
3557
|
+
/**
|
|
3558
|
+
* Parameter that caused the error, when applicable.
|
|
3559
|
+
*/
|
|
3560
|
+
param?: (string | null);
|
|
3561
|
+
/**
|
|
3562
|
+
* Error type identifier.
|
|
3563
|
+
*/
|
|
3564
|
+
type?: string;
|
|
3565
|
+
[k: string]: unknown;
|
|
3566
|
+
};
|
|
3567
|
+
/**
|
|
3568
|
+
* Opaque token for the skill's current latest revision. Pass this value as `expected_revision` when updating or deleting the skill.
|
|
3569
|
+
*/
|
|
3570
|
+
latest_revision?: string;
|
|
3571
|
+
/**
|
|
3572
|
+
* Skill name read from the bundle's `SKILL.md` file.
|
|
3573
|
+
*/
|
|
3574
|
+
name?: string;
|
|
3575
|
+
/**
|
|
3576
|
+
* Opaque token for the revision returned in this response. This is the latest revision or the specific revision requested with `revision`.
|
|
3577
|
+
*/
|
|
3578
|
+
revision?: string;
|
|
3579
|
+
/**
|
|
3580
|
+
* Skill identifier.
|
|
3581
|
+
*/
|
|
3582
|
+
skill_id?: string;
|
|
3583
|
+
/**
|
|
3584
|
+
* Timestamp indicating when the skill was last updated.
|
|
3585
|
+
*/
|
|
3586
|
+
updated_at?: string;
|
|
3587
|
+
[k: string]: unknown;
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
/**
|
|
3592
|
+
* Builds the `get_skill` action.
|
|
3593
|
+
*
|
|
3594
|
+
* @example
|
|
3595
|
+
* ```json
|
|
3596
|
+
* {
|
|
3597
|
+
* "revision": "rev_01HRQ8P7F5K2A9M4N8C6D3E1B0",
|
|
3598
|
+
* "skillId": "skill_01HRQ8K5ZB7P3M2V6C9D4E1F0A"
|
|
3599
|
+
* }
|
|
3600
|
+
* ```
|
|
3601
|
+
*/
|
|
3602
|
+
declare function getSkill(input: GetSkillTypes.Input): Action<GetSkillTypes.output.Output>;
|
|
3603
|
+
declare namespace CreateSkillTypes {
|
|
3604
|
+
/**
|
|
3605
|
+
* Creates a skill from a ZIP bundle. The bundle must contain a `SKILL.md` file; the skill `name` and `description` are read from that file and are not supplied as request fields.
|
|
3606
|
+
*/
|
|
3607
|
+
interface Input {
|
|
3608
|
+
/**
|
|
3609
|
+
* Raw ZIP bundle content sent as the request body. The bundle must include `SKILL.md`. The documentation does not specify individual request-body fields or a dedicated upload media type.
|
|
3610
|
+
*/
|
|
3611
|
+
body: string;
|
|
3612
|
+
}
|
|
3613
|
+
namespace output {
|
|
3614
|
+
/**
|
|
3615
|
+
* Response returned after attempting to create a skill from a ZIP bundle.
|
|
3616
|
+
*/
|
|
3617
|
+
interface Output {
|
|
3618
|
+
/**
|
|
3619
|
+
* Timestamp indicating when the skill was created.
|
|
3620
|
+
*/
|
|
3621
|
+
created_at?: string;
|
|
3622
|
+
/**
|
|
3623
|
+
* Skill description read from the bundle's `SKILL.md`.
|
|
3624
|
+
*/
|
|
3625
|
+
description?: string;
|
|
3626
|
+
/**
|
|
3627
|
+
* Error details returned for unsuccessful requests.
|
|
3628
|
+
*/
|
|
3629
|
+
error?: {
|
|
3630
|
+
/**
|
|
3631
|
+
* HTTP status code.
|
|
3632
|
+
*/
|
|
3633
|
+
code: number;
|
|
3634
|
+
/**
|
|
3635
|
+
* Human-readable error message.
|
|
3636
|
+
*/
|
|
3637
|
+
message: string;
|
|
3638
|
+
/**
|
|
3639
|
+
* Parameter that caused the error, when applicable.
|
|
3640
|
+
*/
|
|
3641
|
+
param?: (string | null);
|
|
3642
|
+
/**
|
|
3643
|
+
* Error type identifier.
|
|
3644
|
+
*/
|
|
3645
|
+
type: string;
|
|
3646
|
+
[k: string]: unknown;
|
|
3647
|
+
};
|
|
3648
|
+
/**
|
|
3649
|
+
* Opaque token for the skill's current latest revision. Pass this value as `expected_revision` when updating or deleting the skill.
|
|
3650
|
+
*/
|
|
3651
|
+
latest_revision?: string;
|
|
3652
|
+
/**
|
|
3653
|
+
* Skill name read from the bundle's `SKILL.md`.
|
|
3654
|
+
*/
|
|
3655
|
+
name?: string;
|
|
3656
|
+
/**
|
|
3657
|
+
* Opaque token for the revision returned in this response. This is the latest revision unless a specific revision was requested via `revision`.
|
|
3658
|
+
*/
|
|
3659
|
+
revision?: string;
|
|
3660
|
+
/**
|
|
3661
|
+
* Unique skill identifier.
|
|
3662
|
+
*/
|
|
3663
|
+
skill_id?: string;
|
|
3664
|
+
/**
|
|
3665
|
+
* Timestamp indicating when the skill was last updated.
|
|
3666
|
+
*/
|
|
3667
|
+
updated_at?: string;
|
|
3668
|
+
[k: string]: unknown;
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
/**
|
|
3673
|
+
* Builds the `create_skill` action.
|
|
3674
|
+
*
|
|
3675
|
+
* @example
|
|
3676
|
+
* ```json
|
|
3677
|
+
* {
|
|
3678
|
+
* "body": "UEsDBBQAAAAIAAAAIQAAAAAAAAAAAAAAAAAJAAAAU0tJTEwubWTLzE1VSEksSVRIzCnISFSwUshLzE1VSM7PLShKLS5WKM8vyklRSEpNTC7JzM9TKEktLgYAUEsBAhQDFAAAAAgAAAAhAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAgAEAAAAAU0tJTEwubWRQSwUGAAAAAAEAAQA3AAAALAAAAAA="
|
|
3679
|
+
* }
|
|
3680
|
+
* ```
|
|
3681
|
+
*/
|
|
3682
|
+
declare function createSkill(input: CreateSkillTypes.Input): Action<CreateSkillTypes.output.Output>;
|
|
3683
|
+
declare namespace DeleteSkillTypes {
|
|
3684
|
+
/**
|
|
3685
|
+
* Deletes a skill identified by its skill ID. The request uses optimistic concurrency control: the supplied expected_revision must match the skill's current revision, preventing deletion from racing with a concurrent update.
|
|
3686
|
+
*/
|
|
3687
|
+
interface Input {
|
|
3688
|
+
/**
|
|
3689
|
+
* Opaque revision token that the skill must currently have. The deletion is applied only when this token matches the current revision, preventing races with concurrent updates. Send this value as a URL query parameter.
|
|
3690
|
+
*/
|
|
3691
|
+
expected_revision: string;
|
|
3692
|
+
/**
|
|
3693
|
+
* Skill identifier returned by skill creation or GET /v1/skills. Send this value in the URL path.
|
|
3694
|
+
*/
|
|
3695
|
+
skillId: string;
|
|
3696
|
+
}
|
|
3697
|
+
namespace output {
|
|
3698
|
+
/**
|
|
3699
|
+
* Response from deleting a skill. A successful deletion returns 204 No Content with no response body. Unsuccessful requests return an error object.
|
|
3700
|
+
*/
|
|
3701
|
+
interface Output {
|
|
3702
|
+
/**
|
|
3703
|
+
* Error details returned for unsuccessful requests.
|
|
3704
|
+
*/
|
|
3705
|
+
error?: {
|
|
3706
|
+
/**
|
|
3707
|
+
* HTTP status code associated with the error.
|
|
3708
|
+
*/
|
|
3709
|
+
code?: (400 | 404 | 409 | 429 | 502);
|
|
3710
|
+
/**
|
|
3711
|
+
* Human-readable error message.
|
|
3712
|
+
*/
|
|
3713
|
+
message?: string;
|
|
3714
|
+
/**
|
|
3715
|
+
* Parameter that caused the error, when applicable.
|
|
3716
|
+
*/
|
|
3717
|
+
param?: string;
|
|
3718
|
+
/**
|
|
3719
|
+
* Error type identifier.
|
|
3720
|
+
*/
|
|
3721
|
+
type?: ("invalid_request_error" | "not_found_error" | "conflict_error" | "rate_limit_error" | "service_unavailable_error");
|
|
3722
|
+
[k: string]: unknown;
|
|
3723
|
+
};
|
|
3724
|
+
[k: string]: unknown;
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
/**
|
|
3729
|
+
* Builds the `delete_skill` action.
|
|
3730
|
+
*
|
|
3731
|
+
* @example
|
|
3732
|
+
* ```json
|
|
3733
|
+
* {
|
|
3734
|
+
* "expected_revision": "rev_01HZY8J4K7",
|
|
3735
|
+
* "skillId": "skill_abc123"
|
|
3736
|
+
* }
|
|
3737
|
+
* ```
|
|
3738
|
+
*/
|
|
3739
|
+
declare function deleteSkill(input: DeleteSkillTypes.Input): Action<DeleteSkillTypes.output.Output>;
|
|
3740
|
+
declare namespace AddSkillRevisionTypes {
|
|
3741
|
+
/**
|
|
3742
|
+
* Uploads a new ZIP bundle as a new revision of an existing skill. The update uses optimistic concurrency control: provide the revision token that is expected to be current, and the request is rejected if the skill has been updated since that revision.
|
|
3743
|
+
*/
|
|
3744
|
+
interface Input {
|
|
3745
|
+
/**
|
|
3746
|
+
* New ZIP bundle for the skill revision. The skill name and description are read from the bundle's `SKILL.md`. The scraped documentation does not define a structured request-body schema.
|
|
3747
|
+
*/
|
|
3748
|
+
body: string;
|
|
3749
|
+
/**
|
|
3750
|
+
* Opaque revision token that the skill must currently be at. The write applies only when this value matches, preventing concurrent-update races. Send in the URL query string.
|
|
3751
|
+
*/
|
|
3752
|
+
expected_revision: string;
|
|
3753
|
+
/**
|
|
3754
|
+
* Skill identifier returned by skill creation or `GET /v1/skills`. Send in the URL path.
|
|
3755
|
+
*/
|
|
3756
|
+
skillId: string;
|
|
3757
|
+
}
|
|
3758
|
+
namespace output {
|
|
3759
|
+
/**
|
|
3760
|
+
* Response structure for adding a new skill revision, including success and documented error responses.
|
|
3761
|
+
*/
|
|
3762
|
+
interface Output {
|
|
3763
|
+
/**
|
|
3764
|
+
* Timestamp when the skill was created.
|
|
3765
|
+
*/
|
|
3766
|
+
created_at?: string;
|
|
3767
|
+
/**
|
|
3768
|
+
* Skill description, read from the bundle's `SKILL.md`.
|
|
3769
|
+
*/
|
|
3770
|
+
description?: string;
|
|
3771
|
+
/**
|
|
3772
|
+
* Error details returned for failed requests.
|
|
3773
|
+
*/
|
|
3774
|
+
error?: {
|
|
3775
|
+
/**
|
|
3776
|
+
* HTTP status code associated with the error.
|
|
3777
|
+
*/
|
|
3778
|
+
code?: (400 | 404 | 409 | 413 | 429 | 502);
|
|
3779
|
+
/**
|
|
3780
|
+
* Human-readable error message.
|
|
3781
|
+
*/
|
|
3782
|
+
message?: string;
|
|
3783
|
+
/**
|
|
3784
|
+
* Parameter that caused the error, when applicable.
|
|
3785
|
+
*/
|
|
3786
|
+
param?: string;
|
|
3787
|
+
/**
|
|
3788
|
+
* Error type identifier.
|
|
3789
|
+
*/
|
|
3790
|
+
type?: ("invalid_request_error" | "not_found_error" | "revision_conflict_error" | "payload_too_large_error" | "rate_limit_error" | "service_unavailable_error");
|
|
3791
|
+
[k: string]: unknown;
|
|
3792
|
+
};
|
|
3793
|
+
/**
|
|
3794
|
+
* Opaque token for the skill's current latest revision. Use this value as `expected_revision` when updating or deleting the skill.
|
|
3795
|
+
*/
|
|
3796
|
+
latest_revision?: string;
|
|
3797
|
+
/**
|
|
3798
|
+
* Skill name, read from the bundle's `SKILL.md`.
|
|
3799
|
+
*/
|
|
3800
|
+
name?: string;
|
|
3801
|
+
/**
|
|
3802
|
+
* Opaque token for the revision returned in this response. This is the latest revision unless a specific revision was requested.
|
|
3803
|
+
*/
|
|
3804
|
+
revision?: string;
|
|
3805
|
+
/**
|
|
3806
|
+
* Skill identifier.
|
|
3807
|
+
*/
|
|
3808
|
+
skill_id?: string;
|
|
3809
|
+
/**
|
|
3810
|
+
* Timestamp when the skill was last updated.
|
|
3811
|
+
*/
|
|
3812
|
+
updated_at?: string;
|
|
3813
|
+
[k: string]: unknown;
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
/**
|
|
3818
|
+
* Builds the `add_skill_revision` action.
|
|
3819
|
+
*
|
|
3820
|
+
* @example
|
|
3821
|
+
* ```json
|
|
3822
|
+
* {
|
|
3823
|
+
* "body": "UEsDBBQAAAAIAGZpcFQAAAAAAAAAAAAAAAAJAAAAU0tJTEwubWRbz0jNyclXSCvKz1XISSxJVEjOzytJzStRSM7PK0nNK1FIK8rPVShJLS5RKEiszMlPTFFISixScM7PLShKLS7OzM9TSEpV0lFQKkstKs7Mz1NISSxJVUjLL1IoLQYApY0eX1gAAAA=",
|
|
3824
|
+
* "expected_revision": "rev_01J4SKILLREVISION01",
|
|
3825
|
+
* "skillId": "skill_abc123"
|
|
3826
|
+
* }
|
|
3827
|
+
* ```
|
|
3828
|
+
*/
|
|
3829
|
+
declare function addSkillRevision(input: AddSkillRevisionTypes.Input): Action<AddSkillRevisionTypes.output.Output>;
|
|
3830
|
+
declare namespace GetSkillDownloadUrlTypes {
|
|
3831
|
+
/**
|
|
3832
|
+
* Returns a short-lived URL for downloading a skill bundle as a ZIP file. When `revision` is omitted, the endpoint returns a download URL for the skill's active revision.
|
|
3833
|
+
*/
|
|
3834
|
+
interface Input {
|
|
3835
|
+
/**
|
|
3836
|
+
* Opaque revision token to download. Send as a URL query parameter. When omitted, the active revision is used.
|
|
3837
|
+
*/
|
|
3838
|
+
revision?: string;
|
|
3839
|
+
/**
|
|
3840
|
+
* Skill identifier returned by skill creation or `GET /v1/skills`. Send in the URL path.
|
|
3841
|
+
*/
|
|
3842
|
+
skillId: string;
|
|
3843
|
+
}
|
|
3844
|
+
namespace output {
|
|
3845
|
+
/**
|
|
3846
|
+
* Response containing the resolved skill revision and a short-lived ZIP bundle download URL, or error details for unsuccessful requests.
|
|
3847
|
+
*/
|
|
3848
|
+
interface Output {
|
|
3849
|
+
/**
|
|
3850
|
+
* Short-lived URL for downloading the skill ZIP bundle.
|
|
3851
|
+
*/
|
|
3852
|
+
download_url?: string;
|
|
3853
|
+
/**
|
|
3854
|
+
* Error details returned for unsuccessful requests.
|
|
3855
|
+
*/
|
|
3856
|
+
error?: {
|
|
3857
|
+
/**
|
|
3858
|
+
* HTTP status code.
|
|
3859
|
+
*/
|
|
3860
|
+
code: number;
|
|
3861
|
+
/**
|
|
3862
|
+
* Human-readable error message.
|
|
3863
|
+
*/
|
|
3864
|
+
message: string;
|
|
3865
|
+
/**
|
|
3866
|
+
* Parameter that caused the error, when applicable.
|
|
3867
|
+
*/
|
|
3868
|
+
param?: string;
|
|
3869
|
+
/**
|
|
3870
|
+
* Error type identifier.
|
|
3871
|
+
*/
|
|
3872
|
+
type: string;
|
|
3873
|
+
[k: string]: unknown;
|
|
3874
|
+
};
|
|
3875
|
+
/**
|
|
3876
|
+
* Skill name at the downloaded revision.
|
|
3877
|
+
*/
|
|
3878
|
+
name?: string;
|
|
3879
|
+
/**
|
|
3880
|
+
* Opaque token of the downloaded revision.
|
|
3881
|
+
*/
|
|
3882
|
+
revision?: string;
|
|
3883
|
+
[k: string]: unknown;
|
|
3884
|
+
}
|
|
3885
|
+
}
|
|
3886
|
+
}
|
|
3887
|
+
/**
|
|
3888
|
+
* Builds the `get_skill_download_url` action.
|
|
3889
|
+
*
|
|
3890
|
+
* @example
|
|
3891
|
+
* ```json
|
|
3892
|
+
* {
|
|
3893
|
+
* "revision": "rev_20251115_001",
|
|
3894
|
+
* "skillId": "skill_abc123"
|
|
3895
|
+
* }
|
|
3896
|
+
* ```
|
|
3897
|
+
*/
|
|
3898
|
+
declare function getSkillDownloadUrl(input: GetSkillDownloadUrlTypes.Input): Action<GetSkillDownloadUrlTypes.output.Output>;
|
|
3899
|
+
declare namespace ListSkillsTypes {
|
|
3900
|
+
/**
|
|
3901
|
+
* Lists the skills in your Project, ordered newest first.
|
|
3902
|
+
*/
|
|
3903
|
+
interface Input {
|
|
3904
|
+
/**
|
|
3905
|
+
* Maximum number of items to return. Minimum: 1; maximum: 200; default: 50.
|
|
3906
|
+
*/
|
|
3907
|
+
limit?: number;
|
|
3908
|
+
/**
|
|
3909
|
+
* Opaque token from a previous response's next_page_token used to retrieve the next page.
|
|
3910
|
+
*/
|
|
3911
|
+
page_token?: string;
|
|
3912
|
+
}
|
|
3913
|
+
namespace output {
|
|
3914
|
+
/**
|
|
3915
|
+
* Response returned when listing skills in the Project.
|
|
3916
|
+
*/
|
|
3917
|
+
interface Output {
|
|
3918
|
+
/**
|
|
3919
|
+
* Error details returned for failed requests.
|
|
3920
|
+
*/
|
|
3921
|
+
error?: {
|
|
3922
|
+
/**
|
|
3923
|
+
* HTTP status code.
|
|
3924
|
+
*/
|
|
3925
|
+
code: number;
|
|
3926
|
+
/**
|
|
3927
|
+
* Human-readable error message.
|
|
3928
|
+
*/
|
|
3929
|
+
message: string;
|
|
3930
|
+
/**
|
|
3931
|
+
* Parameter that caused the error, when applicable.
|
|
3932
|
+
*/
|
|
3933
|
+
param?: string;
|
|
3934
|
+
/**
|
|
3935
|
+
* Error type identifier.
|
|
3936
|
+
*/
|
|
3937
|
+
type: string;
|
|
3938
|
+
[k: string]: unknown;
|
|
3939
|
+
};
|
|
3940
|
+
/**
|
|
3941
|
+
* Opaque token used to retrieve the next page of results. Omitted on the last page.
|
|
3942
|
+
*/
|
|
3943
|
+
next_page_token?: string;
|
|
3944
|
+
/**
|
|
3945
|
+
* List of skills in the Project, ordered newest first.
|
|
3946
|
+
*/
|
|
3947
|
+
skills: {
|
|
3948
|
+
/**
|
|
3949
|
+
* Timestamp when the skill was created.
|
|
3950
|
+
*/
|
|
3951
|
+
created_at?: string;
|
|
3952
|
+
/**
|
|
3953
|
+
* Skill name read from the bundle's SKILL.md.
|
|
3954
|
+
*/
|
|
3955
|
+
name?: string;
|
|
3956
|
+
/**
|
|
3957
|
+
* Opaque revision token for the skill. Pass this value as expected_revision when updating or deleting the skill.
|
|
3958
|
+
*/
|
|
3959
|
+
revision?: string;
|
|
3960
|
+
/**
|
|
3961
|
+
* Skill identifier.
|
|
3962
|
+
*/
|
|
3963
|
+
skill_id: string;
|
|
3964
|
+
/**
|
|
3965
|
+
* Timestamp when the skill was last updated.
|
|
3966
|
+
*/
|
|
3967
|
+
updated_at?: string;
|
|
3968
|
+
[k: string]: unknown;
|
|
3969
|
+
}[];
|
|
3970
|
+
[k: string]: unknown;
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
}
|
|
3974
|
+
/**
|
|
3975
|
+
* Builds the `list_skills` action.
|
|
3976
|
+
*
|
|
3977
|
+
* @example
|
|
3978
|
+
* ```json
|
|
3979
|
+
* {
|
|
3980
|
+
* "limit": 25,
|
|
3981
|
+
* "page_token": "page_01JQ5Z2MXK8G7V4N3H6C9R1T0P"
|
|
3982
|
+
* }
|
|
3983
|
+
* ```
|
|
3984
|
+
*/
|
|
3985
|
+
declare function listSkills(input: ListSkillsTypes.Input): Action<ListSkillsTypes.output.Output>;
|
|
3986
|
+
declare namespace ListSkillsRevisionsTypes {
|
|
3987
|
+
/**
|
|
3988
|
+
* Lists the revisions for a specified skill, ordered with the newest revision first. The response can be paginated using an opaque page token.
|
|
3989
|
+
*/
|
|
3990
|
+
interface Input {
|
|
3991
|
+
/**
|
|
3992
|
+
* Maximum number of revisions to return. Must be from `1` to `200`. Default: `50`. Send in the URL query string.
|
|
3993
|
+
*/
|
|
3994
|
+
limit?: number;
|
|
3995
|
+
/**
|
|
3996
|
+
* Opaque pagination token from a previous response's `next_page_token`. Send in the URL query string.
|
|
3997
|
+
*/
|
|
3998
|
+
page_token?: string;
|
|
3999
|
+
/**
|
|
4000
|
+
* Skill identifier returned by creating the skill or by `GET /v1/skills`. Send in the URL path.
|
|
4001
|
+
*/
|
|
4002
|
+
skillId: string;
|
|
4003
|
+
}
|
|
4004
|
+
namespace output {
|
|
4005
|
+
/**
|
|
4006
|
+
* Response structure for listing a skill's revisions, including success and error responses.
|
|
4007
|
+
*/
|
|
4008
|
+
interface Output {
|
|
4009
|
+
/**
|
|
4010
|
+
* Error details returned for unsuccessful requests.
|
|
4011
|
+
*/
|
|
4012
|
+
error?: {
|
|
4013
|
+
/**
|
|
4014
|
+
* HTTP status code.
|
|
4015
|
+
*/
|
|
4016
|
+
code?: number;
|
|
4017
|
+
/**
|
|
4018
|
+
* Human-readable error message.
|
|
4019
|
+
*/
|
|
4020
|
+
message?: string;
|
|
4021
|
+
/**
|
|
4022
|
+
* Parameter that caused the error, when applicable.
|
|
4023
|
+
*/
|
|
4024
|
+
param?: string;
|
|
4025
|
+
/**
|
|
4026
|
+
* Error type identifier.
|
|
4027
|
+
*/
|
|
4028
|
+
type?: string;
|
|
4029
|
+
[k: string]: unknown;
|
|
4030
|
+
};
|
|
4031
|
+
/**
|
|
4032
|
+
* Opaque token for retrieving the next page of results. Omitted on the last page.
|
|
4033
|
+
*/
|
|
4034
|
+
next_page_token?: string;
|
|
4035
|
+
/**
|
|
4036
|
+
* List of skill revisions, ordered newest first.
|
|
4037
|
+
*/
|
|
4038
|
+
revisions?: {
|
|
4039
|
+
/**
|
|
4040
|
+
* Creation timestamp for the revision.
|
|
4041
|
+
*/
|
|
4042
|
+
created_at?: string;
|
|
4043
|
+
/**
|
|
4044
|
+
* Skill name at the listed revision.
|
|
4045
|
+
*/
|
|
4046
|
+
name?: string;
|
|
4047
|
+
/**
|
|
4048
|
+
* Opaque revision token.
|
|
4049
|
+
*/
|
|
4050
|
+
revision?: string;
|
|
4051
|
+
[k: string]: unknown;
|
|
4052
|
+
}[];
|
|
4053
|
+
[k: string]: unknown;
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
}
|
|
4057
|
+
/**
|
|
4058
|
+
* Builds the `list_skills_revisions` action.
|
|
4059
|
+
*
|
|
4060
|
+
* @example
|
|
4061
|
+
* ```json
|
|
4062
|
+
* {
|
|
4063
|
+
* "limit": 50,
|
|
4064
|
+
* "page_token": "next_page_token_01HTQ4R0",
|
|
4065
|
+
* "skillId": "skill_01HTQ4M8ZP7K3A6N"
|
|
4066
|
+
* }
|
|
4067
|
+
* ```
|
|
4068
|
+
*/
|
|
4069
|
+
declare function listSkillsRevisions(input: ListSkillsRevisionsTypes.Input): Action<ListSkillsRevisionsTypes.output.Output>;
|
|
4070
|
+
|
|
4071
|
+
export { AddSkillRevisionTypes, AnswerQuestionsTypes, CancelAgentResponseTypes, CancelBatchTypes, CreateAgentResponseTypes, CreateAsyncChatCompletionSonarTypes, CreateBatchTypes, CreateChatCompletionTypes, CreateContextualizedEmbeddingsTypes, CreateEmbeddingsTypes, CreateSkillTypes, DeleteFileTypes, DeleteSkillTypes, DownloadAgentResponseFileTypes, DownloadFileContentTypes, GetAsyncChatCompletionResponseTypes, GetSkillDownloadUrlTypes, GetSkillTypes, ListAsyncChatCompletionsAuthenticatedUserTypes, ListAvailableAgentApiModelsTypes, ListBatchesTypes, ListFilesProducedAgentResponseTypes, ListOrganizationFilesTypes, ListSkillsRevisionsTypes, ListSkillsTypes, RetrieveAgentResponseTypes, RetrieveBatchTypes, RetrieveFileTypes, SearchWebTypes, UploadBatchInputFileTypes, addSkillRevision, answerQuestions, cancelAgentResponse, cancelBatch, createAgentResponse, createAsyncChatCompletionSonar, createBatch, createChatCompletion, createContextualizedEmbeddings, createEmbeddings, createSkill, deleteFile, deleteSkill, downloadAgentResponseFile, downloadFileContent, getAsyncChatCompletionResponse, getSkill, getSkillDownloadUrl, listAsyncChatCompletionsAuthenticatedUser, listAvailableAgentApiModels, listBatches, listFilesProducedAgentResponse, listOrganizationFiles, listSkills, listSkillsRevisions, retrieveAgentResponse, retrieveBatch, retrieveFile, searchWeb, uploadBatchInputFile };
|