exa-js 1.10.1 → 2.0.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/dist/index.d.mts +290 -111
- package/dist/index.d.ts +290 -111
- package/dist/index.js +59 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -3,228 +3,330 @@ import { ZodSchema } from 'zod';
|
|
|
3
3
|
interface components$1 {
|
|
4
4
|
schemas: {
|
|
5
5
|
ListResearchResponseDto: {
|
|
6
|
-
/** @description
|
|
6
|
+
/** @description Research requests ordered by creation time (newest first) */
|
|
7
7
|
data: components$1["schemas"]["ResearchDtoClass"][];
|
|
8
|
-
/** @description
|
|
8
|
+
/** @description If true, use nextCursor to fetch more results */
|
|
9
9
|
hasMore: boolean;
|
|
10
|
-
/** @description
|
|
10
|
+
/** @description Pass this value as the cursor parameter to fetch the next page */
|
|
11
11
|
nextCursor: string | null;
|
|
12
12
|
};
|
|
13
13
|
ResearchCreateRequestDtoClass: {
|
|
14
|
-
/** @description Instructions for what research should be conducted */
|
|
14
|
+
/** @description Instructions for what you would like research on. A good prompt clearly defines what information you want to find, how research should be conducted, and what the output should look like. */
|
|
15
15
|
instructions: string;
|
|
16
16
|
/**
|
|
17
|
+
* @description Research model to use. exa-research is faster and cheaper, while exa-research-pro provides more thorough analysis and stronger reasoning.
|
|
17
18
|
* @default exa-research
|
|
18
19
|
* @enum {string}
|
|
19
20
|
*/
|
|
20
|
-
model: "exa-research" | "exa-research-pro";
|
|
21
|
+
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
|
|
22
|
+
/** @description JSON Schema to enforce structured output. When provided, the research output will be validated against this schema and returned as parsed JSON. */
|
|
21
23
|
outputSchema?: {
|
|
22
24
|
[key: string]: unknown;
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
ResearchDtoClass: {
|
|
26
|
-
/** @description
|
|
28
|
+
/** @description When the research was created (Unix timestamp in milliseconds) */
|
|
27
29
|
createdAt: number;
|
|
28
|
-
/** @description The
|
|
30
|
+
/** @description The original research instructions provided */
|
|
29
31
|
instructions: string;
|
|
30
32
|
/**
|
|
31
|
-
* @description The model used for
|
|
33
|
+
* @description The model used for this research request
|
|
32
34
|
* @default exa-research
|
|
33
35
|
* @enum {string}
|
|
34
36
|
*/
|
|
35
|
-
model: "exa-research" | "exa-research-pro";
|
|
37
|
+
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
|
|
38
|
+
/** @description The JSON Schema used to validate the output, if provided */
|
|
36
39
|
outputSchema?: {
|
|
37
40
|
[key: string]: unknown;
|
|
38
41
|
};
|
|
39
|
-
/** @description
|
|
42
|
+
/** @description Unique identifier for tracking and retrieving this research request */
|
|
40
43
|
researchId: string;
|
|
41
44
|
/** @enum {string} */
|
|
42
45
|
status: "pending";
|
|
43
46
|
} | {
|
|
44
|
-
/** @description
|
|
47
|
+
/** @description When the research was created (Unix timestamp in milliseconds) */
|
|
45
48
|
createdAt: number;
|
|
49
|
+
/** @description Real-time log of operations as research progresses. Poll this endpoint or use ?stream=true for live updates. */
|
|
46
50
|
events?: components$1["schemas"]["ResearchEventDtoClass"][];
|
|
47
|
-
/** @description The
|
|
51
|
+
/** @description The original research instructions provided */
|
|
48
52
|
instructions: string;
|
|
49
53
|
/**
|
|
50
|
-
* @description The model used for
|
|
54
|
+
* @description The model used for this research request
|
|
51
55
|
* @default exa-research
|
|
52
56
|
* @enum {string}
|
|
53
57
|
*/
|
|
54
|
-
model: "exa-research" | "exa-research-pro";
|
|
58
|
+
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
|
|
59
|
+
/** @description The JSON Schema used to validate the output, if provided */
|
|
55
60
|
outputSchema?: {
|
|
56
61
|
[key: string]: unknown;
|
|
57
62
|
};
|
|
58
|
-
/** @description
|
|
63
|
+
/** @description Unique identifier for tracking and retrieving this research request */
|
|
59
64
|
researchId: string;
|
|
60
65
|
/** @enum {string} */
|
|
61
66
|
status: "running";
|
|
62
67
|
} | {
|
|
68
|
+
/** @description Detailed cost breakdown for billing purposes */
|
|
63
69
|
costDollars: {
|
|
70
|
+
/** @description Count of web pages fully crawled and processed. Only pages that were read in detail are counted. */
|
|
64
71
|
numPages: number;
|
|
72
|
+
/** @description Count of web searches performed. Each search query counts as one search. */
|
|
65
73
|
numSearches: number;
|
|
74
|
+
/** @description Total AI tokens used for reasoning, planning, and generating the final output */
|
|
66
75
|
reasoningTokens: number;
|
|
76
|
+
/** @description Total cost in USD for this research request */
|
|
67
77
|
total: number;
|
|
68
78
|
};
|
|
69
|
-
/** @description
|
|
79
|
+
/** @description When the research was created (Unix timestamp in milliseconds) */
|
|
70
80
|
createdAt: number;
|
|
81
|
+
/** @description Detailed log of all operations performed during research. Use ?events=true to include this field for debugging or monitoring progress. */
|
|
71
82
|
events?: components$1["schemas"]["ResearchEventDtoClass"][];
|
|
72
|
-
/** @description
|
|
83
|
+
/** @description When the research completed (Unix timestamp in milliseconds) */
|
|
73
84
|
finishedAt: number;
|
|
74
|
-
/** @description The
|
|
85
|
+
/** @description The original research instructions provided */
|
|
75
86
|
instructions: string;
|
|
76
87
|
/**
|
|
77
|
-
* @description The model used for
|
|
88
|
+
* @description The model used for this research request
|
|
78
89
|
* @default exa-research
|
|
79
90
|
* @enum {string}
|
|
80
91
|
*/
|
|
81
|
-
model: "exa-research" | "exa-research-pro";
|
|
92
|
+
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
|
|
93
|
+
/** @description The final research results, containing both raw text and parsed JSON if outputSchema was provided */
|
|
82
94
|
output: {
|
|
95
|
+
/** @description The complete research output as text. If outputSchema was provided, this is a JSON string. */
|
|
83
96
|
content: string;
|
|
97
|
+
/** @description Structured JSON object matching your outputSchema. Only present when outputSchema was provided and the output successfully validated. */
|
|
84
98
|
parsed?: {
|
|
85
99
|
[key: string]: unknown;
|
|
86
100
|
};
|
|
87
101
|
};
|
|
102
|
+
/** @description The JSON Schema used to validate the output, if provided */
|
|
88
103
|
outputSchema?: {
|
|
89
104
|
[key: string]: unknown;
|
|
90
105
|
};
|
|
91
|
-
/** @description
|
|
106
|
+
/** @description Unique identifier for tracking and retrieving this research request */
|
|
92
107
|
researchId: string;
|
|
93
108
|
/** @enum {string} */
|
|
94
109
|
status: "completed";
|
|
95
110
|
} | {
|
|
96
|
-
/** @description
|
|
111
|
+
/** @description When the research was created (Unix timestamp in milliseconds) */
|
|
97
112
|
createdAt: number;
|
|
113
|
+
/** @description Detailed log of all operations performed during research. Use ?events=true to include this field for debugging or monitoring progress. */
|
|
98
114
|
events?: components$1["schemas"]["ResearchEventDtoClass"][];
|
|
99
|
-
/** @description
|
|
115
|
+
/** @description When the research was canceled (Unix timestamp in milliseconds) */
|
|
100
116
|
finishedAt: number;
|
|
101
|
-
/** @description The
|
|
117
|
+
/** @description The original research instructions provided */
|
|
102
118
|
instructions: string;
|
|
103
119
|
/**
|
|
104
|
-
* @description The model used for
|
|
120
|
+
* @description The model used for this research request
|
|
105
121
|
* @default exa-research
|
|
106
122
|
* @enum {string}
|
|
107
123
|
*/
|
|
108
|
-
model: "exa-research" | "exa-research-pro";
|
|
124
|
+
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
|
|
125
|
+
/** @description The JSON Schema used to validate the output, if provided */
|
|
109
126
|
outputSchema?: {
|
|
110
127
|
[key: string]: unknown;
|
|
111
128
|
};
|
|
112
|
-
/** @description
|
|
129
|
+
/** @description Unique identifier for tracking and retrieving this research request */
|
|
113
130
|
researchId: string;
|
|
114
131
|
/** @enum {string} */
|
|
115
132
|
status: "canceled";
|
|
116
133
|
} | {
|
|
117
|
-
/** @description
|
|
134
|
+
/** @description When the research was created (Unix timestamp in milliseconds) */
|
|
118
135
|
createdAt: number;
|
|
119
|
-
/** @description
|
|
136
|
+
/** @description Human-readable error message explaining what went wrong. */
|
|
120
137
|
error: string;
|
|
138
|
+
/** @description Detailed log of all operations performed during research. Use ?events=true to include this field for debugging or monitoring progress. */
|
|
121
139
|
events?: components$1["schemas"]["ResearchEventDtoClass"][];
|
|
122
|
-
/** @description
|
|
140
|
+
/** @description When the research failed (Unix timestamp in milliseconds) */
|
|
123
141
|
finishedAt: number;
|
|
124
|
-
/** @description The
|
|
142
|
+
/** @description The original research instructions provided */
|
|
125
143
|
instructions: string;
|
|
126
144
|
/**
|
|
127
|
-
* @description The model used for
|
|
145
|
+
* @description The model used for this research request
|
|
128
146
|
* @default exa-research
|
|
129
147
|
* @enum {string}
|
|
130
148
|
*/
|
|
131
|
-
model: "exa-research" | "exa-research-pro";
|
|
149
|
+
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
|
|
150
|
+
/** @description The JSON Schema used to validate the output, if provided */
|
|
132
151
|
outputSchema?: {
|
|
133
152
|
[key: string]: unknown;
|
|
134
153
|
};
|
|
135
|
-
/** @description
|
|
154
|
+
/** @description Unique identifier for tracking and retrieving this research request */
|
|
136
155
|
researchId: string;
|
|
137
156
|
/** @enum {string} */
|
|
138
157
|
status: "failed";
|
|
139
158
|
};
|
|
140
159
|
ResearchEventDtoClass: ({
|
|
141
|
-
/** @description
|
|
160
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
142
161
|
createdAt: number;
|
|
143
162
|
/** @enum {string} */
|
|
144
163
|
eventType: "research-definition";
|
|
164
|
+
/** @description The complete research instructions as provided */
|
|
145
165
|
instructions: string;
|
|
166
|
+
/** @description The JSON Schema that will validate the final output */
|
|
146
167
|
outputSchema?: {
|
|
147
168
|
[key: string]: unknown;
|
|
148
169
|
};
|
|
170
|
+
/** @description The research request this event belongs to */
|
|
149
171
|
researchId: string;
|
|
150
172
|
} | {
|
|
151
|
-
/** @description
|
|
173
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
152
174
|
createdAt: number;
|
|
153
175
|
/** @enum {string} */
|
|
154
176
|
eventType: "research-output";
|
|
177
|
+
/** @description The final research result, either successful with data or failed with error */
|
|
155
178
|
output: {
|
|
179
|
+
/** @description The complete research output as text. If outputSchema was provided, this is a JSON string. */
|
|
156
180
|
content: string;
|
|
157
181
|
costDollars: {
|
|
182
|
+
/** @description Count of web pages fully crawled and processed. Only pages that were read in detail are counted. */
|
|
158
183
|
numPages: number;
|
|
184
|
+
/** @description Count of web searches performed. Each search query counts as one search. */
|
|
159
185
|
numSearches: number;
|
|
186
|
+
/** @description Total AI tokens used for reasoning, planning, and generating the final output */
|
|
160
187
|
reasoningTokens: number;
|
|
188
|
+
/** @description Total cost in USD for this research request */
|
|
161
189
|
total: number;
|
|
162
190
|
};
|
|
163
191
|
/** @enum {string} */
|
|
164
192
|
outputType: "completed";
|
|
193
|
+
/** @description Structured JSON object matching your outputSchema. Only present when outputSchema was provided and the output successfully validated. */
|
|
165
194
|
parsed?: {
|
|
166
195
|
[key: string]: unknown;
|
|
167
196
|
};
|
|
168
197
|
} | {
|
|
198
|
+
/** @description Detailed error message explaining why the research failed */
|
|
169
199
|
error: string;
|
|
170
200
|
/** @enum {string} */
|
|
171
201
|
outputType: "failed";
|
|
172
202
|
};
|
|
203
|
+
/** @description The research request this event belongs to */
|
|
173
204
|
researchId: string;
|
|
174
205
|
}) | ({
|
|
175
|
-
/** @description
|
|
206
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
176
207
|
createdAt: number;
|
|
177
208
|
/** @enum {string} */
|
|
178
209
|
eventType: "plan-definition";
|
|
210
|
+
/** @description Identifier for this planning cycle */
|
|
179
211
|
planId: string;
|
|
212
|
+
/** @description The research request this event belongs to */
|
|
180
213
|
researchId: string;
|
|
181
214
|
} | {
|
|
182
|
-
/** @description
|
|
215
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
183
216
|
createdAt: number;
|
|
184
|
-
|
|
217
|
+
/** @description The actual operation performed (think, search, or crawl) */
|
|
218
|
+
data: {
|
|
219
|
+
/** @description The AI's reasoning process and decision-making steps */
|
|
220
|
+
content: string;
|
|
221
|
+
/** @enum {string} */
|
|
222
|
+
type: "think";
|
|
223
|
+
} | {
|
|
224
|
+
/** @description What the AI is trying to find with this search */
|
|
225
|
+
goal?: string;
|
|
226
|
+
/** @description Token cost for processing search result snippets */
|
|
227
|
+
pageTokens: number;
|
|
228
|
+
/** @description The exact search query sent to the search engine */
|
|
229
|
+
query: string;
|
|
230
|
+
/** @description URLs returned by the search, ranked by relevance */
|
|
231
|
+
results: {
|
|
232
|
+
url: string;
|
|
233
|
+
}[];
|
|
234
|
+
/**
|
|
235
|
+
* @description Search algorithm used (neural for semantic search, keyword for exact matches)
|
|
236
|
+
* @enum {string}
|
|
237
|
+
*/
|
|
238
|
+
searchType: "neural" | "keyword" | "auto" | "fast";
|
|
239
|
+
/** @enum {string} */
|
|
240
|
+
type: "search";
|
|
241
|
+
} | {
|
|
242
|
+
/** @description What information the AI expects to find on this page */
|
|
243
|
+
goal?: string;
|
|
244
|
+
/** @description Token cost for processing the full page content */
|
|
245
|
+
pageTokens: number;
|
|
246
|
+
/** @description The specific page that was crawled */
|
|
247
|
+
result: {
|
|
248
|
+
url: string;
|
|
249
|
+
};
|
|
250
|
+
/** @enum {string} */
|
|
251
|
+
type: "crawl";
|
|
252
|
+
};
|
|
185
253
|
/** @enum {string} */
|
|
186
254
|
eventType: "plan-operation";
|
|
255
|
+
/** @description Unique identifier for this specific operation */
|
|
187
256
|
operationId: string;
|
|
257
|
+
/** @description Which plan this operation belongs to */
|
|
188
258
|
planId: string;
|
|
259
|
+
/** @description The research request this event belongs to */
|
|
189
260
|
researchId: string;
|
|
190
261
|
} | {
|
|
191
|
-
/** @description
|
|
262
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
192
263
|
createdAt: number;
|
|
193
264
|
/** @enum {string} */
|
|
194
265
|
eventType: "plan-output";
|
|
195
|
-
|
|
266
|
+
/** @description The plan's decision: either generate tasks or stop researching */
|
|
267
|
+
output: {
|
|
268
|
+
/** @enum {string} */
|
|
269
|
+
outputType: "tasks";
|
|
270
|
+
/** @description Why these specific tasks were chosen */
|
|
271
|
+
reasoning: string;
|
|
272
|
+
/** @description List of task instructions that will be executed in parallel */
|
|
273
|
+
tasksInstructions: string[];
|
|
274
|
+
} | {
|
|
275
|
+
/** @enum {string} */
|
|
276
|
+
outputType: "stop";
|
|
277
|
+
/** @description Why the AI decided to stop researching */
|
|
278
|
+
reasoning: string;
|
|
279
|
+
};
|
|
280
|
+
/** @description Which plan is producing this output */
|
|
196
281
|
planId: string;
|
|
282
|
+
/** @description The research request this event belongs to */
|
|
197
283
|
researchId: string;
|
|
198
284
|
}) | ({
|
|
199
|
-
/** @description
|
|
285
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
200
286
|
createdAt: number;
|
|
201
287
|
/** @enum {string} */
|
|
202
288
|
eventType: "task-definition";
|
|
289
|
+
/** @description What this task should accomplish */
|
|
203
290
|
instructions: string;
|
|
291
|
+
/** @description The plan that generated this task */
|
|
204
292
|
planId: string;
|
|
293
|
+
/** @description The research request this event belongs to */
|
|
205
294
|
researchId: string;
|
|
295
|
+
/** @description Identifier for tracking this specific task */
|
|
206
296
|
taskId: string;
|
|
207
297
|
} | {
|
|
208
|
-
/** @description
|
|
298
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
209
299
|
createdAt: number;
|
|
300
|
+
/** @description The actual operation performed within this task */
|
|
210
301
|
data: {
|
|
302
|
+
/** @description The AI's reasoning process and decision-making steps */
|
|
211
303
|
content: string;
|
|
212
304
|
/** @enum {string} */
|
|
213
305
|
type: "think";
|
|
214
306
|
} | {
|
|
307
|
+
/** @description What the AI is trying to find with this search */
|
|
215
308
|
goal?: string;
|
|
309
|
+
/** @description Token cost for processing search result snippets */
|
|
216
310
|
pageTokens: number;
|
|
311
|
+
/** @description The exact search query sent to the search engine */
|
|
217
312
|
query: string;
|
|
313
|
+
/** @description URLs returned by the search, ranked by relevance */
|
|
218
314
|
results: {
|
|
219
315
|
url: string;
|
|
220
316
|
}[];
|
|
221
|
-
/**
|
|
317
|
+
/**
|
|
318
|
+
* @description Search algorithm used (neural for semantic search, keyword for exact matches)
|
|
319
|
+
* @enum {string}
|
|
320
|
+
*/
|
|
222
321
|
searchType: "neural" | "keyword" | "auto" | "fast";
|
|
223
322
|
/** @enum {string} */
|
|
224
323
|
type: "search";
|
|
225
324
|
} | {
|
|
325
|
+
/** @description What information the AI expects to find on this page */
|
|
226
326
|
goal?: string;
|
|
327
|
+
/** @description Token cost for processing the full page content */
|
|
227
328
|
pageTokens: number;
|
|
329
|
+
/** @description The specific page that was crawled */
|
|
228
330
|
result: {
|
|
229
331
|
url: string;
|
|
230
332
|
};
|
|
@@ -233,42 +335,62 @@ interface components$1 {
|
|
|
233
335
|
};
|
|
234
336
|
/** @enum {string} */
|
|
235
337
|
eventType: "task-operation";
|
|
338
|
+
/** @description Unique identifier for this specific operation */
|
|
236
339
|
operationId: string;
|
|
340
|
+
/** @description The plan that owns this task */
|
|
237
341
|
planId: string;
|
|
342
|
+
/** @description The research request this event belongs to */
|
|
238
343
|
researchId: string;
|
|
344
|
+
/** @description Which task is performing this operation */
|
|
239
345
|
taskId: string;
|
|
240
346
|
} | {
|
|
241
|
-
/** @description
|
|
347
|
+
/** @description When this event occurred (Unix timestamp in milliseconds) */
|
|
242
348
|
createdAt: number;
|
|
243
349
|
/** @enum {string} */
|
|
244
350
|
eventType: "task-output";
|
|
351
|
+
/** @description The successful completion result of this task */
|
|
245
352
|
output: {
|
|
353
|
+
/** @description The information gathered by this task */
|
|
246
354
|
content: string;
|
|
247
355
|
/** @enum {string} */
|
|
248
356
|
outputType: "completed";
|
|
249
357
|
};
|
|
358
|
+
/** @description The plan that owns this task */
|
|
250
359
|
planId: string;
|
|
360
|
+
/** @description The research request this event belongs to */
|
|
251
361
|
researchId: string;
|
|
362
|
+
/** @description Which task produced this output */
|
|
252
363
|
taskId: string;
|
|
253
364
|
});
|
|
254
365
|
ResearchOperationDtoClass: {
|
|
366
|
+
/** @description The AI's reasoning process and decision-making steps */
|
|
255
367
|
content: string;
|
|
256
368
|
/** @enum {string} */
|
|
257
369
|
type: "think";
|
|
258
370
|
} | {
|
|
371
|
+
/** @description What the AI is trying to find with this search */
|
|
259
372
|
goal?: string;
|
|
373
|
+
/** @description Token cost for processing search result snippets */
|
|
260
374
|
pageTokens: number;
|
|
375
|
+
/** @description The exact search query sent to the search engine */
|
|
261
376
|
query: string;
|
|
377
|
+
/** @description URLs returned by the search, ranked by relevance */
|
|
262
378
|
results: {
|
|
263
379
|
url: string;
|
|
264
380
|
}[];
|
|
265
|
-
/**
|
|
381
|
+
/**
|
|
382
|
+
* @description Search algorithm used (neural for semantic search, keyword for exact matches)
|
|
383
|
+
* @enum {string}
|
|
384
|
+
*/
|
|
266
385
|
searchType: "neural" | "keyword" | "auto" | "fast";
|
|
267
386
|
/** @enum {string} */
|
|
268
387
|
type: "search";
|
|
269
388
|
} | {
|
|
389
|
+
/** @description What information the AI expects to find on this page */
|
|
270
390
|
goal?: string;
|
|
391
|
+
/** @description Token cost for processing the full page content */
|
|
271
392
|
pageTokens: number;
|
|
393
|
+
/** @description The specific page that was crawled */
|
|
272
394
|
result: {
|
|
273
395
|
url: string;
|
|
274
396
|
};
|
|
@@ -309,7 +431,7 @@ type ResearchStreamEvent = ResearchEvent;
|
|
|
309
431
|
*/
|
|
310
432
|
type ResearchCreateParamsTyped<T> = {
|
|
311
433
|
instructions: string;
|
|
312
|
-
model?: "
|
|
434
|
+
model?: ResearchCreateRequest["model"];
|
|
313
435
|
outputSchema?: T;
|
|
314
436
|
};
|
|
315
437
|
type ResearchDefinitionEvent = Extract<ResearchEvent, {
|
|
@@ -354,7 +476,7 @@ declare class ResearchClient extends ResearchBaseClient {
|
|
|
354
476
|
create<T>(params: ResearchCreateParamsTyped<ZodSchema<T>>): Promise<ResearchCreateResponse>;
|
|
355
477
|
create(params: {
|
|
356
478
|
instructions: string;
|
|
357
|
-
model?: "
|
|
479
|
+
model?: ResearchCreateRequest["model"];
|
|
358
480
|
outputSchema?: Record<string, unknown>;
|
|
359
481
|
}): Promise<ResearchCreateResponse>;
|
|
360
482
|
get(researchId: string): Promise<Research>;
|
|
@@ -2843,10 +2965,33 @@ declare class ExaError extends Error {
|
|
|
2843
2965
|
constructor(message: string, statusCode: number, timestamp?: string, path?: string);
|
|
2844
2966
|
}
|
|
2845
2967
|
|
|
2846
|
-
declare const isBeta = false;
|
|
2847
2968
|
/**
|
|
2848
|
-
*
|
|
2969
|
+
* Options for retrieving page contents
|
|
2970
|
+
* @typedef {Object} ContentsOptions
|
|
2971
|
+
* @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
|
|
2972
|
+
* @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
|
|
2973
|
+
* @property {LivecrawlOptions} [livecrawl] - Options for livecrawling contents. Default is "never" for neural/auto search, "fallback" for keyword search.
|
|
2974
|
+
* @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
|
|
2975
|
+
* @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
|
|
2976
|
+
* @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
|
|
2977
|
+
* @property {string | string[]} [subpageTarget] - Text used to match/rank subpages in the returned subpage list. You could use "about" to get *about* page for websites. Note that this is a fuzzy matcher.
|
|
2978
|
+
* @property {ExtrasOptions} [extras] - Miscelleneous data derived from results
|
|
2979
|
+
*/
|
|
2980
|
+
type ContentsOptions = {
|
|
2981
|
+
text?: TextContentsOptions | true;
|
|
2982
|
+
summary?: SummaryContentsOptions | true;
|
|
2983
|
+
livecrawl?: LivecrawlOptions;
|
|
2984
|
+
context?: ContextOptions | true;
|
|
2985
|
+
livecrawlTimeout?: number;
|
|
2986
|
+
filterEmptyResults?: boolean;
|
|
2987
|
+
subpages?: number;
|
|
2988
|
+
subpageTarget?: string | string[];
|
|
2989
|
+
extras?: ExtrasOptions;
|
|
2990
|
+
};
|
|
2991
|
+
/**
|
|
2992
|
+
* Options for performing a search query
|
|
2849
2993
|
* @typedef {Object} SearchOptions
|
|
2994
|
+
* @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
|
|
2850
2995
|
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans.
|
|
2851
2996
|
* @property {string[]} [includeDomains] - List of domains to include in the search.
|
|
2852
2997
|
* @property {string[]} [excludeDomains] - List of domains to exclude in the search.
|
|
@@ -2861,6 +3006,7 @@ declare const isBeta = false;
|
|
|
2861
3006
|
* @property {string} [userLocation] - The two-letter ISO country code of the user, e.g. US.
|
|
2862
3007
|
*/
|
|
2863
3008
|
type BaseSearchOptions = {
|
|
3009
|
+
contents?: ContentsOptions;
|
|
2864
3010
|
numResults?: number;
|
|
2865
3011
|
includeDomains?: string[];
|
|
2866
3012
|
excludeDomains?: string[];
|
|
@@ -2898,31 +3044,6 @@ type ExtrasOptions = {
|
|
|
2898
3044
|
links?: number;
|
|
2899
3045
|
imageLinks?: number;
|
|
2900
3046
|
};
|
|
2901
|
-
/**
|
|
2902
|
-
* Search options for performing a search query.
|
|
2903
|
-
* @typedef {Object} ContentsOptions
|
|
2904
|
-
* @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
|
|
2905
|
-
* @property {HighlightsContentsOptions | boolean} [highlights] - Options for retrieving highlights. NOTE: For search type "deep", only "true" is allowed. "query", "numSentences" and "highlightsPerUrl" will not be respected;
|
|
2906
|
-
* @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
|
|
2907
|
-
* @property {LivecrawlOptions} [livecrawl] - Options for livecrawling contents. Default is "never" for neural/auto search, "fallback" for keyword search.
|
|
2908
|
-
* @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
|
|
2909
|
-
* @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
|
|
2910
|
-
* @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
|
|
2911
|
-
* @property {string | string[]} [subpageTarget] - Text used to match/rank subpages in the returned subpage list. You could use "about" to get *about* page for websites. Note that this is a fuzzy matcher.
|
|
2912
|
-
* @property {ExtrasOptions} [extras] - Miscelleneous data derived from results
|
|
2913
|
-
*/
|
|
2914
|
-
type ContentsOptions = {
|
|
2915
|
-
text?: TextContentsOptions | true;
|
|
2916
|
-
highlights?: HighlightsContentsOptions | true;
|
|
2917
|
-
summary?: SummaryContentsOptions | true;
|
|
2918
|
-
livecrawl?: LivecrawlOptions;
|
|
2919
|
-
context?: ContextOptions | true;
|
|
2920
|
-
livecrawlTimeout?: number;
|
|
2921
|
-
filterEmptyResults?: boolean;
|
|
2922
|
-
subpages?: number;
|
|
2923
|
-
subpageTarget?: string | string[];
|
|
2924
|
-
extras?: ExtrasOptions;
|
|
2925
|
-
} & (typeof isBeta extends true ? {} : {});
|
|
2926
3047
|
/**
|
|
2927
3048
|
* Options for livecrawling contents
|
|
2928
3049
|
* @typedef {string} LivecrawlOptions
|
|
@@ -2938,20 +3059,6 @@ type TextContentsOptions = {
|
|
|
2938
3059
|
maxCharacters?: number;
|
|
2939
3060
|
includeHtmlTags?: boolean;
|
|
2940
3061
|
};
|
|
2941
|
-
/**
|
|
2942
|
-
* Options for retrieving highlights from page.
|
|
2943
|
-
* NOTE: For search type "deep", these options will not be respected. Highlights will be generated with respect
|
|
2944
|
-
* to your initial query, and may vary in quantity and length.
|
|
2945
|
-
* @typedef {Object} HighlightsContentsOptions
|
|
2946
|
-
* @property {string} [query] - The query string to use for highlights search.
|
|
2947
|
-
* @property {number} [numSentences] - The number of sentences to return for each highlight.
|
|
2948
|
-
* @property {number} [highlightsPerUrl] - The number of highlights to return for each URL.
|
|
2949
|
-
*/
|
|
2950
|
-
type HighlightsContentsOptions = {
|
|
2951
|
-
query?: string;
|
|
2952
|
-
numSentences?: number;
|
|
2953
|
-
highlightsPerUrl?: number;
|
|
2954
|
-
};
|
|
2955
3062
|
/**
|
|
2956
3063
|
* Options for retrieving summary from page.
|
|
2957
3064
|
* @typedef {Object} SummaryContentsOptions
|
|
@@ -2982,15 +3089,6 @@ type ContextOptions = {
|
|
|
2982
3089
|
type TextResponse = {
|
|
2983
3090
|
text: string;
|
|
2984
3091
|
};
|
|
2985
|
-
/**
|
|
2986
|
-
* @typedef {Object} HighlightsResponse
|
|
2987
|
-
* @property {string[]} highlights - The highlights as an array of strings.
|
|
2988
|
-
* @property {number[]} highlightScores - The corresponding scores as an array of floats, 0 to 1
|
|
2989
|
-
*/
|
|
2990
|
-
type HighlightsResponse = {
|
|
2991
|
-
highlights: string[];
|
|
2992
|
-
highlightScores: number[];
|
|
2993
|
-
};
|
|
2994
3092
|
/**
|
|
2995
3093
|
* @typedef {Object} SummaryResponse
|
|
2996
3094
|
* @property {string} summary - The generated summary of the page content.
|
|
@@ -3019,22 +3117,20 @@ type SubpagesResponse<T extends ContentsOptions> = {
|
|
|
3019
3117
|
type Default<T extends {}, U> = [keyof T] extends [never] ? U : T;
|
|
3020
3118
|
/**
|
|
3021
3119
|
* @typedef {Object} ContentsResultComponent
|
|
3022
|
-
* Depending on 'ContentsOptions', this yields a combination of 'TextResponse', '
|
|
3120
|
+
* Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'SummaryResponse', or an empty object.
|
|
3023
3121
|
*
|
|
3024
3122
|
* @template T - A type extending from 'ContentsOptions'.
|
|
3025
3123
|
*/
|
|
3026
|
-
type ContentsResultComponent<T extends ContentsOptions> =
|
|
3124
|
+
type ContentsResultComponent<T extends ContentsOptions> = (T["text"] extends object | true ? TextResponse : {}) & (T["summary"] extends object | true ? SummaryResponse : {}) & (T["subpages"] extends number ? SubpagesResponse<T> : {}) & (T["extras"] extends object ? ExtrasResponse : {});
|
|
3027
3125
|
/**
|
|
3028
3126
|
* Represents the cost breakdown related to contents retrieval. Fields are optional because
|
|
3029
3127
|
* only non-zero costs are included.
|
|
3030
3128
|
* @typedef {Object} CostDollarsContents
|
|
3031
3129
|
* @property {number} [text] - The cost in dollars for retrieving text.
|
|
3032
|
-
* @property {number} [highlights] - The cost in dollars for retrieving highlights.
|
|
3033
3130
|
* @property {number} [summary] - The cost in dollars for retrieving summary.
|
|
3034
3131
|
*/
|
|
3035
3132
|
type CostDollarsContents = {
|
|
3036
3133
|
text?: number;
|
|
3037
|
-
highlights?: number;
|
|
3038
3134
|
summary?: number;
|
|
3039
3135
|
};
|
|
3040
3136
|
/**
|
|
@@ -3087,7 +3183,6 @@ type SearchResult<T extends ContentsOptions> = {
|
|
|
3087
3183
|
* @typedef {Object} SearchResponse
|
|
3088
3184
|
* @property {Result[]} results - The list of search results.
|
|
3089
3185
|
* @property {string} [context] - The context for the search.
|
|
3090
|
-
* @property {string} [autopromptString] - The autoprompt string, if applicable.
|
|
3091
3186
|
* @property {string} [autoDate] - The autoprompt date, if applicable.
|
|
3092
3187
|
* @property {string} requestId - The request ID for the search.
|
|
3093
3188
|
* @property {CostDollars} [costDollars] - The cost breakdown for this request.
|
|
@@ -3095,7 +3190,6 @@ type SearchResult<T extends ContentsOptions> = {
|
|
|
3095
3190
|
type SearchResponse<T extends ContentsOptions> = {
|
|
3096
3191
|
results: SearchResult<T>[];
|
|
3097
3192
|
context?: string;
|
|
3098
|
-
autopromptString?: string;
|
|
3099
3193
|
autoDate?: string;
|
|
3100
3194
|
requestId: string;
|
|
3101
3195
|
statuses?: Array<Status>;
|
|
@@ -3219,13 +3313,55 @@ declare class Exa {
|
|
|
3219
3313
|
rawRequest(endpoint: string, method?: string, body?: Record<string, unknown>, queryParams?: Record<string, string | number | boolean | string[] | undefined>): Promise<Response>;
|
|
3220
3314
|
/**
|
|
3221
3315
|
* Performs a search with an Exa prompt-engineered query.
|
|
3316
|
+
* By default, returns text contents. Use contents: false to opt-out.
|
|
3317
|
+
*
|
|
3318
|
+
* @param {string} query - The query string.
|
|
3319
|
+
* @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of relevant search results with text contents.
|
|
3320
|
+
*/
|
|
3321
|
+
search(query: string): Promise<SearchResponse<{
|
|
3322
|
+
text: {
|
|
3323
|
+
maxCharacters: 10_000;
|
|
3324
|
+
};
|
|
3325
|
+
}>>;
|
|
3326
|
+
/**
|
|
3327
|
+
* Performs a search without contents.
|
|
3328
|
+
*
|
|
3329
|
+
* @param {string} query - The query string.
|
|
3330
|
+
* @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled
|
|
3331
|
+
* @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.
|
|
3332
|
+
*/
|
|
3333
|
+
search(query: string, options: RegularSearchOptions & {
|
|
3334
|
+
contents: false | null | undefined;
|
|
3335
|
+
}): Promise<SearchResponse<{}>>;
|
|
3336
|
+
/**
|
|
3337
|
+
* Performs a search with specific contents.
|
|
3338
|
+
*
|
|
3339
|
+
* @param {string} query - The query string.
|
|
3340
|
+
* @param {RegularSearchOptions & { contents: T }} options - Search options with specific contents
|
|
3341
|
+
* @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.
|
|
3342
|
+
*/
|
|
3343
|
+
search<T extends ContentsOptions>(query: string, options: RegularSearchOptions & {
|
|
3344
|
+
contents: T;
|
|
3345
|
+
}): Promise<SearchResponse<T>>;
|
|
3346
|
+
/**
|
|
3347
|
+
* Performs a search with an Exa prompt-engineered query.
|
|
3348
|
+
* When no contents option is specified, returns text contents by default.
|
|
3222
3349
|
*
|
|
3223
3350
|
* @param {string} query - The query string.
|
|
3224
|
-
* @param {RegularSearchOptions}
|
|
3225
|
-
* @returns {Promise<SearchResponse<{}>>} A list of relevant search results.
|
|
3351
|
+
* @param {Omit<RegularSearchOptions, 'contents'>} options - Search options without contents
|
|
3352
|
+
* @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
|
|
3226
3353
|
*/
|
|
3227
|
-
search(query: string, options
|
|
3354
|
+
search(query: string, options: Omit<RegularSearchOptions, "contents">): Promise<SearchResponse<{
|
|
3355
|
+
text: true;
|
|
3356
|
+
}>>;
|
|
3228
3357
|
/**
|
|
3358
|
+
* @deprecated Use `search()` instead. The search method now returns text contents by default.
|
|
3359
|
+
*
|
|
3360
|
+
* Migration examples:
|
|
3361
|
+
* - `searchAndContents(query)` → `search(query)`
|
|
3362
|
+
* - `searchAndContents(query, { text: true })` → `search(query, { contents: { text: true } })`
|
|
3363
|
+
* - `searchAndContents(query, { summary: true })` → `search(query, { contents: { summary: true } })`
|
|
3364
|
+
*
|
|
3229
3365
|
* Performs a search with an Exa prompt-engineered query and returns the contents of the documents.
|
|
3230
3366
|
*
|
|
3231
3367
|
* @param {string} query - The query string.
|
|
@@ -3235,12 +3371,55 @@ declare class Exa {
|
|
|
3235
3371
|
searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T): Promise<SearchResponse<T>>;
|
|
3236
3372
|
/**
|
|
3237
3373
|
* Finds similar links to the provided URL.
|
|
3374
|
+
* By default, returns text contents. Use contents: false to opt-out.
|
|
3375
|
+
*
|
|
3376
|
+
* @param {string} url - The URL for which to find similar links.
|
|
3377
|
+
* @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of similar search results with text contents.
|
|
3378
|
+
*/
|
|
3379
|
+
findSimilar(url: string): Promise<SearchResponse<{
|
|
3380
|
+
text: {
|
|
3381
|
+
maxCharacters: 10_000;
|
|
3382
|
+
};
|
|
3383
|
+
}>>;
|
|
3384
|
+
/**
|
|
3385
|
+
* Finds similar links to the provided URL without contents.
|
|
3386
|
+
*
|
|
3387
|
+
* @param {string} url - The URL for which to find similar links.
|
|
3388
|
+
* @param {FindSimilarOptions & { contents: false }} options - Options with contents explicitly disabled
|
|
3389
|
+
* @returns {Promise<SearchResponse<{}>>} A list of similar search results without contents.
|
|
3390
|
+
*/
|
|
3391
|
+
findSimilar(url: string, options: FindSimilarOptions & {
|
|
3392
|
+
contents: false | null | undefined;
|
|
3393
|
+
}): Promise<SearchResponse<{}>>;
|
|
3394
|
+
/**
|
|
3395
|
+
* Finds similar links to the provided URL with specific contents.
|
|
3396
|
+
*
|
|
3397
|
+
* @param {string} url - The URL for which to find similar links.
|
|
3398
|
+
* @param {FindSimilarOptions & { contents: T }} options - Options with specific contents
|
|
3399
|
+
* @returns {Promise<SearchResponse<T>>} A list of similar search results with requested contents.
|
|
3400
|
+
*/
|
|
3401
|
+
findSimilar<T extends ContentsOptions>(url: string, options: FindSimilarOptions & {
|
|
3402
|
+
contents: T;
|
|
3403
|
+
}): Promise<SearchResponse<T>>;
|
|
3404
|
+
/**
|
|
3405
|
+
* Finds similar links to the provided URL.
|
|
3406
|
+
* When no contents option is specified, returns text contents by default.
|
|
3407
|
+
*
|
|
3238
3408
|
* @param {string} url - The URL for which to find similar links.
|
|
3239
|
-
* @param {FindSimilarOptions}
|
|
3240
|
-
* @returns {Promise<SearchResponse<{}>>} A list of similar search results.
|
|
3409
|
+
* @param {Omit<FindSimilarOptions, 'contents'>} options - Options without contents
|
|
3410
|
+
* @returns {Promise<SearchResponse<{ text: true }>>} A list of similar search results with text contents.
|
|
3241
3411
|
*/
|
|
3242
|
-
findSimilar(url: string, options
|
|
3412
|
+
findSimilar(url: string, options: Omit<FindSimilarOptions, "contents">): Promise<SearchResponse<{
|
|
3413
|
+
text: true;
|
|
3414
|
+
}>>;
|
|
3243
3415
|
/**
|
|
3416
|
+
* @deprecated Use `findSimilar()` instead. The findSimilar method now returns text contents by default.
|
|
3417
|
+
*
|
|
3418
|
+
* Migration examples:
|
|
3419
|
+
* - `findSimilarAndContents(url)` → `findSimilar(url)`
|
|
3420
|
+
* - `findSimilarAndContents(url, { text: true })` → `findSimilar(url, { contents: { text: true } })`
|
|
3421
|
+
* - `findSimilarAndContents(url, { summary: true })` → `findSimilar(url, { contents: { summary: true } })`
|
|
3422
|
+
*
|
|
3244
3423
|
* Finds similar links to the provided URL and returns the contents of the documents.
|
|
3245
3424
|
* @param {string} url - The URL for which to find similar links.
|
|
3246
3425
|
* @param {FindSimilarOptions & T} [options] - Additional options for finding similar links + contents.
|
|
@@ -3320,4 +3499,4 @@ declare class Exa {
|
|
|
3320
3499
|
private parseSSEStream;
|
|
3321
3500
|
}
|
|
3322
3501
|
|
|
3323
|
-
export { type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type Default, type EnrichmentResult, type Entity, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse,
|
|
3502
|
+
export { type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type ArticleEntity, type BaseSearchOptions, type CompanyEntity, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, type Default, type EnrichmentResult, type Entity, type Event, EventType, EventsClient, Exa, ExaError, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetWebsetResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type SearchResponse, type SearchResult, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
|