exa-js 1.10.2 → 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 CHANGED
@@ -2965,10 +2965,33 @@ declare class ExaError extends Error {
2965
2965
  constructor(message: string, statusCode: number, timestamp?: string, path?: string);
2966
2966
  }
2967
2967
 
2968
- declare const isBeta = false;
2969
2968
  /**
2970
- * Search options for performing a search query.
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
2971
2993
  * @typedef {Object} SearchOptions
2994
+ * @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
2972
2995
  * @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans.
2973
2996
  * @property {string[]} [includeDomains] - List of domains to include in the search.
2974
2997
  * @property {string[]} [excludeDomains] - List of domains to exclude in the search.
@@ -2983,6 +3006,7 @@ declare const isBeta = false;
2983
3006
  * @property {string} [userLocation] - The two-letter ISO country code of the user, e.g. US.
2984
3007
  */
2985
3008
  type BaseSearchOptions = {
3009
+ contents?: ContentsOptions;
2986
3010
  numResults?: number;
2987
3011
  includeDomains?: string[];
2988
3012
  excludeDomains?: string[];
@@ -3020,31 +3044,6 @@ type ExtrasOptions = {
3020
3044
  links?: number;
3021
3045
  imageLinks?: number;
3022
3046
  };
3023
- /**
3024
- * Search options for performing a search query.
3025
- * @typedef {Object} ContentsOptions
3026
- * @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
3027
- * @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;
3028
- * @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
3029
- * @property {LivecrawlOptions} [livecrawl] - Options for livecrawling contents. Default is "never" for neural/auto search, "fallback" for keyword search.
3030
- * @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
3031
- * @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
3032
- * @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
3033
- * @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.
3034
- * @property {ExtrasOptions} [extras] - Miscelleneous data derived from results
3035
- */
3036
- type ContentsOptions = {
3037
- text?: TextContentsOptions | true;
3038
- highlights?: HighlightsContentsOptions | true;
3039
- summary?: SummaryContentsOptions | true;
3040
- livecrawl?: LivecrawlOptions;
3041
- context?: ContextOptions | true;
3042
- livecrawlTimeout?: number;
3043
- filterEmptyResults?: boolean;
3044
- subpages?: number;
3045
- subpageTarget?: string | string[];
3046
- extras?: ExtrasOptions;
3047
- } & (typeof isBeta extends true ? {} : {});
3048
3047
  /**
3049
3048
  * Options for livecrawling contents
3050
3049
  * @typedef {string} LivecrawlOptions
@@ -3060,20 +3059,6 @@ type TextContentsOptions = {
3060
3059
  maxCharacters?: number;
3061
3060
  includeHtmlTags?: boolean;
3062
3061
  };
3063
- /**
3064
- * Options for retrieving highlights from page.
3065
- * NOTE: For search type "deep", these options will not be respected. Highlights will be generated with respect
3066
- * to your initial query, and may vary in quantity and length.
3067
- * @typedef {Object} HighlightsContentsOptions
3068
- * @property {string} [query] - The query string to use for highlights search.
3069
- * @property {number} [numSentences] - The number of sentences to return for each highlight.
3070
- * @property {number} [highlightsPerUrl] - The number of highlights to return for each URL.
3071
- */
3072
- type HighlightsContentsOptions = {
3073
- query?: string;
3074
- numSentences?: number;
3075
- highlightsPerUrl?: number;
3076
- };
3077
3062
  /**
3078
3063
  * Options for retrieving summary from page.
3079
3064
  * @typedef {Object} SummaryContentsOptions
@@ -3104,15 +3089,6 @@ type ContextOptions = {
3104
3089
  type TextResponse = {
3105
3090
  text: string;
3106
3091
  };
3107
- /**
3108
- * @typedef {Object} HighlightsResponse
3109
- * @property {string[]} highlights - The highlights as an array of strings.
3110
- * @property {number[]} highlightScores - The corresponding scores as an array of floats, 0 to 1
3111
- */
3112
- type HighlightsResponse = {
3113
- highlights: string[];
3114
- highlightScores: number[];
3115
- };
3116
3092
  /**
3117
3093
  * @typedef {Object} SummaryResponse
3118
3094
  * @property {string} summary - The generated summary of the page content.
@@ -3141,22 +3117,20 @@ type SubpagesResponse<T extends ContentsOptions> = {
3141
3117
  type Default<T extends {}, U> = [keyof T] extends [never] ? U : T;
3142
3118
  /**
3143
3119
  * @typedef {Object} ContentsResultComponent
3144
- * Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'HighlightsResponse', 'SummaryResponse', or an empty object.
3120
+ * Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'SummaryResponse', or an empty object.
3145
3121
  *
3146
3122
  * @template T - A type extending from 'ContentsOptions'.
3147
3123
  */
3148
- type ContentsResultComponent<T extends ContentsOptions> = Default<(T["text"] extends object | true ? TextResponse : {}) & (T["highlights"] extends object | true ? HighlightsResponse : {}) & (T["summary"] extends object | true ? SummaryResponse : {}) & (T["subpages"] extends number ? SubpagesResponse<T> : {}) & (T["extras"] extends object ? ExtrasResponse : {}), TextResponse>;
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 : {});
3149
3125
  /**
3150
3126
  * Represents the cost breakdown related to contents retrieval. Fields are optional because
3151
3127
  * only non-zero costs are included.
3152
3128
  * @typedef {Object} CostDollarsContents
3153
3129
  * @property {number} [text] - The cost in dollars for retrieving text.
3154
- * @property {number} [highlights] - The cost in dollars for retrieving highlights.
3155
3130
  * @property {number} [summary] - The cost in dollars for retrieving summary.
3156
3131
  */
