exa-js 1.5.12 → 1.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,1384 @@
1
+ /**
2
+ * Base client for Websets API
3
+ */
4
+
5
+ /**
6
+ * Type for API query parameters
7
+ */
8
+ type QueryParams = Record<string, string | number | boolean | string[] | undefined>;
9
+ /**
10
+ * Type for API request body
11
+ */
12
+ interface RequestBody {
13
+ [key: string]: unknown;
14
+ }
15
+ /**
16
+ * Common pagination parameters
17
+ */
18
+ interface PaginationParams {
19
+ /**
20
+ * Cursor for pagination
21
+ */
22
+ cursor?: string;
23
+ /**
24
+ * Maximum number of items per page
25
+ */
26
+ limit?: number;
27
+ }
28
+ /**
29
+ * Base client class for all Websets-related API clients
30
+ */
31
+ declare class WebsetsBaseClient {
32
+ protected client: Exa;
33
+ /**
34
+ * Initialize a new Websets base client
35
+ * @param client The Exa client instance
36
+ */
37
+ constructor(client: Exa);
38
+ /**
39
+ * Make a request to the Websets API
40
+ * @param endpoint The endpoint path
41
+ * @param method The HTTP method
42
+ * @param data Optional request body data
43
+ * @param params Optional query parameters
44
+ * @returns The response JSON
45
+ * @throws ExaError with API error details if the request fails
46
+ */
47
+ protected request<T = unknown>(endpoint: string, method?: string, data?: RequestBody, params?: QueryParams): Promise<T>;
48
+ /**
49
+ * Helper to build pagination parameters
50
+ * @param pagination The pagination parameters
51
+ * @returns QueryParams object with pagination parameters
52
+ */
53
+ protected buildPaginationParams(pagination?: PaginationParams): QueryParams;
54
+ }
55
+
56
+ interface components {
57
+ schemas: {
58
+ CreateCriterionParameters: {
59
+ /** @description The description of the criterion */
60
+ description: string;
61
+ };
62
+ CreateEnrichmentParameters: {
63
+ /** @description Provide a description of the enrichment task you want to perform to each Webset Item. */
64
+ description: string;
65
+ /**
66
+ * @description Format of the enrichment response.
67
+ *
68
+ * We automatically select the best format based on the description. If you want to explicitly specify the format, you can do so here.
69
+ * @enum {string}
70
+ */
71
+ format?: CreateEnrichmentParametersFormat;
72
+ /** @description Set of key-value pairs you want to associate with this object. */
73
+ metadata?: {
74
+ [key: string]: string;
75
+ };
76
+ /** @description When the format is options, the different options for the enrichment agent to choose from. */
77
+ options?: {
78
+ /** @description The label of the option */
79
+ label: string;
80
+ }[];
81
+ };
82
+ CreateWebhookParameters: {
83
+ /** @description The events to trigger the webhook */
84
+ events: components["schemas"]["EventType"][];
85
+ /** @description Set of key-value pairs you want to associate with this object. */
86
+ metadata?: {
87
+ [key: string]: string;
88
+ };
89
+ /**
90
+ * Format: uri
91
+ * @description The URL to send the webhook to
92
+ */
93
+ url: string;
94
+ };
95
+ CreateWebsetParameters: {
96
+ /** @description Add Enrichments for the Webset. */
97
+ enrichments?: components["schemas"]["CreateEnrichmentParameters"][];
98
+ /** @description The external identifier for the webset.
99
+ *
100
+ * You can use this to reference the Webset by your own internal identifiers. */
101
+ externalId?: string;
102
+ /** @description Set of key-value pairs you want to associate with this object. */
103
+ metadata?: {
104
+ [key: string]: string;
105
+ };
106
+ /** @description Create initial search for the Webset. */
107
+ search: {
108
+ /**
109
+ * @description Number of Items the Webset will attempt to find.
110
+ *
111
+ * The actual number of Items found may be less than this number depending on the search complexity.
112
+ * @default 10
113
+ */
114
+ count: number;
115
+ /** @description Criteria every item is evaluated against.
116
+ *
117
+ * It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query. Only use this when you need more fine control. */
118
+ criteria?: components["schemas"]["CreateCriterionParameters"][];
119
+ /** @description Entity the Webset will return results for.
120
+ *
121
+ * It is not required to provide it, we automatically detect the entity from all the information provided in the query. Only use this when you need more fine control. */
122
+ entity?: components["schemas"]["WebsetEntity"];
123
+ /** @description Your search query.
124
+ *
125
+ * Use this to describe what you are looking for.
126
+ *
127
+ * Any URL provided will be crawled and used as context for the search. */
128
+ query: string;
129
+ };
130
+ };
131
+ CreateWebsetSearchParameters: {
132
+ /**
133
+ * WebsetSearchBehaviour
134
+ * @description The behaviour of the Search when it is added to a Webset.
135
+ *
136
+ * - `override`: the search will reuse the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.
137
+ * @default override
138
+ * @enum {string}
139
+ */
140
+ behaviour: CreateWebsetSearchParametersBehaviour;
141
+ /** @description Number of Items the Search will attempt to find.
142
+ *
143
+ * The actual number of Items found may be less than this number depending on the query complexity. */
144
+ count: number;
145
+ /** @description Criteria every item is evaluated against.
146
+ *
147
+ * It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query. */
148
+ criteria?: components["schemas"]["CreateCriterionParameters"][];
149
+ /** @description Entity the Webset will return results for.
150
+ *
151
+ * It is not required to provide it, we automatically detect the entity from all the information provided in the query. */
152
+ entity?: components["schemas"]["WebsetEntity"];
153
+ /** @description Set of key-value pairs you want to associate with this object. */
154
+ metadata?: {
155
+ [key: string]: string;
156
+ };
157
+ /** @description Query describing what you are looking for.
158
+ *
159
+ * Any URL provided will be crawled and used as context for the search. */
160
+ query: string;
161
+ };
162
+ EnrichmentResult: {
163
+ /** @description The id of the Enrichment that generated the result */
164
+ enrichmentId: string;
165
+ format: components["schemas"]["WebsetEnrichmentFormat"];
166
+ /**
167
+ * @default enrichment_result
168
+ * @constant
169
+ */
170
+ object: "enrichment_result";
171
+ /** @description The reasoning for the result when an Agent is used. */
172
+ reasoning: string | null;
173
+ /** @description The references used to generate the result. */
174
+ references: {
175
+ /** @description The relevant snippet of the reference content */
176
+ snippet: string | null;
177
+ /** @description The title of the reference */
178
+ title: string | null;
179
+ /** @description The URL of the reference */
180
+ url: string;
181
+ }[];
182
+ /** @description The result of the enrichment. */
183
+ result: string[] | null;
184
+ };
185
+ /** Event */
186
+ Event: {
187
+ /**
188
+ * Format: date-time
189
+ * @description The date and time the event was created
190
+ */
191
+ createdAt: string;
192
+ data: components["schemas"]["Webset"];
193
+ /** @description The unique identifier for the event */
194
+ id: string;
195
+ /**
196
+ * @default event
197
+ * @constant
198
+ */
199
+ object: "event";
200
+ /**
201
+ * @default webset.created
202
+ * @constant
203
+ */
204
+ type: "webset.created";
205
+ } | {
206
+ /**
207
+ * Format: date-time
208
+ * @description The date and time the event was created
209
+ */
210
+ createdAt: string;
211
+ data: components["schemas"]["Webset"];
212
+ /** @description The unique identifier for the event */
213
+ id: string;
214
+ /**
215
+ * @default event
216
+ * @constant
217
+ */
218
+ object: "event";
219
+ /**
220
+ * @default webset.deleted
221
+ * @constant
222
+ */
223
+ type: "webset.deleted";
224
+ } | {
225
+ /**
226
+ * Format: date-time
227
+ * @description The date and time the event was created
228
+ */
229
+ createdAt: string;
230
+ data: components["schemas"]["Webset"];
231
+ /** @description The unique identifier for the event */
232
+ id: string;
233
+ /**
234
+ * @default event
235
+ * @constant
236
+ */
237
+ object: "event";
238
+ /**
239
+ * @default webset.idle
240
+ * @constant
241
+ */
242
+ type: "webset.idle";
243
+ } | {
244
+ /**
245
+ * Format: date-time
246
+ * @description The date and time the event was created
247
+ */
248
+ createdAt: string;
249
+ data: components["schemas"]["Webset"];
250
+ /** @description The unique identifier for the event */
251
+ id: string;
252
+ /**
253
+ * @default event
254
+ * @constant
255
+ */
256
+ object: "event";
257
+ /**
258
+ * @default webset.paused
259
+ * @constant
260
+ */
261
+ type: "webset.paused";
262
+ } | {
263
+ /**
264
+ * Format: date-time
265
+ * @description The date and time the event was created
266
+ */
267
+ createdAt: string;
268
+ data: components["schemas"]["WebsetItem"];
269
+ /** @description The unique identifier for the event */
270
+ id: string;
271
+ /**
272
+ * @default event
273
+ * @constant
274
+ */
275
+ object: "event";
276
+ /**
277
+ * @default webset.item.created
278
+ * @constant
279
+ */
280
+ type: "webset.item.created";
281
+ } | {
282
+ /**
283
+ * Format: date-time
284
+ * @description The date and time the event was created
285
+ */
286
+ createdAt: string;
287
+ data: components["schemas"]["WebsetItem"];
288
+ /** @description The unique identifier for the event */
289
+ id: string;
290
+ /**
291
+ * @default event
292
+ * @constant
293
+ */
294
+ object: "event";
295
+ /**
296
+ * @default webset.item.enriched
297
+ * @constant
298
+ */
299
+ type: "webset.item.enriched";
300
+ } | {
301
+ /**
302
+ * Format: date-time
303
+ * @description The date and time the event was created
304
+ */
305
+ createdAt: string;
306
+ data: components["schemas"]["WebsetSearch"];
307
+ /** @description The unique identifier for the event */
308
+ id: string;
309
+ /**
310
+ * @default event
311
+ * @constant
312
+ */
313
+ object: "event";
314
+ /**
315
+ * @default webset.search.created
316
+ * @constant
317
+ */
318
+ type: "webset.search.created";
319
+ } | {
320
+ /**
321
+ * Format: date-time
322
+ * @description The date and time the event was created
323
+ */
324
+ createdAt: string;
325
+ data: components["schemas"]["WebsetSearch"];
326
+ /** @description The unique identifier for the event */
327
+ id: string;
328
+ /**
329
+ * @default event
330
+ * @constant
331
+ */
332
+ object: "event";
333
+ /**
334
+ * @default webset.search.updated
335
+ * @constant
336
+ */
337
+ type: "webset.search.updated";
338
+ } | {
339
+ /**
340
+ * Format: date-time
341
+ * @description The date and time the event was created
342
+ */
343
+ createdAt: string;
344
+ data: components["schemas"]["WebsetSearch"];
345
+ /** @description The unique identifier for the event */
346
+ id: string;
347
+ /**
348
+ * @default event
349
+ * @constant
350
+ */
351
+ object: "event";
352
+ /**
353
+ * @default webset.search.canceled
354
+ * @constant
355
+ */
356
+ type: "webset.search.canceled";
357
+ } | {
358
+ /**
359
+ * Format: date-time
360
+ * @description The date and time the event was created
361
+ */
362
+ createdAt: string;
363
+ data: components["schemas"]["WebsetSearch"];
364
+ /** @description The unique identifier for the event */
365
+ id: string;
366
+ /**
367
+ * @default event
368
+ * @constant
369
+ */
370
+ object: "event";
371
+ /**
372
+ * @default webset.search.completed
373
+ * @constant
374
+ */
375
+ type: "webset.search.completed";
376
+ };
377
+ /** @enum {string} */
378
+ EventType: EventType;
379
+ GetWebsetResponse: components["schemas"]["Webset"] & {
380
+ /** @description When expand query parameter contains `items`, this will contain the items in the webset */
381
+ items?: components["schemas"]["WebsetItem"][];
382
+ };
383
+ ListEventsResponse: {
384
+ /** @description The list of events */
385
+ data: components["schemas"]["Event"][];
386
+ /** @description Whether there are more results to paginate through */
387
+ hasMore: boolean;
388
+ /** @description The cursor to paginate through the next set of results */
389
+ nextCursor: string | null;
390
+ };
391
+ ListWebhookAttemptsResponse: {
392
+ /** @description The list of webhook attempts */
393
+ data: components["schemas"]["WebhookAttempt"][];
394
+ /** @description Whether there are more results to paginate through */
395
+ hasMore: boolean;
396
+ /** @description The cursor to paginate through the next set of results */
397
+ nextCursor: string | null;
398
+ };
399
+ ListWebhooksResponse: {
400
+ /** @description The list of webhooks */
401
+ data: components["schemas"]["Webhook"][];
402
+ /** @description Whether there are more results to paginate through */
403
+ hasMore: boolean;
404
+ /** @description The cursor to paginate through the next set of results */
405
+ nextCursor: string | null;
406
+ };
407
+ ListWebsetItemResponse: {
408
+ /** @description The list of webset items */
409
+ data: components["schemas"]["WebsetItem"][];
410
+ /** @description Whether there are more Items to paginate through */
411
+ hasMore: boolean;
412
+ /** @description The cursor to paginate through the next set of Items */
413
+ nextCursor: string | null;
414
+ };
415
+ ListWebsetsResponse: {
416
+ /** @description The list of websets */
417
+ data: components["schemas"]["Webset"][];
418
+ /** @description Whether there are more results to paginate through */
419
+ hasMore: boolean;
420
+ /** @description The cursor to paginate through the next set of results */
421
+ nextCursor: string | null;
422
+ };
423
+ UpdateWebhookParameters: {
424
+ /** @description The events to trigger the webhook */
425
+ events?: components["schemas"]["EventType"][];
426
+ /** @description Set of key-value pairs you want to associate with this object. */
427
+ metadata?: {
428
+ [key: string]: string;
429
+ };
430
+ /**
431
+ * Format: uri
432
+ * @description The URL to send the webhook to
433
+ */
434
+ url?: string;
435
+ };
436
+ UpdateWebsetRequest: {
437
+ /** @description Set of key-value pairs you want to associate with this object. */
438
+ metadata?: {
439
+ [key: string]: string;
440
+ } | null;
441
+ };
442
+ Webhook: {
443
+ /**
444
+ * Format: date-time
445
+ * @description The date and time the webhook was created
446
+ */
447
+ createdAt: string;
448
+ /** @description The events to trigger the webhook */
449
+ events: components["schemas"]["EventType"][];
450
+ /** @description The unique identifier for the webhook */
451
+ id: string;
452
+ /**
453
+ * @description The metadata of the webhook
454
+ * @default {}
455
+ */
456
+ metadata: {
457
+ [key: string]: string;
458
+ };
459
+ /**
460
+ * @default webhook
461
+ * @constant
462
+ */
463
+ object: "webhook";
464
+ /** @description The secret to verify the webhook signature. Only returned on Webhook creation. */
465
+ secret: string | null;
466
+ /**
467
+ * WebhookStatus
468
+ * @description The status of the webhook
469
+ * @enum {string}
470
+ */
471
+ status: WebhookStatus;
472
+ /**
473
+ * Format: date-time
474
+ * @description The date and time the webhook was last updated
475
+ */
476
+ updatedAt: string;
477
+ /**
478
+ * Format: uri
479
+ * @description The URL to send the webhook to
480
+ */
481
+ url: string;
482
+ };
483
+ WebhookAttempt: {
484
+ /** @description The attempt number of the webhook */
485
+ attempt: number;
486
+ /**
487
+ * Format: date-time
488
+ * @description The date and time the webhook attempt was made
489
+ */
490
+ attemptedAt: string;
491
+ /** @description The unique identifier for the event */
492
+ eventId: string;
493
+ /**
494
+ * @description The type of event
495
+ * @enum {string}
496
+ */
497
+ eventType: EventType;
498
+ /** @description The unique identifier for the webhook attempt */
499
+ id: string;
500
+ /**
501
+ * @default webhook_attempt
502
+ * @constant
503
+ */
504
+ object: "webhook_attempt";
505
+ /** @description The body of the response */
506
+ responseBody: string | null;
507
+ /** @description The headers of the response */
508
+ responseHeaders: {
509
+ [key: string]: string;
510
+ };
511
+ /** @description The status code of the response */
512
+ responseStatusCode: number;
513
+ /** @description Whether the attempt was successful */
514
+ successful: boolean;
515
+ /** @description The URL that was used during the attempt */
516
+ url: string;
517
+ /** @description The unique identifier for the webhook */
518
+ webhookId: string;
519
+ };
520
+ Webset: {
521
+ /**
522
+ * Format: date-time
523
+ * @description The date and time the webset was created
524
+ */
525
+ createdAt: string;
526
+ /** @description The Enrichments to apply to the Webset Items. */
527
+ enrichments: components["schemas"]["WebsetEnrichment"][];
528
+ /** @description The external identifier for the webset */
529
+ externalId: string | null;
530
+ /** @description The unique identifier for the webset */
531
+ id: string;
532
+ /**
533
+ * @description Set of key-value pairs you want to associate with this object.
534
+ * @default {}
535
+ */
536
+ metadata: {
537
+ [key: string]: string;
538
+ };
539
+ /**
540
+ * @default webset
541
+ * @constant
542
+ */
543
+ object: "webset";
544
+ /** @description The searches that have been performed on the webset. */
545
+ searches: components["schemas"]["WebsetSearch"][];
546
+ /**
547
+ * WebsetStatus
548
+ * @description The status of the webset
549
+ * @enum {string}
550
+ */
551
+ status: WebsetStatus;
552
+ /**
553
+ * Format: date-time
554
+ * @description The date and time the webset was updated
555
+ */
556
+ updatedAt: string;
557
+ };
558
+ WebsetArticleEntity: {
559
+ /**
560
+ * @default article
561
+ * @constant
562
+ */
563
+ type: "article";
564
+ };
565
+ WebsetCompanyEntity: {
566
+ /**
567
+ * @default company
568
+ * @constant
569
+ */
570
+ type: "company";
571
+ };
572
+ WebsetCustomEntity: {
573
+ /** @description When you decide to use a custom entity, this is the description of the entity.
574
+ *
575
+ * The entity represents what type of results the Webset will return. For example, if you want results to be Job Postings, you might use "Job Postings" as the entity description. */
576
+ description: string;
577
+ /**
578
+ * @default custom
579
+ * @constant
580
+ */
581
+ type: "custom";
582
+ };
583
+ WebsetEnrichment: {
584
+ /**
585
+ * Format: date-time
586
+ * @description The date and time the enrichment was created
587
+ */
588
+ createdAt: string;
589
+ /** @description The description of the enrichment task provided during the creation of the enrichment. */
590
+ description: string;
591
+ /** @description The format of the enrichment response. */
592
+ format: components["schemas"]["WebsetEnrichmentFormat"];
593
+ /** @description The unique identifier for the enrichment */
594
+ id: string;
595
+ /** @description The instructions for the enrichment Agent.
596
+ *
597
+ * This will be automatically generated based on the description and format. */
598
+ instructions: string | null;
599
+ /**
600
+ * @description The metadata of the enrichment
601
+ * @default {}
602
+ */
603
+ metadata: {
604
+ [key: string]: string;
605
+ };
606
+ /**
607
+ * @default webset_enrichment
608
+ * @constant
609
+ */
610
+ object: "webset_enrichment";
611
+ /**
612
+ * WebsetEnrichmentOptions
613
+ * @description When the format is options, the different options for the enrichment agent to choose from.
614
+ */
615
+ options: {
616
+ /** @description The label of the option */
617
+ label: string;
618
+ }[] | null;
619
+ /**
620
+ * WebsetEnrichmentStatus
621
+ * @description The status of the enrichment
622
+ * @enum {string}
623
+ */
624
+ status: WebsetEnrichmentStatus;
625
+ /** @description The title of the enrichment.
626
+ *
627
+ * This will be automatically generated based on the description and format. */
628
+ title: string | null;
629
+ /**
630
+ * Format: date-time
631
+ * @description The date and time the enrichment was updated
632
+ */
633
+ updatedAt: string;
634
+ /** @description The unique identifier for the Webset this enrichment belongs to. */
635
+ websetId: string;
636
+ };
637
+ /** @enum {string} */
638
+ WebsetEnrichmentFormat: WebsetEnrichmentFormat;
639
+ WebsetEntity: components["schemas"]["WebsetCompanyEntity"] | components["schemas"]["WebsetPersonEntity"] | components["schemas"]["WebsetArticleEntity"] | components["schemas"]["WebsetResearchPaperEntity"] | components["schemas"]["WebsetCustomEntity"];
640
+ WebsetItem: {
641
+ /**
642
+ * Format: date-time
643
+ * @description The date and time the item was created
644
+ */
645
+ createdAt: string;
646
+ /** @description The enrichments results of the Webset item */
647
+ enrichments: components["schemas"]["EnrichmentResult"][] | null;
648
+ /** @description The criteria evaluations of the item */
649
+ evaluations: components["schemas"]["WebsetItemEvaluation"][];
650
+ /** @description The unique identifier for the Webset Item */
651
+ id: string;
652
+ /**
653
+ * @default webset_item
654
+ * @constant
655
+ */
656
+ object: "webset_item";
657
+ /** @description The properties of the Item */
658
+ properties: components["schemas"]["WebsetItemPersonProperties"] | components["schemas"]["WebsetItemCompanyProperties"] | components["schemas"]["WebsetItemArticleProperties"] | components["schemas"]["WebsetItemResearchPaperProperties"] | components["schemas"]["WebsetItemCustomProperties"];
659
+ /**
660
+ * @description The source of the Item
661
+ * @enum {string}
662
+ */
663
+ source: WebsetItemSource;
664
+ /** @description The unique identifier for the source */
665
+ sourceId: string;
666
+ /**
667
+ * Format: date-time
668
+ * @description The date and time the item was last updated
669
+ */
670
+ updatedAt: string;
671
+ /** @description The unique identifier for the Webset this Item belongs to. */
672
+ websetId: string;
673
+ };
674
+ WebsetItemArticleProperties: {
675
+ /** WebsetItemArticlePropertiesFields */
676
+ article: {
677
+ /** @description The author(s) of the article */
678
+ author: string | null;
679
+ /** @description The date and time the article was published */
680
+ publishedAt: string | null;
681
+ };
682
+ /** @description The text content for the article */
683
+ content: string | null;
684
+ /** @description Short description of the relevance of the article */
685
+ description: string;
686
+ /**
687
+ * @default article
688
+ * @constant
689
+ */
690
+ type: "article";
691
+ /**
692
+ * Format: uri
693
+ * @description The URL of the article
694
+ */
695
+ url: string;
696
+ };
697
+ WebsetItemCompanyProperties: {
698
+ /** WebsetItemCompanyPropertiesFields */
699
+ company: {
700
+ /** @description A short description of the company */
701
+ about: string | null;
702
+ /** @description The number of employees of the company */
703
+ employees: number | null;
704
+ /** @description The industry of the company */
705
+ industry: string | null;
706
+ /** @description The main location of the company */
707
+ location: string | null;
708
+ /**
709
+ * Format: uri
710
+ * @description The logo URL of the company
711
+ */
712
+ logoUrl: string | null;
713
+ /** @description The name of the company */
714
+ name: string;
715
+ };
716
+ /** @description The text content of the company website */
717
+ content: string | null;
718
+ /** @description Short description of the relevance of the company */
719
+ description: string;
720
+ /**
721
+ * @default company
722
+ * @constant
723
+ */
724
+ type: "company";
725
+ /**
726
+ * Format: uri
727
+ * @description The URL of the company website
728
+ */
729
+ url: string;
730
+ };
731
+ WebsetItemCustomProperties: {
732
+ /** @description The text content of the Item */
733
+ content: string | null;
734
+ /** WebsetItemCustomPropertiesFields */
735
+ custom: {
736
+ /** @description The author(s) of the website */
737
+ author: string | null;
738
+ /** @description The date and time the website was published */
739
+ publishedAt: string | null;
740
+ };
741
+ /** @description Short description of the Item */
742
+ description: string;
743
+ /**
744
+ * @default custom
745
+ * @constant
746
+ */
747
+ type: "custom";
748
+ /**
749
+ * Format: uri
750
+ * @description The URL of the Item
751
+ */
752
+ url: string;
753
+ };
754
+ WebsetItemEvaluation: {
755
+ /** @description The description of the criterion */
756
+ criterion: string;
757
+ /** @description The reasoning for the result of the evaluation */
758
+ reasoning: string;
759
+ /**
760
+ * @description The references used to generate the result.
761
+ * @default []
762
+ */
763
+ references: {
764
+ /** @description The relevant snippet of the reference content */
765
+ snippet: string | null;
766
+ /** @description The title of the reference */
767
+ title: string | null;
768
+ /** @description The URL of the reference */
769
+ url: string;
770
+ }[];
771
+ /**
772
+ * @description The satisfaction of the criterion
773
+ * @enum {string}
774
+ */
775
+ satisfied: WebsetItemEvaluationSatisfied;
776
+ };
777
+ WebsetItemPersonProperties: {
778
+ /** @description Short description of the relevance of the person */
779
+ description: string;
780
+ /** WebsetItemPersonPropertiesFields */
781
+ person: {
782
+ /** @description The location of the person */
783
+ location: string | null;
784
+ /** @description The name of the person */
785
+ name: string;
786
+ /**
787
+ * Format: uri
788
+ * @description The image URL of the person
789
+ */
790
+ pictureUrl: string | null;
791
+ /** @description The current work position of the person */
792
+ position: string | null;
793
+ };
794
+ /**
795
+ * @default person
796
+ * @constant
797
+ */
798
+ type: "person";
799
+ /**
800
+ * Format: uri
801
+ * @description The URL of the person profile
802
+ */
803
+ url: string;
804
+ };
805
+ WebsetItemResearchPaperProperties: {
806
+ /** @description The text content of the research paper */
807
+ content: string | null;
808
+ /** @description Short description of the relevance of the research paper */
809
+ description: string;
810
+ /** WebsetItemResearchPaperPropertiesFields */
811
+ researchPaper: {
812
+ /** @description The author(s) of the research paper */
813
+ author: string | null;
814
+ /** @description The date and time the research paper was published */
815
+ publishedAt: string | null;
816
+ };
817
+ /**
818
+ * @default research_paper
819
+ * @constant
820
+ */
821
+ type: "research_paper";
822
+ /**
823
+ * Format: uri
824
+ * @description The URL of the research paper
825
+ */
826
+ url: string;
827
+ };
828
+ WebsetPersonEntity: {
829
+ /**
830
+ * @default person
831
+ * @constant
832
+ */
833
+ type: "person";
834
+ };
835
+ WebsetResearchPaperEntity: {
836
+ /**
837
+ * @default research_paper
838
+ * @constant
839
+ */
840
+ type: "research_paper";
841
+ };
842
+ WebsetSearch: {
843
+ /**
844
+ * Format: date-time
845
+ * @description The date and time the search was canceled
846
+ */
847
+ canceledAt: string | null;
848
+ /**
849
+ * @description The reason the search was canceled
850
+ * @enum {string|null}
851
+ */
852
+ canceledReason: WebsetSearchCanceledReason;
853
+ /** @description The number of results the search will attempt to find. The actual number of results may be less than this number depending on the search complexity. */
854
+ count: number;
855
+ /**
856
+ * Format: date-time
857
+ * @description The date and time the search was created
858
+ */
859
+ createdAt: string;
860
+ /** @description The criteria the search will use to evaluate the results. If not provided, we will automatically generate them for you. */
861
+ criteria: {
862
+ /** @description The description of the criterion */
863
+ description: string;
864
+ /** @description Value between 0 and 100 representing the percentage of results that meet the criterion. */
865
+ successRate: number;
866
+ }[];
867
+ /** @description The entity the search will return results for.
868
+ *
869
+ * When no entity is provided during creation, we will automatically select the best entity based on the query. */
870
+ entity: components["schemas"]["WebsetEntity"];
871
+ /** @description The unique identifier for the search */
872
+ id: string;
873
+ /**
874
+ * @description Set of key-value pairs you want to associate with this object.
875
+ * @default {}
876
+ */
877
+ metadata: {
878
+ [key: string]: string;
879
+ };
880
+ /**
881
+ * @default webset_search
882
+ * @constant
883
+ */
884
+ object: "webset_search";
885
+ /** @description The progress of the search */
886
+ progress: {
887
+ /** @description The completion percentage of the search */
888
+ completion: number;
889
+ /** @description The number of results found so far */
890
+ found: number;
891
+ };
892
+ /** @description The query used to create the search. */
893
+ query: string;
894
+ /**
895
+ * WebsetSearchStatus
896
+ * @description The status of the search
897
+ * @enum {string}
898
+ */
899
+ status: WebsetSearchStatus;
900
+ /**
901
+ * Format: date-time
902
+ * @description The date and time the search was updated
903
+ */
904
+ updatedAt: string;
905
+ };
906
+ };
907
+ responses: never;
908
+ parameters: never;
909
+ requestBodies: never;
910
+ headers: never;
911
+ pathItems: never;
912
+ }
913
+ type CreateEnrichmentParameters = components["schemas"]["CreateEnrichmentParameters"];
914
+ type CreateWebhookParameters = components["schemas"]["CreateWebhookParameters"];
915
+ type CreateWebsetParameters = components["schemas"]["CreateWebsetParameters"];
916
+ type CreateWebsetSearchParameters = components["schemas"]["CreateWebsetSearchParameters"];
917
+ type EnrichmentResult = components["schemas"]["EnrichmentResult"];
918
+ type Event = components["schemas"]["Event"];
919
+ type GetWebsetResponse = components["schemas"]["GetWebsetResponse"];
920
+ type ListEventsResponse = components["schemas"]["ListEventsResponse"];
921
+ type ListWebhookAttemptsResponse = components["schemas"]["ListWebhookAttemptsResponse"];
922
+ type ListWebhooksResponse = components["schemas"]["ListWebhooksResponse"];
923
+ type ListWebsetItemResponse = components["schemas"]["ListWebsetItemResponse"];
924
+ type ListWebsetsResponse = components["schemas"]["ListWebsetsResponse"];
925
+ type UpdateWebhookParameters = components["schemas"]["UpdateWebhookParameters"];
926
+ type UpdateWebsetRequest = components["schemas"]["UpdateWebsetRequest"];
927
+ type Webhook = components["schemas"]["Webhook"];
928
+ type WebhookAttempt = components["schemas"]["WebhookAttempt"];
929
+ type Webset = components["schemas"]["Webset"];
930
+ type WebsetEnrichment = components["schemas"]["WebsetEnrichment"];
931
+ type WebsetItem = components["schemas"]["WebsetItem"];
932
+ type WebsetSearch = components["schemas"]["WebsetSearch"];
933
+ declare enum CreateEnrichmentParametersFormat {
934
+ text = "text",
935
+ date = "date",
936
+ number = "number",
937
+ options = "options",
938
+ email = "email",
939
+ phone = "phone"
940
+ }
941
+ declare enum CreateWebsetSearchParametersBehaviour {
942
+ override = "override"
943
+ }
944
+ declare enum EventType {
945
+ webset_created = "webset.created",
946
+ webset_deleted = "webset.deleted",
947
+ webset_paused = "webset.paused",
948
+ webset_idle = "webset.idle",
949
+ webset_search_created = "webset.search.created",
950
+ webset_search_canceled = "webset.search.canceled",
951
+ webset_search_completed = "webset.search.completed",
952
+ webset_search_updated = "webset.search.updated",
953
+ webset_export_created = "webset.export.created",
954
+ webset_export_completed = "webset.export.completed",
955
+ webset_item_created = "webset.item.created",
956
+ webset_item_enriched = "webset.item.enriched"
957
+ }
958
+ declare enum WebhookStatus {
959
+ active = "active",
960
+ inactive = "inactive"
961
+ }
962
+ declare enum WebsetStatus {
963
+ idle = "idle",
964
+ running = "running",
965
+ paused = "paused"
966
+ }
967
+ declare enum WebsetEnrichmentStatus {
968
+ pending = "pending",
969
+ canceled = "canceled",
970
+ completed = "completed"
971
+ }
972
+ declare enum WebsetEnrichmentFormat {
973
+ text = "text",
974
+ date = "date",
975
+ number = "number",
976
+ options = "options",
977
+ email = "email",
978
+ phone = "phone"
979
+ }
980
+ declare enum WebsetItemSource {
981
+ search = "search"
982
+ }
983
+ declare enum WebsetItemEvaluationSatisfied {
984
+ yes = "yes",
985
+ no = "no",
986
+ unclear = "unclear"
987
+ }
988
+ declare enum WebsetSearchCanceledReason {
989
+ webset_deleted = "webset_deleted",
990
+ webset_canceled = "webset_canceled"
991
+ }
992
+ declare enum WebsetSearchStatus {
993
+ created = "created",
994
+ running = "running",
995
+ completed = "completed",
996
+ canceled = "canceled"
997
+ }
998
+
999
+ /**
1000
+ * Client for managing Webset Enrichments
1001
+ */
1002
+
1003
+ /**
1004
+ * Client for managing Webset Enrichments
1005
+ */
1006
+ declare class WebsetEnrichmentsClient extends WebsetsBaseClient {
1007
+ /**
1008
+ * Create an Enrichment for a Webset
1009
+ * @param websetId The ID of the Webset
1010
+ * @param params The enrichment parameters
1011
+ * @returns The created Webset Enrichment
1012
+ */
1013
+ create(websetId: string, params: CreateEnrichmentParameters): Promise<WebsetEnrichment>;
1014
+ /**
1015
+ * Get an Enrichment by ID
1016
+ * @param websetId The ID of the Webset
1017
+ * @param id The ID of the Enrichment
1018
+ * @returns The Webset Enrichment
1019
+ */
1020
+ get(websetId: string, id: string): Promise<WebsetEnrichment>;
1021
+ /**
1022
+ * Delete an Enrichment
1023
+ * @param websetId The ID of the Webset
1024
+ * @param id The ID of the Enrichment
1025
+ * @returns The deleted Webset Enrichment
1026
+ */
1027
+ delete(websetId: string, id: string): Promise<WebsetEnrichment>;
1028
+ /**
1029
+ * Cancel a running Enrichment
1030
+ * @param websetId The ID of the Webset
1031
+ * @param id The ID of the Enrichment
1032
+ * @returns The canceled Webset Enrichment
1033
+ */
1034
+ cancel(websetId: string, id: string): Promise<WebsetEnrichment>;
1035
+ }
1036
+
1037
+ /**
1038
+ * Options for listing Events
1039
+ */
1040
+ interface ListEventsOptions {
1041
+ /**
1042
+ * The cursor to paginate through the results
1043
+ */
1044
+ cursor?: string;
1045
+ /**
1046
+ * The number of results to return
1047
+ */
1048
+ limit?: number;
1049
+ /**
1050
+ * The types of events to filter by
1051
+ */
1052
+ types?: EventType[];
1053
+ }
1054
+ /**
1055
+ * Client for managing Events
1056
+ */
1057
+ declare class EventsClient extends WebsetsBaseClient {
1058
+ /**
1059
+ * Initialize a new Events client
1060
+ * @param client The Exa client instance
1061
+ */
1062
+ constructor(client: Exa);
1063
+ /**
1064
+ * List all Events
1065
+ * @param options Optional filtering and pagination options
1066
+ * @returns The list of Events
1067
+ */
1068
+ list(options?: ListEventsOptions): Promise<ListEventsResponse>;
1069
+ /**
1070
+ * Get an Event by ID
1071
+ * @param id The ID of the Event
1072
+ * @returns The Event
1073
+ */
1074
+ get(id: string): Promise<Event>;
1075
+ }
1076
+
1077
+ /**
1078
+ * Client for managing Webset Items
1079
+ */
1080
+
1081
+ /**
1082
+ * Client for managing Webset Items
1083
+ */
1084
+ declare class WebsetItemsClient extends WebsetsBaseClient {
1085
+ /**
1086
+ * List all Items for a Webset
1087
+ * @param websetId The ID of the Webset
1088
+ * @param params - Optional pagination parameters
1089
+ * @returns A promise that resolves with the list of Items
1090
+ */
1091
+ list(websetId: string, params?: PaginationParams): Promise<ListWebsetItemResponse>;
1092
+ /**
1093
+ * Iterate through all Items in a Webset, handling pagination automatically
1094
+ * @param websetId The ID of the Webset
1095
+ * @param options Pagination options
1096
+ * @returns Async generator of Webset Items
1097
+ */
1098
+ listAll(websetId: string, options?: PaginationParams): AsyncGenerator<WebsetItem>;
1099
+ /**
1100
+ * Collect all items from a Webset into an array
1101
+ * @param websetId The ID of the Webset
1102
+ * @param options Pagination options
1103
+ * @returns Promise resolving to an array of all Webset Items
1104
+ */
1105
+ getAll(websetId: string, options?: PaginationParams): Promise<WebsetItem[]>;
1106
+ /**
1107
+ * Get an Item by ID
1108
+ * @param websetId The ID of the Webset
1109
+ * @param id The ID of the Item
1110
+ * @returns The Webset Item
1111
+ */
1112
+ get(websetId: string, id: string): Promise<WebsetItem>;
1113
+ /**
1114
+ * Delete an Item
1115
+ * @param websetId The ID of the Webset
1116
+ * @param id The ID of the Item
1117
+ * @returns The deleted Webset Item
1118
+ */
1119
+ delete(websetId: string, id: string): Promise<WebsetItem>;
1120
+ }
1121
+
1122
+ /**
1123
+ * Client for managing Webset Searches
1124
+ */
1125
+
1126
+ /**
1127
+ * Client for managing Webset Searches
1128
+ */
1129
+ declare class WebsetSearchesClient extends WebsetsBaseClient {
1130
+ /**
1131
+ * Create a new Search for the Webset
1132
+ * @param websetId The ID of the Webset
1133
+ * @param params The search parameters
1134
+ * @returns The created Webset Search
1135
+ */
1136
+ create(websetId: string, params: CreateWebsetSearchParameters): Promise<WebsetSearch>;
1137
+ /**
1138
+ * Get a Search by ID
1139
+ * @param websetId The ID of the Webset
1140
+ * @param id The ID of the Search
1141
+ * @returns The Webset Search
1142
+ */
1143
+ get(websetId: string, id: string): Promise<WebsetSearch>;
1144
+ /**
1145
+ * Cancel a running Search
1146
+ * @param websetId The ID of the Webset
1147
+ * @param id The ID of the Search
1148
+ * @returns The canceled Webset Search
1149
+ */
1150
+ cancel(websetId: string, id: string): Promise<WebsetSearch>;
1151
+ }
1152
+
1153
+ /**
1154
+ * Client for managing Webset Webhooks
1155
+ */
1156
+
1157
+ /**
1158
+ * Options for listing webhooks (only pagination is supported by API)
1159
+ */
1160
+ interface ListWebhooksOptions extends PaginationParams {
1161
+ }
1162
+ /**
1163
+ * Options for listing webhook attempts
1164
+ */
1165
+ interface ListWebhookAttemptsOptions extends PaginationParams {
1166
+ /**
1167
+ * The type of event to filter by
1168
+ */
1169
+ eventType?: EventType;
1170
+ }
1171
+ /**
1172
+ * Client for managing Webset Webhooks
1173
+ */
1174
+ declare class WebsetWebhooksClient extends WebsetsBaseClient {
1175
+ /**
1176
+ * Create a Webhook
1177
+ * @param params The webhook parameters
1178
+ * @returns The created Webhook
1179
+ */
1180
+ create(params: CreateWebhookParameters): Promise<Webhook>;
1181
+ /**
1182
+ * Get a Webhook by ID
1183
+ * @param id The ID of the Webhook
1184
+ * @returns The Webhook
1185
+ */
1186
+ get(id: string): Promise<Webhook>;
1187
+ /**
1188
+ * List all Webhooks
1189
+ * @param options Pagination options
1190
+ * @returns The list of Webhooks
1191
+ */
1192
+ list(options?: ListWebhooksOptions): Promise<ListWebhooksResponse>;
1193
+ /**
1194
+ * Iterate through all Webhooks, handling pagination automatically
1195
+ * @param options Pagination options
1196
+ * @returns Async generator of Webhooks
1197
+ */
1198
+ listAll(options?: ListWebhooksOptions): AsyncGenerator<Webhook>;
1199
+ /**
1200
+ * Collect all Webhooks into an array
1201
+ * @param options Pagination options
1202
+ * @returns Promise resolving to an array of all Webhooks
1203
+ */
1204
+ getAll(options?: ListWebhooksOptions): Promise<Webhook[]>;
1205
+ /**
1206
+ * Update a Webhook
1207
+ * @param id The ID of the Webhook
1208
+ * @param params The webhook update parameters (events, metadata, url)
1209
+ * @returns The updated Webhook
1210
+ */
1211
+ update(id: string, params: UpdateWebhookParameters): Promise<Webhook>;
1212
+ /**
1213
+ * Delete a Webhook
1214
+ * @param id The ID of the Webhook
1215
+ * @returns The deleted Webhook
1216
+ */
1217
+ delete(id: string): Promise<Webhook>;
1218
+ /**
1219
+ * List all attempts for a Webhook
1220
+ * @param id The ID of the Webhook
1221
+ * @param options Pagination and filtering options
1222
+ * @returns The list of Webhook attempts
1223
+ */
1224
+ listAttempts(id: string, options?: ListWebhookAttemptsOptions): Promise<ListWebhookAttemptsResponse>;
1225
+ /**
1226
+ * Iterate through all attempts for a Webhook, handling pagination automatically
1227
+ * @param id The ID of the Webhook
1228
+ * @param options Pagination and filtering options
1229
+ * @returns Async generator of Webhook attempts
1230
+ */
1231
+ listAllAttempts(id: string, options?: ListWebhookAttemptsOptions): AsyncGenerator<WebhookAttempt>;
1232
+ /**
1233
+ * Collect all attempts for a Webhook into an array
1234
+ * @param id The ID of the Webhook
1235
+ * @param options Pagination and filtering options
1236
+ * @returns Promise resolving to an array of all Webhook attempts
1237
+ */
1238
+ getAllAttempts(id: string, options?: ListWebhookAttemptsOptions): Promise<WebhookAttempt[]>;
1239
+ }
1240
+
1241
+ /**
1242
+ * Main client for Websets API
1243
+ */
1244
+
1245
+ /**
1246
+ * Options for listing Websets (API only supports pagination)
1247
+ */
1248
+ interface ListWebsetsOptions extends PaginationParams {
1249
+ }
1250
+ /**
1251
+ * Client for managing Websets
1252
+ */
1253
+ declare class WebsetsClient extends WebsetsBaseClient {
1254
+ /**
1255
+ * Client for managing Events
1256
+ */
1257
+ events: EventsClient;
1258
+ /**
1259
+ * Client for managing Webset Items
1260
+ */
1261
+ items: WebsetItemsClient;
1262
+ /**
1263
+ * Client for managing Webset Searches
1264
+ */
1265
+ searches: WebsetSearchesClient;
1266
+ /**
1267
+ * Client for managing Webset Enrichments
1268
+ */
1269
+ enrichments: WebsetEnrichmentsClient;
1270
+ /**
1271
+ * Client for managing Webset Webhooks
1272
+ */
1273
+ webhooks: WebsetWebhooksClient;
1274
+ /**
1275
+ * Initialize a new Websets client
1276
+ * @param client The Exa client instance
1277
+ */
1278
+ constructor(client: Exa);
1279
+ /**
1280
+ * Create a new Webset
1281
+ * @param params The Webset creation parameters
1282
+ * @returns The created Webset
1283
+ */
1284
+ create(params: CreateWebsetParameters): Promise<Webset>;
1285
+ /**
1286
+ * Get a Webset by ID
1287
+ * @param id The ID of the Webset
1288
+ * @param expand Optional array of relations to expand
1289
+ * @returns The Webset
1290
+ */
1291
+ get(id: string, expand?: Array<"items">): Promise<GetWebsetResponse>;
1292
+ /**
1293
+ * List all Websets
1294
+ * @param options Pagination options (filtering by status is not supported by API)
1295
+ * @returns The list of Websets
1296
+ */
1297
+ list(options?: ListWebsetsOptions): Promise<ListWebsetsResponse>;
1298
+ /**
1299
+ * Iterate through all Websets, handling pagination automatically
1300
+ * @param options Pagination options
1301
+ * @returns Async generator of Websets
1302
+ */
1303
+ listAll(options?: ListWebsetsOptions): AsyncGenerator<Webset>;
1304
+ /**
1305
+ * Collect all Websets into an array
1306
+ * @param options Pagination options
1307
+ * @returns Promise resolving to an array of all Websets
1308
+ */
1309
+ getAll(options?: ListWebsetsOptions): Promise<Webset[]>;
1310
+ /**
1311
+ * Update a Webset
1312
+ * @param id The ID of the Webset
1313
+ * @param params The Webset update parameters
1314
+ * @returns The updated Webset
1315
+ */
1316
+ update(id: string, params: UpdateWebsetRequest): Promise<Webset>;
1317
+ /**
1318
+ * Delete a Webset
1319
+ * @param id The ID of the Webset
1320
+ * @returns The deleted Webset
1321
+ */
1322
+ delete(id: string): Promise<Webset>;
1323
+ /**
1324
+ * Cancel a running Webset
1325
+ * @param id The ID or external ID of the Webset
1326
+ * @returns The canceled Webset (as returned by the API)
1327
+ */
1328
+ cancel(id: string): Promise<Webset>;
1329
+ /**
1330
+ * Wait until a Webset is idle
1331
+ * @param id The ID of the Webset
1332
+ * @param options Configuration options for timeout and polling
1333
+ * @returns The Webset once it becomes idle
1334
+ * @throws Error if the Webset does not become idle within the timeout
1335
+ */
1336
+ waitUntilIdle(id: string, options?: {
1337
+ timeout?: number;
1338
+ pollInterval?: number;
1339
+ onPoll?: (status: WebsetStatus) => void;
1340
+ } | number): Promise<Webset>;
1341
+ }
1342
+
1343
+ /**
1344
+ * HTTP status codes
1345
+ */
1346
+ declare enum HttpStatusCode {
1347
+ BadRequest = 400,
1348
+ NotFound = 404,
1349
+ Unauthorized = 401,
1350
+ Forbidden = 403,
1351
+ TooManyRequests = 429,
1352
+ RequestTimeout = 408,
1353
+ InternalServerError = 500,
1354
+ ServiceUnavailable = 503
1355
+ }
1356
+ /**
1357
+ * Base error class for all Exa API errors
1358
+ */
1359
+ declare class ExaError extends Error {
1360
+ /**
1361
+ * HTTP status code
1362
+ */
1363
+ statusCode: number;
1364
+ /**
1365
+ * ISO timestamp from API
1366
+ */
1367
+ timestamp?: string;
1368
+ /**
1369
+ * Path that caused the error (may be undefined for client-side errors)
1370
+ */
1371
+ path?: string;
1372
+ /**
1373
+ * Create a new ExaError
1374
+ * @param message Error message
1375
+ * @param statusCode HTTP status code
1376
+ * @param timestamp ISO timestamp from API
1377
+ * @param path Path that caused the error
1378
+ */
1379
+ constructor(message: string, statusCode: number, timestamp?: string, path?: string);
1380
+ }
1381
+
1
1382
  declare const isBeta = false;
