exa-js 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -155
- package/dist/index.d.mts +53 -9
- package/dist/index.d.ts +53 -9
- package/dist/index.js +99 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,213 +1,145 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Exa JavaScript SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/exa-js)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
features associated with Metaphor's rename to Exa. New site is https://exa.ai
|
|
5
|
+
The official JavaScript SDK for [Exa](https://exa.ai), the web search API built for AI.
|
|
7
6
|
|
|
8
|
-
https://
|
|
7
|
+
[Documentation](https://docs.exa.ai) | [Dashboard](https://dashboard.exa.ai)
|
|
9
8
|
|
|
10
|
-
##
|
|
9
|
+
## Install
|
|
11
10
|
|
|
12
|
-
```
|
|
11
|
+
```bash
|
|
13
12
|
npm install exa-js
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
##
|
|
15
|
+
## Quick Start
|
|
17
16
|
|
|
18
|
-
```
|
|
17
|
+
```ts
|
|
19
18
|
import Exa from "exa-js";
|
|
20
19
|
|
|
21
20
|
const exa = new Exa(process.env.EXA_API_KEY);
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
### Common commands
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
// Basic search
|
|
28
|
-
const basicResults = await exa.search("This is a Exa query:");
|
|
29
|
-
|
|
30
|
-
// Search with date filters
|
|
31
|
-
const dateFilteredResults = await exa.search("This is a Exa query:", {
|
|
32
|
-
startPublishedDate: "2019-01-01",
|
|
33
|
-
endPublishedDate: "2019-01-31",
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Search with domain filters
|
|
37
|
-
const domainFilteredResults = await exa.search("This is a Exa query:", {
|
|
38
|
-
includeDomains: ["www.cnn.com", "www.nytimes.com"],
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Search and get text contents
|
|
42
|
-
const searchAndTextResults = await exa.searchAndContents(
|
|
43
|
-
"This is a Exa query:",
|
|
44
|
-
{ text: true }
|
|
45
|
-
);
|
|
46
21
|
|
|
47
|
-
// Search
|
|
48
|
-
const
|
|
49
|
-
"
|
|
22
|
+
// Search the web
|
|
23
|
+
const result = await exa.search(
|
|
24
|
+
"blog post about artificial intelligence",
|
|
50
25
|
{
|
|
51
|
-
|
|
26
|
+
type: "auto",
|
|
27
|
+
contents: {
|
|
28
|
+
text: true
|
|
29
|
+
}
|
|
52
30
|
}
|
|
53
31
|
);
|
|
54
32
|
|
|
55
|
-
// Find similar
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// Find similar with contents
|
|
65
|
-
const similarWithContentsResults = await exa.findSimilarAndContents(
|
|
66
|
-
"https://example.com",
|
|
67
|
-
{ text: true }
|
|
33
|
+
// Find similar pages
|
|
34
|
+
const result = await exa.findSimilar(
|
|
35
|
+
"https://paulgraham.com/greatwork.html",
|
|
36
|
+
{
|
|
37
|
+
contents: {
|
|
38
|
+
text: true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
68
41
|
);
|
|
69
42
|
|
|
70
|
-
// Get
|
|
71
|
-
const
|
|
43
|
+
// Get answers with citations
|
|
44
|
+
const { answer } = await exa.answer("What is the capital of France?");
|
|
45
|
+
```
|
|
72
46
|
|
|
73
|
-
|
|
74
|
-
const customContentsResults = await exa.getContents(["urls"], {
|
|
75
|
-
text: { includeHtmlTags: true, maxCharacters: 3000 },
|
|
76
|
-
});
|
|
47
|
+
## Search
|
|
77
48
|
|
|
78
|
-
|
|
79
|
-
const answerResult = await exa.answer(
|
|
80
|
-
"What is the population of New York City?"
|
|
81
|
-
);
|
|
49
|
+
Find webpages using natural language queries.
|
|
82
50
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (chunk.citations) {
|
|
91
|
-
console.log("\nCitations:", chunk.citations);
|
|
51
|
+
```ts
|
|
52
|
+
const result = await exa.search("interesting articles about space", {
|
|
53
|
+
numResults: 10,
|
|
54
|
+
includeDomains: ["nasa.gov", "space.com"],
|
|
55
|
+
startPublishedDate: "2024-01-01",
|
|
56
|
+
contents: {
|
|
57
|
+
text: true
|
|
92
58
|
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Get an answer with output schema
|
|
96
|
-
const answerResult = await exa.answer(
|
|
97
|
-
"What is the population of New York City?",
|
|
98
|
-
{
|
|
99
|
-
outputSchema: {
|
|
100
|
-
type: "object",
|
|
101
|
-
required: ["answer"],
|
|
102
|
-
additionalProperties: false,
|
|
103
|
-
properties: {
|
|
104
|
-
answer: {
|
|
105
|
-
type: "number",
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
}
|
|
110
|
-
);
|
|
59
|
+
});
|
|
111
60
|
```
|
|
112
61
|
|
|
113
|
-
|
|
62
|
+
## Contents
|
|
114
63
|
|
|
115
|
-
|
|
64
|
+
Get clean text, highlights, or summaries from any URL.
|
|
116
65
|
|
|
117
|
-
```
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
66
|
+
```ts
|
|
67
|
+
const { results } = await exa.getContents(["https://openai.com/research"], {
|
|
68
|
+
text: true,
|
|
69
|
+
highlights: true,
|
|
70
|
+
summary: true,
|
|
122
71
|
});
|
|
123
72
|
```
|
|
124
73
|
|
|
125
|
-
|
|
74
|
+
## Find Similar
|
|
126
75
|
|
|
127
|
-
|
|
76
|
+
Discover pages similar to a given URL.
|
|
128
77
|
|
|
129
|
-
```
|
|
130
|
-
const
|
|
131
|
-
"https://
|
|
78
|
+
```ts
|
|
79
|
+
const result = await exa.findSimilar(
|
|
80
|
+
"https://paulgraham.com/greatwork.html",
|
|
132
81
|
{
|
|
133
82
|
numResults: 10,
|
|
83
|
+
excludeSourceDomain: true,
|
|
84
|
+
contents: {
|
|
85
|
+
text: true
|
|
86
|
+
}
|
|
134
87
|
}
|
|
135
88
|
);
|
|
136
89
|
```
|
|
137
90
|
|
|
138
|
-
|
|
91
|
+
## Answer
|
|
139
92
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const response = await exa.getContents([
|
|
144
|
-
"https://blog.samaltman.com/how-to-be-successful",
|
|
145
|
-
]);
|
|
93
|
+
```ts
|
|
94
|
+
const response = await exa.answer("What caused the 2008 financial crisis?");
|
|
95
|
+
console.log(response.answer);
|
|
146
96
|
```
|
|
147
97
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Generates an answer to a query using search results as context.
|
|
151
|
-
|
|
152
|
-
```javascript
|
|
153
|
-
const response = await exa.answer("What is the population of New York City?", {
|
|
154
|
-
text: true,
|
|
155
|
-
});
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### `exa.streamAnswer(query: string, options?: { text?: boolean }): AsyncGenerator<AnswerStreamChunk>`
|
|
159
|
-
|
|
160
|
-
Streams an answer as it's being generated, yielding chunks of text and citations. This is useful for providing real-time updates in chat interfaces or displaying partial results as they become available.
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
// Basic streaming example
|
|
164
|
-
for await (const chunk of exa.streamAnswer("What is quantum computing?")) {
|
|
98
|
+
```ts
|
|
99
|
+
for await (const chunk of exa.streamAnswer("Explain quantum computing")) {
|
|
165
100
|
if (chunk.content) {
|
|
166
101
|
process.stdout.write(chunk.content);
|
|
167
102
|
}
|
|
168
|
-
if (chunk.citations) {
|
|
169
|
-
console.log("\nCitations:", chunk.citations);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
for await (const chunk of exa.streamAnswer("What is quantum computing?", {
|
|
174
|
-
text: true,
|
|
175
|
-
})) {
|
|
176
103
|
}
|
|
177
104
|
```
|
|
178
105
|
|
|
179
|
-
|
|
106
|
+
## Research
|
|
180
107
|
|
|
181
|
-
|
|
182
|
-
- `citations`: An array of citation objects containing source information
|
|
108
|
+
Run autonomous research tasks that return structured data.
|
|
183
109
|
|
|
184
|
-
|
|
110
|
+
```ts
|
|
111
|
+
const { researchId } = await exa.research.create({
|
|
112
|
+
instructions: "Find the top 5 AI startups founded in 2024",
|
|
113
|
+
outputSchema: {
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
startups: { type: "array", items: { type: "string" } },
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const result = await exa.research.pollUntilFinished(researchId);
|
|
122
|
+
```
|
|
185
123
|
|
|
186
|
-
|
|
124
|
+
## TypeScript
|
|
187
125
|
|
|
188
|
-
|
|
126
|
+
Full TypeScript support with types for all methods.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
189
129
|
import Exa from "exa-js";
|
|
130
|
+
import type { SearchResponse, RegularSearchOptions } from "exa-js";
|
|
131
|
+
```
|
|
190
132
|
|
|
191
|
-
|
|
133
|
+
## Links
|
|
192
134
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
properties: {
|
|
197
|
-
answer: { type: "string" },
|
|
198
|
-
},
|
|
199
|
-
additionalProperties: false,
|
|
200
|
-
};
|
|
135
|
+
- [Documentation](https://docs.exa.ai)
|
|
136
|
+
- [API Reference](https://docs.exa.ai/reference)
|
|
137
|
+
- [Examples](./examples)
|
|
201
138
|
|
|
202
|
-
|
|
203
|
-
instructions: "In ≤3 sentences, explain quantum computing.",
|
|
204
|
-
output: { schema },
|
|
205
|
-
});
|
|
206
|
-
const result = await exa.research.pollTask(taskId);
|
|
207
|
-
```
|
|
139
|
+
## Contributing
|
|
208
140
|
|
|
209
|
-
|
|
141
|
+
Pull requests welcome! For major changes, open an issue first.
|
|
210
142
|
|
|
211
|
-
|
|
143
|
+
## License
|
|
212
144
|
|
|
213
|
-
|
|
145
|
+
[MIT](LICENSE)
|
package/dist/index.d.mts
CHANGED
|
@@ -2473,6 +2473,18 @@ declare class EventsClient extends WebsetsBaseClient {
|
|
|
2473
2473
|
* @returns The Event
|
|
2474
2474
|
*/
|
|
2475
2475
|
get(id: string): Promise<Event>;
|
|
2476
|
+
/**
|
|
2477
|
+
* Iterate through all Events, handling pagination automatically
|
|
2478
|
+
* @param options Filtering and pagination options
|
|
2479
|
+
* @returns Async generator of Events
|
|
2480
|
+
*/
|
|
2481
|
+
listAll(options?: ListEventsOptions): AsyncGenerator<Event>;
|
|
2482
|
+
/**
|
|
2483
|
+
* Collect all Events into an array
|
|
2484
|
+
* @param options Filtering and pagination options
|
|
2485
|
+
* @returns Promise resolving to an array of all Events
|
|
2486
|
+
*/
|
|
2487
|
+
getAll(options?: ListEventsOptions): Promise<Event[]>;
|
|
2476
2488
|
}
|
|
2477
2489
|
|
|
2478
2490
|
/**
|
|
@@ -2567,6 +2579,18 @@ declare class ImportsClient extends WebsetsBaseClient {
|
|
|
2567
2579
|
* @throws Error if the Import does not complete within the timeout or fails
|
|
2568
2580
|
*/
|
|
2569
2581
|
waitUntilCompleted(id: string, options?: WaitUntilCompletedOptions): Promise<Import>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Iterate through all Imports, handling pagination automatically
|
|
2584
|
+
* @param options Pagination options
|
|
2585
|
+
* @returns Async generator of Imports
|
|
2586
|
+
*/
|
|
2587
|
+
listAll(options?: PaginationParams): AsyncGenerator<Import>;
|
|
2588
|
+
/**
|
|
2589
|
+
* Collect all Imports into an array
|
|
2590
|
+
* @param options Pagination options
|
|
2591
|
+
* @returns Promise resolving to an array of all Imports
|
|
2592
|
+
*/
|
|
2593
|
+
getAll(options?: PaginationParams): Promise<Import[]>;
|
|
2570
2594
|
}
|
|
2571
2595
|
|
|
2572
2596
|
/**
|
|
@@ -2695,6 +2719,18 @@ declare class WebsetMonitorsClient extends WebsetsBaseClient {
|
|
|
2695
2719
|
* @returns The deleted Monitor
|
|
2696
2720
|
*/
|
|
2697
2721
|
delete(id: string): Promise<Monitor>;
|
|
2722
|
+
/**
|
|
2723
|
+
* Iterate through all Monitors, handling pagination automatically
|
|
2724
|
+
* @param options Pagination and filtering options
|
|
2725
|
+
* @returns Async generator of Monitors
|
|
2726
|
+
*/
|
|
2727
|
+
listAll(options?: ListMonitorsOptions): AsyncGenerator<Monitor>;
|
|
2728
|
+
/**
|
|
2729
|
+
* Collect all Monitors into an array
|
|
2730
|
+
* @param options Pagination and filtering options
|
|
2731
|
+
* @returns Promise resolving to an array of all Monitors
|
|
2732
|
+
*/
|
|
2733
|
+
getAll(options?: ListMonitorsOptions): Promise<Monitor[]>;
|
|
2698
2734
|
}
|
|
2699
2735
|
|
|
2700
2736
|
/**
|
|
@@ -2994,11 +3030,9 @@ declare class ExaError extends Error {
|
|
|
2994
3030
|
* Options for retrieving page contents
|
|
2995
3031
|
* @typedef {Object} ContentsOptions
|
|
2996
3032
|
* @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
|
|
2997
|
-
* @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.
|
|
3033
|
+
* @property {HighlightsContentsOptions | boolean} [highlights] - Options for retrieving highlights. NOTE: For search type "deep", only "true" is allowed. "query", "maxCharacters", "numSentences" and "highlightsPerUrl" will not be respected.
|
|
2998
3034
|
* @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
|
|
2999
|
-
* @property {
|
|
3000
|
-
* @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
|
|
3001
|
-
* @property {number} [maxAgeHours] - Maximum age of indexed content in hours. If older, fetches with livecrawl. 0 = always livecrawl, -1 = never livecrawl (cache only). Cannot be used together with livecrawl.
|
|
3035
|
+
* @property {number} [maxAgeHours] - Maximum age of cached content in hours. If content is older, it will be fetched fresh. Special values: 0 = always fetch fresh content, -1 = never fetch fresh (use cached content only). Example: 168 = fetch fresh for pages older than 7 days.
|
|
3002
3036
|
* @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
|
|
3003
3037
|
* @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
|
|
3004
3038
|
* @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.
|
|
@@ -3126,9 +3160,9 @@ type SectionTag = "unspecified" | "header" | "navigation" | "banner" | "body" |
|
|
|
3126
3160
|
* @typedef {Object} TextContentsOptions
|
|
3127
3161
|
* @property {number} [maxCharacters] - The maximum number of characters to return.
|
|
3128
3162
|
* @property {boolean} [includeHtmlTags] - If true, includes HTML tags in the returned text. Default: false
|
|
3129
|
-
* @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: "compact". Requires
|
|
3130
|
-
* @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires
|
|
3131
|
-
* @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires
|
|
3163
|
+
* @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: "compact". Requires maxAgeHours: 0.
|
|
3164
|
+
* @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires maxAgeHours: 0.
|
|
3165
|
+
* @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires maxAgeHours: 0.
|
|
3132
3166
|
*/
|
|
3133
3167
|
type TextContentsOptions = {
|
|
3134
3168
|
maxCharacters?: number;
|
|
@@ -3143,12 +3177,16 @@ type TextContentsOptions = {
|
|
|
3143
3177
|
* to your initial query, and may vary in quantity and length.
|
|
3144
3178
|
* @typedef {Object} HighlightsContentsOptions
|
|
3145
3179
|
* @property {string} [query] - The query string to use for highlights search.
|
|
3146
|
-
* @property {number} [
|
|
3147
|
-
* @property {number} [
|
|
3180
|
+
* @property {number} [maxCharacters] - The maximum number of characters to return for highlights.
|
|
3181
|
+
* @property {number} [numSentences] - Deprecated. Use maxCharacters instead.
|
|
3182
|
+
* @property {number} [highlightsPerUrl] - Deprecated. Use maxCharacters instead.
|
|
3148
3183
|
*/
|
|
3149
3184
|
type HighlightsContentsOptions = {
|
|
3150
3185
|
query?: string;
|
|
3186
|
+
maxCharacters?: number;
|
|
3187
|
+
/** @deprecated Use maxCharacters instead */
|
|
3151
3188
|
numSentences?: number;
|
|
3189
|
+
/** @deprecated Use maxCharacters instead */
|
|
3152
3190
|
highlightsPerUrl?: number;
|
|
3153
3191
|
};
|
|
3154
3192
|
/**
|
|
@@ -3371,6 +3409,8 @@ type SearchResult<T extends ContentsOptions> = {
|
|
|
3371
3409
|
* @property {string} [autoDate] - The autoprompt date, if applicable.
|
|
3372
3410
|
* @property {string} requestId - The request ID for the search.
|
|
3373
3411
|
* @property {CostDollars} [costDollars] - The cost breakdown for this request.
|
|
3412
|
+
* @property {string} [resolvedSearchType] - The resolved search type ('neural' or 'keyword') when using 'auto' search.
|
|
3413
|
+
* @property {number} [searchTime] - Time taken for the search in milliseconds.
|
|
3374
3414
|
*/
|
|
3375
3415
|
type SearchResponse<T extends ContentsOptions> = {
|
|
3376
3416
|
results: SearchResult<T>[];
|
|
@@ -3379,6 +3419,8 @@ type SearchResponse<T extends ContentsOptions> = {
|
|
|
3379
3419
|
requestId: string;
|
|
3380
3420
|
statuses?: Array<Status>;
|
|
3381
3421
|
costDollars?: CostDollars;
|
|
3422
|
+
resolvedSearchType?: string;
|
|
3423
|
+
searchTime?: number;
|
|
3382
3424
|
};
|
|
3383
3425
|
type Status = {
|
|
3384
3426
|
id: string;
|
|
@@ -3654,6 +3696,7 @@ declare class Exa {
|
|
|
3654
3696
|
model?: "exa" | "exa-pro";
|
|
3655
3697
|
systemPrompt?: string;
|
|
3656
3698
|
outputSchema: ZodSchema<T>;
|
|
3699
|
+
userLocation?: string;
|
|
3657
3700
|
}): AsyncGenerator<AnswerStreamChunk>;
|
|
3658
3701
|
/**
|
|
3659
3702
|
* Stream an answer as an async generator
|
|
@@ -3679,6 +3722,7 @@ declare class Exa {
|
|
|
3679
3722
|
model?: "exa" | "exa-pro";
|
|
3680
3723
|
systemPrompt?: string;
|
|
3681
3724
|
outputSchema?: Record<string, unknown>;
|
|
3725
|
+
userLocation?: string;
|
|
3682
3726
|
}): AsyncGenerator<AnswerStreamChunk>;
|
|
3683
3727
|
private processChunk;
|
|
3684
3728
|
private parseSSEStream;
|
package/dist/index.d.ts
CHANGED
|
@@ -2473,6 +2473,18 @@ declare class EventsClient extends WebsetsBaseClient {
|
|
|
2473
2473
|
* @returns The Event
|
|
2474
2474
|
*/
|
|
2475
2475
|
get(id: string): Promise<Event>;
|
|
2476
|
+
/**
|
|
2477
|
+
* Iterate through all Events, handling pagination automatically
|
|
2478
|
+
* @param options Filtering and pagination options
|
|
2479
|
+
* @returns Async generator of Events
|
|
2480
|
+
*/
|
|
2481
|
+
listAll(options?: ListEventsOptions): AsyncGenerator<Event>;
|
|
2482
|
+
/**
|
|
2483
|
+
* Collect all Events into an array
|
|
2484
|
+
* @param options Filtering and pagination options
|
|
2485
|
+
* @returns Promise resolving to an array of all Events
|
|
2486
|
+
*/
|
|
2487
|
+
getAll(options?: ListEventsOptions): Promise<Event[]>;
|
|
2476
2488
|
}
|
|
2477
2489
|
|
|
2478
2490
|
/**
|
|
@@ -2567,6 +2579,18 @@ declare class ImportsClient extends WebsetsBaseClient {
|
|
|
2567
2579
|
* @throws Error if the Import does not complete within the timeout or fails
|
|
2568
2580
|
*/
|
|
2569
2581
|
waitUntilCompleted(id: string, options?: WaitUntilCompletedOptions): Promise<Import>;
|
|
2582
|
+
/**
|
|
2583
|
+
* Iterate through all Imports, handling pagination automatically
|
|
2584
|
+
* @param options Pagination options
|
|
2585
|
+
* @returns Async generator of Imports
|
|
2586
|
+
*/
|
|
2587
|
+
listAll(options?: PaginationParams): AsyncGenerator<Import>;
|
|
2588
|
+
/**
|
|
2589
|
+
* Collect all Imports into an array
|
|
2590
|
+
* @param options Pagination options
|
|
2591
|
+
* @returns Promise resolving to an array of all Imports
|
|
2592
|
+
*/
|
|
2593
|
+
getAll(options?: PaginationParams): Promise<Import[]>;
|
|
2570
2594
|
}
|
|
2571
2595
|
|
|
2572
2596
|
/**
|
|
@@ -2695,6 +2719,18 @@ declare class WebsetMonitorsClient extends WebsetsBaseClient {
|
|
|
2695
2719
|
* @returns The deleted Monitor
|
|
2696
2720
|
*/
|
|
2697
2721
|
delete(id: string): Promise<Monitor>;
|
|
2722
|
+
/**
|
|
2723
|
+
* Iterate through all Monitors, handling pagination automatically
|
|
2724
|
+
* @param options Pagination and filtering options
|
|
2725
|
+
* @returns Async generator of Monitors
|
|
2726
|
+
*/
|
|
2727
|
+
listAll(options?: ListMonitorsOptions): AsyncGenerator<Monitor>;
|
|
2728
|
+
/**
|
|
2729
|
+
* Collect all Monitors into an array
|
|
2730
|
+
* @param options Pagination and filtering options
|
|
2731
|
+
* @returns Promise resolving to an array of all Monitors
|
|
2732
|
+
*/
|
|
2733
|
+
getAll(options?: ListMonitorsOptions): Promise<Monitor[]>;
|
|
2698
2734
|
}
|
|
2699
2735
|
|
|
2700
2736
|
/**
|
|
@@ -2994,11 +3030,9 @@ declare class ExaError extends Error {
|
|
|
2994
3030
|
* Options for retrieving page contents
|
|
2995
3031
|
* @typedef {Object} ContentsOptions
|
|
2996
3032
|
* @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
|
|
2997
|
-
* @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.
|
|
3033
|
+
* @property {HighlightsContentsOptions | boolean} [highlights] - Options for retrieving highlights. NOTE: For search type "deep", only "true" is allowed. "query", "maxCharacters", "numSentences" and "highlightsPerUrl" will not be respected.
|
|
2998
3034
|
* @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
|
|
2999
|
-
* @property {
|
|
3000
|
-
* @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
|
|
3001
|
-
* @property {number} [maxAgeHours] - Maximum age of indexed content in hours. If older, fetches with livecrawl. 0 = always livecrawl, -1 = never livecrawl (cache only). Cannot be used together with livecrawl.
|
|
3035
|
+
* @property {number} [maxAgeHours] - Maximum age of cached content in hours. If content is older, it will be fetched fresh. Special values: 0 = always fetch fresh content, -1 = never fetch fresh (use cached content only). Example: 168 = fetch fresh for pages older than 7 days.
|
|
3002
3036
|
* @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
|
|
3003
3037
|
* @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
|
|
3004
3038
|
* @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.
|
|
@@ -3126,9 +3160,9 @@ type SectionTag = "unspecified" | "header" | "navigation" | "banner" | "body" |
|
|
|
3126
3160
|
* @typedef {Object} TextContentsOptions
|
|
3127
3161
|
* @property {number} [maxCharacters] - The maximum number of characters to return.
|
|
3128
3162
|
* @property {boolean} [includeHtmlTags] - If true, includes HTML tags in the returned text. Default: false
|
|
3129
|
-
* @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: "compact". Requires
|
|
3130
|
-
* @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires
|
|
3131
|
-
* @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires
|
|
3163
|
+
* @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: "compact". Requires maxAgeHours: 0.
|
|
3164
|
+
* @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires maxAgeHours: 0.
|
|
3165
|
+
* @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires maxAgeHours: 0.
|
|
3132
3166
|
*/
|
|
3133
3167
|
type TextContentsOptions = {
|
|
3134
3168
|
maxCharacters?: number;
|
|
@@ -3143,12 +3177,16 @@ type TextContentsOptions = {
|
|
|
3143
3177
|
* to your initial query, and may vary in quantity and length.
|
|
3144
3178
|
* @typedef {Object} HighlightsContentsOptions
|
|
3145
3179
|
* @property {string} [query] - The query string to use for highlights search.
|
|
3146
|
-
* @property {number} [
|
|
3147
|
-
* @property {number} [
|
|
3180
|
+
* @property {number} [maxCharacters] - The maximum number of characters to return for highlights.
|
|
3181
|
+
* @property {number} [numSentences] - Deprecated. Use maxCharacters instead.
|
|
3182
|
+
* @property {number} [highlightsPerUrl] - Deprecated. Use maxCharacters instead.
|
|
3148
3183
|
*/
|
|
3149
3184
|
type HighlightsContentsOptions = {
|
|
3150
3185
|
query?: string;
|
|
3186
|
+
maxCharacters?: number;
|
|
3187
|
+
/** @deprecated Use maxCharacters instead */
|
|
3151
3188
|
numSentences?: number;
|
|
3189
|
+
/** @deprecated Use maxCharacters instead */
|
|
3152
3190
|
highlightsPerUrl?: number;
|
|
3153
3191
|
};
|
|
3154
3192
|
/**
|
|
@@ -3371,6 +3409,8 @@ type SearchResult<T extends ContentsOptions> = {
|
|
|
3371
3409
|
* @property {string} [autoDate] - The autoprompt date, if applicable.
|
|
3372
3410
|
* @property {string} requestId - The request ID for the search.
|
|
3373
3411
|
* @property {CostDollars} [costDollars] - The cost breakdown for this request.
|
|
3412
|
+
* @property {string} [resolvedSearchType] - The resolved search type ('neural' or 'keyword') when using 'auto' search.
|
|
3413
|
+
* @property {number} [searchTime] - Time taken for the search in milliseconds.
|
|
3374
3414
|
*/
|
|
3375
3415
|
type SearchResponse<T extends ContentsOptions> = {
|
|
3376
3416
|
results: SearchResult<T>[];
|
|
@@ -3379,6 +3419,8 @@ type SearchResponse<T extends ContentsOptions> = {
|
|
|
3379
3419
|
requestId: string;
|
|
3380
3420
|
statuses?: Array<Status>;
|
|
3381
3421
|
costDollars?: CostDollars;
|
|
3422
|
+
resolvedSearchType?: string;
|
|
3423
|
+
searchTime?: number;
|
|
3382
3424
|
};
|
|
3383
3425
|
type Status = {
|
|
3384
3426
|
id: string;
|
|
@@ -3654,6 +3696,7 @@ declare class Exa {
|
|
|
3654
3696
|
model?: "exa" | "exa-pro";
|
|
3655
3697
|
systemPrompt?: string;
|
|
3656
3698
|
outputSchema: ZodSchema<T>;
|
|
3699
|
+
userLocation?: string;
|
|
3657
3700
|
}): AsyncGenerator<AnswerStreamChunk>;
|
|
3658
3701
|
/**
|
|
3659
3702
|
* Stream an answer as an async generator
|
|
@@ -3679,6 +3722,7 @@ declare class Exa {
|
|
|
3679
3722
|
model?: "exa" | "exa-pro";
|
|
3680
3723
|
systemPrompt?: string;
|
|
3681
3724
|
outputSchema?: Record<string, unknown>;
|
|
3725
|
+
userLocation?: string;
|
|
3682
3726
|
}): AsyncGenerator<AnswerStreamChunk>;
|
|
3683
3727
|
private processChunk;
|
|
3684
3728
|
private parseSSEStream;
|