3157
3132
  type CostDollarsContents = {
3158
3133
  text?: number;
3159
- highlights?: number;
3160
3134
  summary?: number;
3161
3135
  };
3162
3136
  /**
@@ -3209,7 +3183,6 @@ type SearchResult<T extends ContentsOptions> = {
3209
3183
  * @typedef {Object} SearchResponse
3210
3184
  * @property {Result[]} results - The list of search results.
3211
3185
  * @property {string} [context] - The context for the search.
3212
- * @property {string} [autopromptString] - The autoprompt string, if applicable.
3213
3186
  * @property {string} [autoDate] - The autoprompt date, if applicable.
3214
3187
  * @property {string} requestId - The request ID for the search.
3215
3188
  * @property {CostDollars} [costDollars] - The cost breakdown for this request.
@@ -3217,7 +3190,6 @@ type SearchResult<T extends ContentsOptions> = {
3217
3190
  type SearchResponse<T extends ContentsOptions> = {
3218
3191
  results: SearchResult<T>[];
3219
3192
  context?: string;
3220
- autopromptString?: string;
3221
3193
  autoDate?: string;
3222
3194
  requestId: string;
3223
3195
  statuses?: Array<Status>;
@@ -3341,13 +3313,55 @@ declare class Exa {
3341
3313
  rawRequest(endpoint: string, method?: string, body?: Record<string, unknown>, queryParams?: Record<string, string | number | boolean | string[] | undefined>): Promise<Response>;
3342
3314
  /**
3343
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.
3344
3328
  *
3345
3329
  * @param {string} query - The query string.
3346
- * @param {RegularSearchOptions} [options] - Additional search options
3347
- * @returns {Promise<SearchResponse<{}>>} A list of relevant search results.
3330
+ * @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled
3331
+ * @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.
3348
3332
  */
3349
- search(query: string, options?: RegularSearchOptions): Promise<SearchResponse<{}>>;
3333
+ search(query: string, options: RegularSearchOptions & {
3334
+ contents: false | null | undefined;
3335
+ }): Promise<SearchResponse<{}>>;
3350
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.
3349
+ *
3350
+ * @param {string} query - The query string.
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.
3353
+ */
3354
+ search(query: string, options: Omit<RegularSearchOptions, "contents">): Promise<SearchResponse<{
3355
+ text: true;
3356
+ }>>;
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
+ *
3351
3365
  * Performs a search with an Exa prompt-engineered query and returns the contents of the documents.