2
1383
  /**
3
1384
  * Search options for performing a search query.
@@ -262,11 +1643,13 @@ type SearchResponse<T extends ContentsOptions> = {
262
1643
  * @property {boolean} [stream] - Whether to stream the response. Default false.
263
1644
  * @property {boolean} [text] - Whether to include text in the source results. Default false.
264
1645
  * @property {"exa" | "exa-pro"} [model] - The model to use for generating the answer. Default "exa".
1646
+ * @property {string} [systemPrompt] - A system prompt to guide the LLM's behavior when generating the answer.
265
1647
  */
266
1648
  type AnswerOptions = {
267
1649
  stream?: boolean;
268
1650
  text?: boolean;
269
1651
  model?: "exa" | "exa-pro";
1652
+ systemPrompt?: string;
270
1653
  };
271
1654
  /**
272
1655
  * Represents an answer response object from the /answer endpoint.
@@ -307,12 +1690,17 @@ type AnswerStreamResponse = {
307
1690
  answer?: string;
308
1691
  citations?: SearchResult<{}>[];
309
1692
  };
1693
+
310
1694
  /**
311
1695
  * The Exa class encapsulates the API's endpoints.
312
1696
  */
313
1697
  declare class Exa {
314
1698
  private baseURL;
315
1699
  private headers;
1700
+ /**
1701
+ * Websets API client
1702
+ */
1703
+ websets: WebsetsClient;
316
1704
  /**
317
1705
  * Helper method to separate out the contents-specific options from the rest.
318
1706
  */
@@ -328,9 +1716,11 @@ declare class Exa {
328
1716
  * @param {string} endpoint - The API endpoint to call.
329
1717
  * @param {string} method - The HTTP method to use.
330
1718
  * @param {any} [body] - The request body for POST requests.
1719
+ * @param {Record<string, any>} [params] - The query parameters.
331
1720
  * @returns {Promise<any>} The response from the API.
1721
+ * @throws {ExaError} When any API request fails with structured error information
332
1722
  */
333
- private request;
1723
+ request<T = unknown>(endpoint: string, method: string, body?: any, params?: Record<string, any>): Promise<T>;
334
1724
  /**
335
1725
  * Performs a search with an Exa prompt-engineered query.
336
1726
  *
@@ -374,6 +1764,15 @@ declare class Exa {
374
1764
  * @param {AnswerOptions} [options] - Additional options for answer generation.
375
1765
  * @returns {Promise<AnswerResponse>} The generated answer and source references.
376
1766
  *
1767
+ * Example with systemPrompt:
1768
+ * ```ts
1769
+ * const answer = await exa.answer("What is quantum computing?", {
1770
+ * text: true,
1771
+ * model: "exa-pro",
1772
+ * systemPrompt: "Answer in a technical manner suitable for experts."
1773
+ * });
1774
+ * ```
1775
+ *
377
1776
  * Note: For streaming responses, use the `streamAnswer` method:
378
1777
  * ```ts
379
1778
  * for await (const chunk of exa.streamAnswer(query)) {
@@ -390,7 +1789,10 @@ declare class Exa {
390
1789
  *
391
1790
  * Example usage:
392
1791
  * ```ts
393
- * for await (const chunk of exa.streamAnswer("What is quantum computing?", { text: false })) {
1792
+ * for await (const chunk of exa.streamAnswer("What is quantum computing?", {
1793
+ * text: false,
1794
+ * systemPrompt: "Answer in a concise manner suitable for beginners."
1795
+ * })) {
394
1796
  * if (chunk.content) process.stdout.write(chunk.content);
395
1797
  * if (chunk.citations) {
396
1798
  * console.log("\nCitations: ", chunk.citations);
@@ -401,8 +1803,9 @@ declare class Exa {
401
1803
  streamAnswer(query: string, options?: {
402
1804
  text?: boolean;
403
1805
  model?: "exa" | "exa-pro";
1806
+ systemPrompt?: string;
404
1807
  }): AsyncGenerator<AnswerStreamChunk>;
405
1808
  private processChunk;
406
1809
  }
407
1810
 
408
- export { AnswerOptions, AnswerResponse, AnswerStreamChunk, AnswerStreamResponse, BaseSearchOptions, ContentsOptions, ContentsResultComponent, CostDollars, CostDollarsContents, CostDollarsSeearch, Default, ExtrasOptions, ExtrasResponse, FindSimilarOptions, HighlightsContentsOptions, HighlightsResponse, JSONSchema, LivecrawlOptions, RegularSearchOptions, SearchResponse, SearchResult, SubpagesResponse, SummaryContentsOptions, SummaryResponse, TextContentsOptions, TextResponse, Exa as default };
1811
+ export { AnswerOptions, AnswerResponse, AnswerStreamChunk, AnswerStreamResponse, BaseSearchOptions, ContentsOptions, ContentsResultComponent, CostDollars, CostDollarsContents, CostDollarsSeearch, CreateEnrichmentParameters, CreateEnrichmentParametersFormat, CreateWebhookParameters, CreateWebsetParameters, CreateWebsetSearchParameters, CreateWebsetSearchParametersBehaviour, Default, EnrichmentResult, Event, EventType, Exa, ExaError, ExtrasOptions, ExtrasResponse, FindSimilarOptions, GetWebsetResponse, HighlightsContentsOptions, HighlightsResponse, HttpStatusCode, JSONSchema, ListEventsResponse, ListWebhooksOptions, ListWebhooksResponse, ListWebsetItemResponse, ListWebsetsOptions, ListWebsetsResponse, LivecrawlOptions, RegularSearchOptions, SearchResponse, SearchResult, SubpagesResponse, SummaryContentsOptions, SummaryResponse, TextContentsOptions, TextResponse, UpdateWebhookParameters, UpdateWebsetRequest, Webhook, WebhookStatus, Webset, WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetItem, WebsetItemEvaluationSatisfied, WebsetItemSource, WebsetItemsClient, WebsetSearch, WebsetSearchCanceledReason, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };