@perplexity-ai/perplexity_ai 0.32.0 → 0.33.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +1 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +1 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +1 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +1 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +1 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +1 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/responses/files.d.mts +26 -0
  20. package/resources/responses/files.d.mts.map +1 -0
  21. package/resources/responses/files.d.ts +26 -0
  22. package/resources/responses/files.d.ts.map +1 -0
  23. package/resources/responses/files.js +30 -0
  24. package/resources/responses/files.js.map +1 -0
  25. package/resources/responses/files.mjs +26 -0
  26. package/resources/responses/files.mjs.map +1 -0
  27. package/resources/responses/index.d.mts +3 -0
  28. package/resources/responses/index.d.mts.map +1 -0
  29. package/resources/responses/index.d.ts +3 -0
  30. package/resources/responses/index.d.ts.map +1 -0
  31. package/resources/responses/index.js +9 -0
  32. package/resources/responses/index.js.map +1 -0
  33. package/resources/responses/index.mjs +4 -0
  34. package/resources/responses/index.mjs.map +1 -0
  35. package/resources/responses/responses.d.mts +969 -0
  36. package/resources/responses/responses.d.mts.map +1 -0
  37. package/resources/responses/responses.d.ts +969 -0
  38. package/resources/responses/responses.d.ts.map +1 -0
  39. package/resources/responses/responses.js +38 -0
  40. package/resources/responses/responses.js.map +1 -0
  41. package/resources/responses/responses.mjs +33 -0
  42. package/resources/responses/responses.mjs.map +1 -0
  43. package/resources/responses.d.mts +1 -927
  44. package/resources/responses.d.mts.map +1 -1
  45. package/resources/responses.d.ts +1 -927
  46. package/resources/responses.d.ts.map +1 -1
  47. package/resources/responses.js +2 -26
  48. package/resources/responses.js.map +1 -1
  49. package/resources/responses.mjs +1 -24
  50. package/resources/responses.mjs.map +1 -1
  51. package/src/client.ts +9 -5
  52. package/src/resources/index.ts +3 -1
  53. package/src/resources/responses/files.ts +42 -0
  54. package/src/resources/responses/index.ts +23 -0
  55. package/src/resources/responses/responses.ts +1316 -0
  56. package/src/resources/responses.ts +1 -1259
  57. package/src/version.ts +1 -1
  58. package/version.d.mts +1 -1
  59. package/version.d.ts +1 -1
  60. package/version.js +1 -1
  61. package/version.mjs +1 -1