3352
3366
  *
3353
3367
  * @param {string} query - The query string.
@@ -3357,12 +3371,55 @@ declare class Exa {
3357
3371
  searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T): Promise<SearchResponse<T>>;
3358
3372
  /**
3359
3373
  * Finds similar links to the provided URL.
3374
+ * By default, returns text contents. Use contents: false to opt-out.
3375
+ *
3360
3376
  * @param {string} url - The URL for which to find similar links.
3361
- * @param {FindSimilarOptions} [options] - Additional options for finding similar links.
3362
- * @returns {Promise<SearchResponse<{}>>} A list of similar search results.
3377
+ * @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of similar search results with text contents.
3363
3378
  */
3364
- findSimilar(url: string, options?: FindSimilarOptions): Promise<SearchResponse<{}>>;
3379
+ findSimilar(url: string): Promise<SearchResponse<{
3380
+ text: {
3381
+ maxCharacters: 10_000;
3382
+ };
3383
+ }>>;
3365
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
+ *
3408
+ * @param {string} url - The URL for which to find similar links.
3409
+ * @param {Omit<FindSimilarOptions, 'contents'>} options - Options without contents
3410
+ * @returns {Promise<SearchResponse<{ text: true }>>} A list of similar search results with text contents.
3411
+ */
3412
+ findSimilar(url: string, options: Omit<FindSimilarOptions, "contents">): Promise<SearchResponse<{
3413
+ text: true;
3414
+ }>>;
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
+ *
3366
3423
  * Finds similar links to the provided URL and returns the contents of the documents.
3367
3424
  * @param {string} url - The URL for which to find similar links.
3368
3425
  * @param {FindSimilarOptions & T} [options] - Additional options for finding similar links + contents.
@@ -3442,4 +3499,4 @@ declare class Exa {
3442
3499
  private parseSSEStream;
3443
3500
  }
3444
3501
 
3445
- 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, type HighlightsContentsOptions, type HighlightsResponse, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -2965,10 +2965,33 @@ declare class ExaError extends Error {
2965
2965
  constructor(message: string, statusCode: number, timestamp?: string, path?: string);
2966
2966
  }
2967
2967
 
2968
- declare const isBeta = false;
2969
2968
  /**
2970
- * Search options for performing a search query.
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
2971
2993
  * @typedef {Object} SearchOptions
2994
+ * @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
2972
2995
  * @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans.
2973
2996
  * @property {string[]} [includeDomains] - List of domains to include in the search.
2974
2997
  * @property {string[]} [excludeDomains] - List of domains to exclude in the search.
@@ -2983,6 +3006,7 @@ declare const isBeta = false;
2983
3006
  * @property {string} [userLocation] - The two-letter ISO country code of the user, e.g. US.
2984
3007
  */
2985
3008
  type BaseSearchOptions = {
3009
+ contents?: ContentsOptions;
2986
3010
  numResults?: number;
2987
3011
  includeDomains?: string[];
2988
3012
  excludeDomains?: string[];
@@ -3020,31 +3044,6 @@ type ExtrasOptions = {
3020
3044
  links?: number;
3021
3045
  imageLinks?: number;
3022
3046
  };
3023
- /**
3024
- * Search options for performing a search query.
3025
- * @typedef {Object} ContentsOptions
3026
- * @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.
3027
- * @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;
3028
- * @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.
3029
- * @property {LivecrawlOptions} [livecrawl] - Options for livecrawling contents. Default is "never" for neural/auto search, "fallback" for keyword search.
3030
- * @property {number} [livecrawlTimeout] - The timeout for livecrawling. Max and default is 10000ms.
3031
- * @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.
3032
- * @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.
3033
- * @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.
3034
- * @property {ExtrasOptions} [extras] - Miscelleneous data derived from results
3035
- */
3036
- type ContentsOptions = {
3037
- text?: TextContentsOptions | true;
3038
- highlights?: HighlightsContentsOptions | true;
3039
- summary?: SummaryContentsOptions | true;
3040
- livecrawl?: LivecrawlOptions;
3041
- context?: ContextOptions | true;
3042
- livecrawlTimeout?: number;
3043
- filterEmptyResults?: boolean;
3044
- subpages?: number;
3045
- subpageTarget?: string | string[];
3046
- extras?: ExtrasOptions;
3047
- } & (typeof isBeta extends true ? {} : {});
3048
3047
  /**
3049
3048
  * Options for livecrawling contents
3050
3049
  * @typedef {string} LivecrawlOptions
@@ -3060,20 +3059,6 @@ type TextContentsOptions = {
3060
3059
  maxCharacters?: number;
3061
3060
  includeHtmlTags?: boolean;
3062
3061
  };
3063
- /**
3064
- * Options for retrieving highlights from page.
3065
- * NOTE: For search type "deep", these options will not be respected. Highlights will be generated with respect
3066
- * to your initial query, and may vary in quantity and length.
3067
- * @typedef {Object} HighlightsContentsOptions
3068
- * @property {string} [query] - The query string to use for highlights search.
3069
- * @property {number} [numSentences] - The number of sentences to return for each highlight.
3070
- * @property {number} [highlightsPerUrl] - The number of highlights to return for each URL.
3071
- */
3072
- type HighlightsContentsOptions = {
3073
- query?: string;
3074
- numSentences?: number;
3075
- highlightsPerUrl?: number;
3076
- };
3077
3062
  /**
3078
3063
  * Options for retrieving summary from page.
3079
3064
  * @typedef {Object} SummaryContentsOptions
@@ -3104,15 +3089,6 @@ type ContextOptions = {
3104
3089
  type TextResponse = {
3105
3090
  text: string;
3106
3091
  };
3107
- /**
3108
- * @typedef {Object} HighlightsResponse
3109
- * @property {string[]} highlights - The highlights as an array of strings.
3110
- * @property {number[]} highlightScores - The corresponding scores as an array of floats, 0 to 1
3111
- */
3112
- type HighlightsResponse = {
3113
- highlights: string[];
3114
- highlightScores: number[];
3115
- };
3116
3092
  /**
3117
3093
  * @typedef {Object} SummaryResponse
3118
3094
  * @property {string} summary - The generated summary of the page content.
@@ -3141,22 +3117,20 @@ type SubpagesResponse<T extends ContentsOptions> = {
3141
3117
  type Default<T extends {}, U> = [keyof T] extends [never] ? U : T;
3142
3118
  /**
3143
3119
  * @typedef {Object} ContentsResultComponent
3144
- * Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'HighlightsResponse', 'SummaryResponse', or an empty object.
3120
+ * Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'SummaryResponse', or an empty object.
3145
3121
  *
3146
3122
  * @template T - A type extending from 'ContentsOptions'.
3147
3123
  */
3148
- type ContentsResultComponent<T extends ContentsOptions> = Default<(T["text"] extends object | true ? TextResponse : {}) & (T["highlights"] extends object | true ? HighlightsResponse : {}) & (T["summary"] extends object | true ? SummaryResponse : {}) & (T["subpages"] extends number ? SubpagesResponse<T> : {}) & (T["extras"] extends object ? ExtrasResponse : {}), TextResponse>;
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 : {});
3149
3125
  /**
3150
3126
  * Represents the cost breakdown related to contents retrieval. Fields are optional because
3151
3127
  * only non-zero costs are included.
3152
3128
  * @typedef {Object} CostDollarsContents
3153
3129
  * @property {number} [text] - The cost in dollars for retrieving text.
3154
- * @property {number} [highlights] - The cost in dollars for retrieving highlights.
3155
3130
  * @property {number} [summary] - The cost in dollars for retrieving summary.
3156
3131
  */
3157
3132
  type CostDollarsContents = {
3158
3133
  text?: number;
3159
- highlights?: number;
3160
3134
  summary?: number;
3161
3135
  };