@@ -1,928 +1,2 @@
1
- import { APIResource } from "../core/resource.js";
2
- import * as ResponsesAPI from "./responses.js";
3
- import * as Shared from "./shared.js";
4
- import { APIPromise } from "../core/api-promise.js";
5
- import { Stream } from "../core/streaming.js";
6
- import { RequestOptions } from "../internal/request-options.js";
7
- export declare class Responses extends APIResource {
8
- /**
9
- * Generate a response for the provided input with optional web search and
10
- * reasoning.
11
- */
12
- create(body: ResponseCreateParamsNonStreaming, options?: RequestOptions): APIPromise<ResponseCreateResponse>;
13
- create(body: ResponseCreateParamsStreaming, options?: RequestOptions): APIPromise<Stream<ResponseStreamChunk>>;
14
- create(body: ResponseCreateParamsBase, options?: RequestOptions): APIPromise<Stream<ResponseStreamChunk> | ResponseCreateResponse>;
15
- /**
16
- * Retrieve a response by its ID. Use this to poll the status of background tasks.
17
- */
18
- retrieve(responseID: string, options?: RequestOptions): APIPromise<ResponseRetrieveResponse>;
19
- }
20
- /**
21
- * Text annotation (e.g., URL citation)
22
- */
23
- export interface Annotation {
24
- end_index?: number;
25
- start_index?: number;
26
- title?: string;
27
- type?: string;
28
- url?: string;
29
- }
30
- export interface ContentPart {
31
- text: string;
32
- /**
33
- * Type of a content part
34
- */
35
- type: 'output_text';
36
- annotations?: Array<Annotation>;
37
- }
38
- export interface ErrorInfo {
39
- message: string;
40
- code?: string;
41
- type?: string;
42
- }
43
- export interface FunctionCallOutputItem {
44
- id: string;
45
- /**
46
- * JSON string of arguments
47
- */
48
- arguments: string;
49
- /**
50
- * Correlates with function_call_output input
51
- */
52
- call_id: string;
53
- name: string;
54
- /**
55
- * Status of a response or output item
56
- */
57
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
58
- type: 'function_call';
59
- /**
60
- * Base64-encoded opaque signature for thinking models
61
- */
62
- thought_signature?: string;
63
- }
64
- export interface FunctionTool {
65
- /**
66
- * The name of the function
67
- */
68
- name: string;
69
- type: 'function';
70
- /**
71
- * A description of what the function does
72
- */
73
- description?: string;
74
- /**
75
- * JSON Schema defining the function's parameters
76
- */
77
- parameters?: {
78
- [key: string]: unknown;
79
- };
80
- /**
81
- * Whether to enable strict schema validation
82
- */
83
- strict?: boolean;
84
- }
85
- export type InputItem = InputItem.InputMessage | InputItem.FunctionCallOutputInput | InputItem.FunctionCallInput;
86
- export declare namespace InputItem {
87
- interface InputMessage {
88
- /**
89
- * Message content - either a string or array of content parts
90
- */
91
- content: string | Array<InputMessage.ContentPartArray>;
92
- role: 'user' | 'assistant' | 'system' | 'developer';
93
- type: 'message';
94
- }
95
- namespace InputMessage {
96
- interface ContentPartArray {
97
- type: 'input_text' | 'input_image';
98
- image_url?: string;
99
- text?: string;
100
- }
101
- }
102
- interface FunctionCallOutputInput {
103
- /**
104
- * The call_id from function_call output
105
- */
106
- call_id: string;
107
- /**
108
- * Function result (JSON string)
109
- */
110
- output: string;
111
- type: 'function_call_output';
112
- /**
113
- * Function name (required by some providers)
114
- */
115
- name?: string;
116
- /**
117
- * Base64-encoded signature from function_call
118
- */
119
- thought_signature?: string;
120
- }
121
- interface FunctionCallInput {
122
- /**
123
- * Function arguments (JSON string)
124
- */
125
- arguments: string;
126
- /**
127
- * The call_id that correlates with function_call_output
128
- */
129
- call_id: string;
130
- /**
131
- * The function name
132
- */
133
- name: string;
134
- type: 'function_call';
135
- /**
136
- * Base64-encoded signature for thinking models
137
- */
138
- thought_signature?: string;
139
- }
140
- }
141
- export type OutputItem = OutputItem.MessageOutputItem | OutputItem.SearchResultsOutputItem | OutputItem.FetchURLResultsOutputItem | FunctionCallOutputItem;
142
- export declare namespace OutputItem {
143
- interface MessageOutputItem {
144
- id: string;
145
- content: Array<ResponsesAPI.ContentPart>;
146
- /**
147
- * Role in a message
148
- */
149
- role: 'assistant';
150
- /**
151
- * Status of a response or output item
152
- */
153
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
154
- type: 'message';
155
- }
156
- interface SearchResultsOutputItem {
157
- results: Array<Shared.SearchResult>;
158
- type: 'search_results';
159
- queries?: Array<string>;
160
- }
161
- interface FetchURLResultsOutputItem {
162
- contents: Array<FetchURLResultsOutputItem.Content>;
163
- type: 'fetch_url_results';
164
- }
165
- namespace FetchURLResultsOutputItem {
166
- /**
167
- * Content fetched from a URL
168
- */
169
- interface Content {
170
- /**
171
- * The fetched content snippet
172
- */
173
- snippet: string;
174
- /**
175
- * The title of the page
176
- */
177
- title: string;
178
- /**
179
- * The URL from which content was fetched
180
- */
181
- url: string;
182
- }
183
- }
184
- }
185
- /**
186
- * SSE stream event. Discriminate by the `type` field:
187
- *
188
- * - `response.created`: Initial response object
189
- * - `response.in_progress`: Response processing started
190
- * - `response.completed`: Final response with output
191
- * - `response.failed`: Error occurred
192
- * - `response.output_item.added`: New output item started
193
- * - `response.output_item.done`: Output item completed
194
- * - `response.output_text.delta`: Streaming text delta
195
- * - `response.output_text.done`: Final text content
196
- * - `response.reasoning.started`: Reasoning phase started
197
- * - `response.reasoning.search_queries`: Search queries issued
198
- * - `response.reasoning.search_results`: Search results received
199
- * - `response.reasoning.fetch_url_queries`: URL fetch queries issued
200
- * - `response.reasoning.fetch_url_results`: URL fetch results received
201
- * - `response.reasoning.stopped`: Reasoning phase complete
202
- */
203
- export type ResponseStreamChunk = ResponseStreamChunk.ResponseCreatedEvent | ResponseStreamChunk.ResponseInProgressEvent | ResponseStreamChunk.ResponseCompletedEvent | ResponseStreamChunk.ResponseFailedEvent | ResponseStreamChunk.OutputItemAddedEvent | ResponseStreamChunk.OutputItemDoneEvent | ResponseStreamChunk.TextDeltaEvent | ResponseStreamChunk.TextDoneEvent | ResponseStreamChunk.ReasoningStartedEvent | ResponseStreamChunk.SearchQueriesEvent | ResponseStreamChunk.SearchResultsEvent | ResponseStreamChunk.FetchURLQueriesEvent | ResponseStreamChunk.FetchURLResultsEvent | ResponseStreamChunk.ReasoningStoppedEvent;
204
- export declare namespace ResponseStreamChunk {
205
- /**
206
- * Response created event (type: "response.created"). Contains the initial response
207
- * object.
208
- */
209
- interface ResponseCreatedEvent {
210
- /**
211
- * Monotonically increasing sequence number for event ordering
212
- */
213
- sequence_number: number;
214
- /**
215
- * SSE event type discriminator (always "response.created")
216
- */
217
- type: 'response.created';
218
- /**
219
- * Non-streaming response returned when stream is false
220
- */
221
- response?: ResponseCreatedEvent.Response;
222
- }
223
- namespace ResponseCreatedEvent {
224
- /**
225
- * Non-streaming response returned when stream is false
226
- */
227
- interface Response {
228
- id: string;
229
- created_at: number;
230
- model: string;
231
- /**
232
- * Object type in API responses
233
- */
234
- object: 'response';
235
- output: Array<ResponsesAPI.OutputItem>;
236
- /**
237
- * Status of a response or output item
238
- */
239
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
240
- /**
241
- * Whether the response was created in background mode.
242
- */
243
- background?: boolean;
244
- error?: ResponsesAPI.ErrorInfo;
245
- usage?: ResponsesAPI.ResponsesUsage;
246
- }
247
- }
248
- /**
249
- * Response in progress event (type: "response.in_progress"). Emitted when response
250
- * processing has started.
251
- */
252
- interface ResponseInProgressEvent {
253
- /**
254
- * Monotonically increasing sequence number for event ordering
255
- */
256
- sequence_number: number;
257
- /**
258
- * SSE event type discriminator (always "response.in_progress")
259
- */
260
- type: 'response.in_progress';
261
- /**
262
- * Non-streaming response returned when stream is false
263
- */
264
- response?: ResponseInProgressEvent.Response;
265
- }
266
- namespace ResponseInProgressEvent {
267
- /**
268
- * Non-streaming response returned when stream is false
269
- */
270
- interface Response {
271
- id: string;
272
- created_at: number;
273
- model: string;
274
- /**
275
- * Object type in API responses
276
- */
277
- object: 'response';
278
- output: Array<ResponsesAPI.OutputItem>;
279
- /**
280
- * Status of a response or output item
281
- */
282
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
283
- /**
284
- * Whether the response was created in background mode.
285
- */
286
- background?: boolean;
287
- error?: ResponsesAPI.ErrorInfo;
288
- usage?: ResponsesAPI.ResponsesUsage;
289
- }
290
- }
291
- /**
292
- * Response event Contains the full or partial response object.
293
- */
294
- interface ResponseCompletedEvent {
295
- /**
296
- * Monotonically increasing sequence number for event ordering
297
- */
298
- sequence_number: number;
299
- /**
300
- * SSE event type discriminator (always "response.completed")
301
- */
302
- type: 'response.completed';
303
- /**
304
- * Non-streaming response returned when stream is false
305
- */
306
- response?: ResponseCompletedEvent.Response;
307
- }
308
- namespace ResponseCompletedEvent {
309
- /**
310
- * Non-streaming response returned when stream is false
311
- */
312
- interface Response {
313
- id: string;
314
- created_at: number;
315
- model: string;
316
- /**
317
- * Object type in API responses
318
- */
319
- object: 'response';
320
- output: Array<ResponsesAPI.OutputItem>;
321
- /**
322
- * Status of a response or output item
323
- */
324
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
325
- /**
326
- * Whether the response was created in background mode.
327
- */
328
- background?: boolean;
329
- error?: ResponsesAPI.ErrorInfo;
330
- usage?: ResponsesAPI.ResponsesUsage;
331
- }
332
- }
333
- /**
334
- * Response failed event (type: "response.failed"). Contains error details when
335
- * streaming fails.
336
- */
337
- interface ResponseFailedEvent {
338
- error: ResponsesAPI.ErrorInfo;
339
- /**
340
- * Monotonically increasing sequence number for event ordering
341
- */
342
- sequence_number: number;
343
- /**
344
- * SSE event type discriminator (always "response.failed")
345
- */
346
- type: 'response.failed';
347
- }
348
- /**
349
- * Output item added event (type: "response.output_item.added"). Emitted when a new
350
- * output item (message or tool call) starts.
351
- */
352
- interface OutputItemAddedEvent {
353
- item: ResponsesAPI.OutputItem;
354
- output_index: number;
355
- /**
356
- * Monotonically increasing sequence number for event ordering
357
- */
358
- sequence_number: number;
359
- /**
360
- * SSE event type discriminator (always "response.output_item.added")
361
- */
362
- type: 'response.output_item.added';
363
- }
364
- /**
365
- * Output item done event (type: "response.output_item.done"). Emitted when an
366
- * output item (message or tool call) completes.
367
- */
368
- interface OutputItemDoneEvent {
369
- item: ResponsesAPI.OutputItem;
370
- output_index: number;
371
- /**
372
- * Monotonically increasing sequence number for event ordering
373
- */
374
- sequence_number: number;
375
- /**
376
- * SSE event type discriminator (always "response.output_item.done")
377
- */
378
- type: 'response.output_item.done';
379
- }
380
- /**
381
- * Text delta event (type: "response.output_text.delta"). Contains incremental text
382
- * content.
383
- */
384
- interface TextDeltaEvent {
385
- content_index: number;
386
- delta: string;
387
- item_id: string;
388
- output_index: number;
389
- /**
390
- * Monotonically increasing sequence number for event ordering
391
- */
392
- sequence_number: number;
393
- /**
394
- * SSE event type discriminator (always "response.output_text.delta")
395
- */
396
- type: 'response.output_text.delta';
397
- }
398
- /**
399
- * Text done event (type: "response.output_text.done"). Contains the final text
400
- * content.
401
- */
402
- interface TextDoneEvent {
403
- content_index: number;
404
- item_id: string;
405
- output_index: number;
406
- /**
407
- * Monotonically increasing sequence number for event ordering
408
- */
409
- sequence_number: number;
410
- text: string;
411
- /**
412
- * SSE event type discriminator (always "response.output_text.done")
413
- */
414
- type: 'response.output_text.done';
415
- }
416
- /**
417
- * Reasoning started event (type: "response.reasoning.started"). Signals the model
418
- * has started reasoning/searching.
419
- */
420
- interface ReasoningStartedEvent {
421
- /**
422
- * Monotonically increasing sequence number for event ordering
423
- */
424
- sequence_number: number;
425
- /**
426
- * SSE event type discriminator (always "response.reasoning.started")
427
- */
428
- type: 'response.reasoning.started';
429
- thought?: string;
430
- }
431
- /**
432
- * Search queries event (type: "response.reasoning.search_queries"). Contains
433
- * search queries being executed.
434
- */
435
- interface SearchQueriesEvent {
436
- queries: Array<string>;
437
- /**
438
- * Monotonically increasing sequence number for event ordering
439
- */
440
- sequence_number: number;
441
- /**
442
- * SSE event type discriminator (always "response.reasoning.search_queries")
443
- */
444
- type: 'response.reasoning.search_queries';
445
- thought?: string;
446
- }
447
- /**
448
- * Search results event (type: "response.reasoning.search_results"). Contains
449
- * search results returned.
450
- */
451
- interface SearchResultsEvent {
452
- results: Array<Shared.SearchResult>;
453
- /**
454
- * Monotonically increasing sequence number for event ordering
455
- */
456
- sequence_number: number;
457
- /**
458
- * SSE event type discriminator (always "response.reasoning.search_results")
459
- */
460
- type: 'response.reasoning.search_results';
461
- thought?: string;
462
- usage?: ResponsesAPI.ResponsesUsage;
463
- }
464
- /**
465
- * URL fetch queries event (type: "response.reasoning.fetch_url_queries"). Contains
466
- * URLs being fetched.
467
- */
468
- interface FetchURLQueriesEvent {
469
- /**
470
- * Monotonically increasing sequence number for event ordering
471
- */
472
- sequence_number: number;
473
- /**
474
- * SSE event type discriminator (always "response.reasoning.fetch_url_queries")
475
- */
476
- type: 'response.reasoning.fetch_url_queries';
477
- urls: Array<string>;
478
- thought?: string;
479
- }
480
- /**
481
- * URL fetch results event (type: "response.reasoning.fetch_url_results"). Contains
482
- * fetched URL contents.
483
- */
484
- interface FetchURLResultsEvent {
485
- contents: Array<FetchURLResultsEvent.Content>;
486
- /**
487
- * Monotonically increasing sequence number for event ordering
488
- */
489
- sequence_number: number;
490
- /**
491
- * SSE event type discriminator (always "response.reasoning.fetch_url_results")
492
- */
493
- type: 'response.reasoning.fetch_url_results';
494
- thought?: string;
495
- }
496
- namespace FetchURLResultsEvent {
497
- /**
498
- * Content fetched from a URL
499
- */
500
- interface Content {
501
- /**
502
- * The fetched content snippet
503
- */
504
- snippet: string;
505
- /**
506
- * The title of the page
507
- */
508
- title: string;
509
- /**
510
- * The URL from which content was fetched
511
- */
512
- url: string;
513
- }
514
- }
515
- /**
516
- * Reasoning stopped event (type: "response.reasoning.stopped"). Signals the model
517
- * has finished reasoning/searching.
518
- */
519
- interface ReasoningStoppedEvent {
520
- /**
521
- * Monotonically increasing sequence number for event ordering
522
- */
523
- sequence_number: number;
524
- /**
525
- * SSE event type discriminator (always "response.reasoning.stopped")
526
- */
527
- type: 'response.reasoning.stopped';
528
- thought?: string;
529
- }
530
- }
531
- export interface ResponsesCreateParams {
532
- /**
533
- * Input content - either a string or array of input items
534
- */
535
- input: string | Array<InputItem>;
536
- /**
537
- * Run the response asynchronously. When true, the request is queued and the
538
- * response object's `status` will be `queued` or `in_progress`. Poll GET
539
- * /v1/responses/{response_id} to retrieve the final result.
540
- */
541
- background?: boolean | null;
542
- /**
543
- * System instructions for the model
544
- */
545
- instructions?: string;
546
- /**
547
- * ISO 639-1 language code for response language
548
- */
549
- language_preference?: string;
550
- /**
551
- * Maximum tokens to generate
552
- */
553
- max_output_tokens?: number;
554
- /**
555
- * Maximum number of research loop steps. If provided, overrides the preset's
556
- * max_steps value. Must be >= 1 if specified. Maximum allowed is 10.
557
- */
558
- max_steps?: number;
559
- /**
560
- * Model ID in provider/model format (e.g., "xai/grok-4-1", "openai/gpt-4o"). If
561
- * models is also provided, models takes precedence. Required if neither models nor
562
- * preset is provided.
563
- */
564
- model?: string;
565
- /**
566
- * Model fallback chain. Each model is in provider/model format. Models are tried
567
- * in order until one succeeds. Max 5 models allowed. If set, takes precedence over
568
- * single model field. The response.model will reflect the model that actually
569
- * succeeded.
570
- */
571
- models?: Array<string>;
572
- /**
573
- * Preset configuration name (e.g., "sonar-pro", "sonar-reasoning"). Pre-configured
574
- * model with system prompt and search parameters. Required if model is not
575
- * provided.
576
- */
577
- preset?: string;
578
- reasoning?: ResponsesCreateParams.Reasoning;
579
- /**
580
- * Specifies the desired output format for the model response
581
- */
582
- response_format?: Shared.ResponseFormat;
583
- /**
584
- * If true, returns SSE stream instead of JSON
585
- */
586
- stream?: boolean;
587
- /**
588
- * Tools available to the model
589
- */
590
- tools?: Array<ResponsesCreateParams.WebSearchTool | ResponsesCreateParams.FetchURLTool | ResponsesCreateParams.PeopleSearchTool | FunctionTool | ResponsesCreateParams.FinanceSearchTool | ResponsesCreateParams.SandboxTool>;
591
- }
592
- export declare namespace ResponsesCreateParams {
593
- interface Reasoning {
594
- /**
595
- * How much effort the model should spend on reasoning
596
- */
597
- effort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
598
- }
599
- interface WebSearchTool {
600
- type: 'web_search';
601
- filters?: WebSearchTool.Filters;
602
- max_tokens?: number;
603
- max_tokens_per_page?: number;
604
- /**
605
- * Search context size (low, medium, high). Omit when supplying explicit max_tokens
606
- * / max_tokens_per_page.
607
- */
608
- search_context_size?: 'low' | 'medium' | 'high';
609
- /**
610
- * User's geographic location for search personalization
611
- */
612
- user_location?: WebSearchTool.UserLocation;
613
- }
614
- namespace WebSearchTool {
615
- interface Filters {
616
- /**
617
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
618
- */
619
- last_updated_after_filter?: string;
620
- /**
621
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
622
- */
623
- last_updated_before_filter?: string;
624
- /**
625
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
626
- */
627
- search_after_date_filter?: string;
628
- /**
629
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
630
- */
631
- search_before_date_filter?: string;
632
- search_domain_filter?: Array<string>;
633
- search_recency_filter?: 'hour' | 'day' | 'week' | 'month' | 'year';
634
- }
635
- /**
636
- * User's geographic location for search personalization
637
- */
638
- interface UserLocation {
639
- city?: string;
640
- /**
641
- * ISO 3166-1 alpha-2 country code
642
- */
643
- country?: string;
644
- latitude?: number;
645
- longitude?: number;
646
- region?: string;
647
- }
648
- }
649
- interface FetchURLTool {
650
- type: 'fetch_url';
651
- /**
652
- * Maximum number of URLs to fetch per tool call
653
- */
654
- max_urls?: number;
655
- }
656
- interface PeopleSearchTool {
657
- /**
658
- * Enables the `people_search` tool.
659
- */
660
- type: 'people_search';
661
- }
662
- interface FinanceSearchTool {
663
- /**
664
- * Enables the `finance_search` tool. The model can request structured financial
665
- * data (quotes, financials, segments, earnings transcripts, etc.) via
666
- * category-based fan-out to FMP, Finchat, and Quartr.
667
- */
668
- type: 'finance_search';
669
- }
670
- interface SandboxTool {
671
- /**
672
- * Enables the `sandbox` tool. The model can execute code in an isolated container
673
- * during the request and use the result in its final answer.
674
- */
675
- type: 'sandbox';
676
- }
677
- }
678
- export interface ResponsesUsage {
679
- input_tokens: number;
680
- output_tokens: number;
681
- total_tokens: number;
682
- cost?: ResponsesUsage.Cost;
683
- input_tokens_details?: ResponsesUsage.InputTokensDetails;
684
- tool_calls_details?: {
685
- [key: string]: ResponsesUsage.ToolCallsDetails;
686
- };
687
- }
688
- export declare namespace ResponsesUsage {
689
- interface Cost {
690
- /**
691
- * Currency code for cost values
692
- */
693
- currency: 'USD';
694
- input_cost: number;
695
- output_cost: number;
696
- total_cost: number;
697
- cache_creation_cost?: number;
698
- cache_read_cost?: number;
699
- tool_calls_cost?: number;
700
- }
701
- interface InputTokensDetails {
702
- cache_creation_input_tokens?: number;
703
- cache_read_input_tokens?: number;
704
- }
705
- interface ToolCallsDetails {
706
- /**
707
- * Number of times this tool was invoked
708
- */
709
- invocation?: number;
710
- }
711
- }
712
- /**
713
- * Non-streaming response returned when stream is false
714
- */
715
- export interface ResponseCreateResponse {
716
- id: string;
717
- created_at: number;
718
- model: string;
719
- /**
720
- * Object type in API responses
721
- */
722
- object: 'response';
723
- output: Array<OutputItem>;
724
- /**
725
- * Status of a response or output item
726
- */
727
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
728
- /**
729
- * Whether the response was created in background mode.
730
- */
731
- background?: boolean;
732
- error?: ErrorInfo;
733
- usage?: ResponsesUsage;
734
- }
735
- /**
736
- * Non-streaming response returned when stream is false
737
- */
738
- export interface ResponseRetrieveResponse {
739
- id: string;
740
- created_at: number;
741
- model: string;
742
- /**
743
- * Object type in API responses
744
- */
745
- object: 'response';
746
- output: Array<OutputItem>;
747
- /**
748
- * Status of a response or output item
749
- */
750
- status: 'completed' | 'failed' | 'in_progress' | 'queued' | 'cancelled' | 'requires_action';
751
- /**
752
- * Whether the response was created in background mode.
753
- */
754
- background?: boolean;
755
- error?: ErrorInfo;
756
- usage?: ResponsesUsage;
757
- /**
758
- * Convenience property that aggregates all `output_text` items from the `output` list.
759
- * If no `output_text` content blocks exist, then an empty string is returned.
760
- */
761
- output_text?: string;
762
- }
763
- export type ResponseCreateParams = ResponseCreateParamsNonStreaming | ResponseCreateParamsStreaming;
764
- export interface ResponseCreateParamsBase {
765
- /**
766
- * Input content - either a string or array of input items
767
- */
768
- input: string | Array<InputItem>;
769
- /**
770
- * Run the response asynchronously. When true, the request is queued and the
771
- * response object's `status` will be `queued` or `in_progress`. Poll GET
772
- * /v1/responses/{response_id} to retrieve the final result.
773
- */
774
- background?: boolean | null;
775
- /**
776
- * System instructions for the model
777
- */
778
- instructions?: string;
779
- /**
780
- * ISO 639-1 language code for response language
781
- */
782
- language_preference?: string;
783
- /**
784
- * Maximum tokens to generate
785
- */
786
- max_output_tokens?: number;
787
- /**
788
- * Maximum number of research loop steps. If provided, overrides the preset's
789
- * max_steps value. Must be >= 1 if specified. Maximum allowed is 10.
790
- */
791
- max_steps?: number;
792
- /**
793
- * Model ID in provider/model format (e.g., "xai/grok-4-1", "openai/gpt-4o"). If
794
- * models is also provided, models takes precedence. Required if neither models nor
795
- * preset is provided.
796
- */
797
- model?: string;
798
- /**
799
- * Model fallback chain. Each model is in provider/model format. Models are tried
800
- * in order until one succeeds. Max 5 models allowed. If set, takes precedence over
801
- * single model field. The response.model will reflect the model that actually
802
- * succeeded.
803
- */
804
- models?: Array<string>;
805
- /**
806
- * Preset configuration name (e.g., "sonar-pro", "sonar-reasoning"). Pre-configured
807
- * model with system prompt and search parameters. Required if model is not
808
- * provided.
809
- */
810
- preset?: string;
811
- reasoning?: ResponseCreateParams.Reasoning;
812
- /**
813
- * Specifies the desired output format for the model response
814
- */
815
- response_format?: Shared.ResponseFormat;
816
- /**
817
- * If true, returns SSE stream instead of JSON
818
- */
819
- stream?: boolean;
820
- /**
821
- * Tools available to the model
822
- */
823
- tools?: Array<ResponseCreateParams.WebSearchTool | ResponseCreateParams.FetchURLTool | ResponseCreateParams.PeopleSearchTool | FunctionTool | ResponseCreateParams.FinanceSearchTool | ResponseCreateParams.SandboxTool>;
824
- }
825
- export declare namespace ResponseCreateParams {
826
- interface Reasoning {
827
- /**
828
- * How much effort the model should spend on reasoning
829
- */
830
- effort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
831
- }
832
- interface WebSearchTool {
833
- type: 'web_search';
834
- filters?: WebSearchTool.Filters;
835
- max_tokens?: number;
836
- max_tokens_per_page?: number;
837
- /**
838
- * Search context size (low, medium, high). Omit when supplying explicit max_tokens
839
- * / max_tokens_per_page.
840
- */
841
- search_context_size?: 'low' | 'medium' | 'high';
842
- /**
843
- * User's geographic location for search personalization
844
- */
845
- user_location?: WebSearchTool.UserLocation;
846
- }
847
- namespace WebSearchTool {
848
- interface Filters {
849
- /**
850
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
851
- */
852
- last_updated_after_filter?: string;
853
- /**
854
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
855
- */
856
- last_updated_before_filter?: string;
857
- /**
858
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
859
- */
860
- search_after_date_filter?: string;
861
- /**
862
- * Input: MM/DD/YYYY, Output: YYYY-MM-DD
863
- */
864
- search_before_date_filter?: string;
865
- search_domain_filter?: Array<string>;
866
- search_recency_filter?: 'hour' | 'day' | 'week' | 'month' | 'year';
867
- }
868
- /**
869
- * User's geographic location for search personalization
870
- */
871
- interface UserLocation {
872
- city?: string;
873
- /**
874
- * ISO 3166-1 alpha-2 country code
875
- */
876
- country?: string;
877
- latitude?: number;
878
- longitude?: number;
879
- region?: string;
880
- }
881
- }
882
- interface FetchURLTool {
883
- type: 'fetch_url';
884
- /**
885
- * Maximum number of URLs to fetch per tool call
886
- */
887
- max_urls?: number;
888
- }
889
- interface PeopleSearchTool {
890
- /**
891
- * Enables the `people_search` tool.
892
- */
893
- type: 'people_search';
894
- }
895
- interface FinanceSearchTool {
896
- /**
897
- * Enables the `finance_search` tool. The model can request structured financial
898
- * data (quotes, financials, segments, earnings transcripts, etc.) via
899
- * category-based fan-out to FMP, Finchat, and Quartr.
900
- */
901
- type: 'finance_search';
902
- }
903
- interface SandboxTool {
904
- /**
905
- * Enables the `sandbox` tool. The model can execute code in an isolated container
906
- * during the request and use the result in its final answer.
907
- */
908
- type: 'sandbox';
909
- }
910
- type ResponseCreateParamsNonStreaming = ResponsesAPI.ResponseCreateParamsNonStreaming;
911
- type ResponseCreateParamsStreaming = ResponsesAPI.ResponseCreateParamsStreaming;
912
- }
913
- export interface ResponseCreateParamsNonStreaming extends ResponseCreateParamsBase {
914
- /**
915
- * If true, returns SSE stream instead of JSON
916
- */
917
- stream?: false;
918
- }
919
- export interface ResponseCreateParamsStreaming extends ResponseCreateParamsBase {
920
- /**
921
- * If true, returns SSE stream instead of JSON
922
- */
923
- stream: true;
924
- }
925
- export declare namespace Responses {
926
- export { type Annotation as Annotation, type ContentPart as ContentPart, type ErrorInfo as ErrorInfo, type FunctionCallOutputItem as FunctionCallOutputItem, type FunctionTool as FunctionTool, type InputItem as InputItem, type OutputItem as OutputItem, type ResponseStreamChunk as ResponseStreamChunk, type ResponsesCreateParams as ResponsesCreateParams, type ResponsesUsage as ResponsesUsage, type ResponseCreateResponse as ResponseCreateResponse, type ResponseRetrieveResponse as ResponseRetrieveResponse, type ResponseCreateParams as ResponseCreateParams, type ResponseCreateParamsNonStreaming as ResponseCreateParamsNonStreaming, type ResponseCreateParamsStreaming as ResponseCreateParamsStreaming, };
927
- }
1
+ export * from "./responses/index.js";
928
2
  //# sourceMappingURL=responses.d.ts.map