3162
3136
  /**
@@ -3209,7 +3183,6 @@ type SearchResult<T extends ContentsOptions> = {
3209
3183
  * @typedef {Object} SearchResponse
3210
3184
  * @property {Result[]} results - The list of search results.
3211
3185
  * @property {string} [context] - The context for the search.
3212
- * @property {string} [autopromptString] - The autoprompt string, if applicable.
3213
3186
  * @property {string} [autoDate] - The autoprompt date, if applicable.
3214
3187
  * @property {string} requestId - The request ID for the search.
3215
3188
  * @property {CostDollars} [costDollars] - The cost breakdown for this request.
@@ -3217,7 +3190,6 @@ type SearchResult<T extends ContentsOptions> = {
3217
3190
  type SearchResponse<T extends ContentsOptions> = {
3218
3191
  results: SearchResult<T>[];
3219
3192
  context?: string;
3220
- autopromptString?: string;
3221
3193
  autoDate?: string;
3222
3194
  requestId: string;
3223
3195
  statuses?: Array<Status>;
@@ -3341,13 +3313,55 @@ declare class Exa {
3341
3313
  rawRequest(endpoint: string, method?: string, body?: Record<string, unknown>, queryParams?: Record<string, string | number | boolean | string[] | undefined>): Promise<Response>;
3342
3314
  /**
3343
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.
3344
3328
  *
3345
3329
  * @param {string} query - The query string.
3346
- * @param {RegularSearchOptions} [options] - Additional search options
3347
- * @returns {Promise<SearchResponse<{}>>} A list of relevant search results.
3330
+ * @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled
3331
+ * @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.
3348
3332
  */
3349
- search(query: string, options?: RegularSearchOptions): Promise<SearchResponse<{}>>;
3333
+ search(query: string, options: RegularSearchOptions & {
3334
+ contents: false | null | undefined;
3335
+ }): Promise<SearchResponse<{}>>;
3350
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.
3349
+ *
3350
+ * @param {string} query - The query string.
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.
3353
+ */
3354
+ search(query: string, options: Omit<RegularSearchOptions, "contents">): Promise<SearchResponse<{
3355
+ text: true;
3356
+ }>>;
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
+ *
3351
3365
  * Performs a search with an Exa prompt-engineered query and returns the contents of the documents.
3352
3366
  *
3353
3367
  * @param {string} query - The query string.
@@ -3357,12 +3371,55 @@ declare class Exa {
3357
3371
  searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T): Promise<SearchResponse<T>>;
3358
3372
  /**
3359
3373
  * Finds similar links to the provided URL.
3374
+ * By default, returns text contents. Use contents: false to opt-out.
3375
+ *
3360
3376
  * @param {string} url - The URL for which to find similar links.
3361
- * @param {FindSimilarOptions} [options] - Additional options for finding similar links.
3362
- * @returns {Promise<SearchResponse<{}>>} A list of similar search results.
3377
+ * @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of similar search results with text contents.
3363
3378
  */
3364
- findSimilar(url: string, options?: FindSimilarOptions): Promise<SearchResponse<{}>>;
3379
+ findSimilar(url: string): Promise<SearchResponse<{
3380
+ text: {
3381
+ maxCharacters: 10_000;
3382
+ };
3383
+ }>>;
3365
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
+ *
3408
+ * @param {string} url - The URL for which to find similar links.
3409
+ * @param {Omit<FindSimilarOptions, 'contents'>} options - Options without contents
3410
+ * @returns {Promise<SearchResponse<{ text: true }>>} A list of similar search results with text contents.
3411
+ */
3412
+ findSimilar(url: string, options: Omit<FindSimilarOptions, "contents">): Promise<SearchResponse<{
3413
+ text: true;
3414
+ }>>;
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
+ *
3366
3423
  * Finds similar links to the provided URL and returns the contents of the documents.
3367
3424
  * @param {string} url - The URL for which to find similar links.
3368
3425
  * @param {FindSimilarOptions & T} [options] - Additional options for finding similar links + contents.
@@ -3442,4 +3499,4 @@ declare class Exa {
3442
3499
  private parseSSEStream;
3443
3500
  }
3444
3501
 
3445
- 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, type HighlightsContentsOptions, type HighlightsResponse, 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 };
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 };