exa-js 2.0.6 → 2.0.8
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 +39 -7
- package/dist/index.d.ts +39 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -21
package/dist/index.d.mts
CHANGED
|
@@ -3020,7 +3020,7 @@ type ContentsOptions = {
|
|
|
3020
3020
|
* Options for performing a search query
|
|
3021
3021
|
* @typedef {Object} SearchOptions
|
|
3022
3022
|
* @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
|
|
3023
|
-
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans.
|
|
3023
|
+
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans. For deep search, recommend leaving blank - number of results will be determined dynamically for your query.
|
|
3024
3024
|
* @property {string[]} [includeDomains] - List of domains to include in the search.
|
|
3025
3025
|
* @property {string[]} [excludeDomains] - List of domains to exclude in the search.
|
|
3026
3026
|
* @property {string} [startCrawlDate] - Start date for results based on crawl date.
|
|
@@ -3049,17 +3049,49 @@ type BaseSearchOptions = {
|
|
|
3049
3049
|
userLocation?: string;
|
|
3050
3050
|
};
|
|
3051
3051
|
/**
|
|
3052
|
-
*
|
|
3053
|
-
* @typedef {Object} RegularSearchOptions
|
|
3052
|
+
* Base search options shared across all search types
|
|
3054
3053
|
*/
|
|
3055
|
-
type
|
|
3054
|
+
type BaseRegularSearchOptions = BaseSearchOptions & {
|
|
3056
3055
|
/**
|
|
3057
3056
|
* If true, the search results are moderated for safety.
|
|
3058
3057
|
*/
|
|
3059
3058
|
moderation?: boolean;
|
|
3060
3059
|
useAutoprompt?: boolean;
|
|
3061
|
-
type?: "keyword" | "neural" | "auto" | "hybrid" | "fast" | "deep";
|
|
3062
3060
|
};
|
|
3061
|
+
/**
|
|
3062
|
+
* Contents options for deep search - context is always returned and cannot be disabled
|
|
3063
|
+
*/
|
|
3064
|
+
type DeepContentsOptions = Omit<ContentsOptions, "context"> & {
|
|
3065
|
+
context?: Omit<ContextOptions, never> | true;
|
|
3066
|
+
};
|
|
3067
|
+
/**
|
|
3068
|
+
* Search options for deep search type, which supports additional queries.
|
|
3069
|
+
* Note: context is always returned by the API for deep search and cannot be set to false.
|
|
3070
|
+
*/
|
|
3071
|
+
type DeepSearchOptions = Omit<BaseRegularSearchOptions, "contents"> & {
|
|
3072
|
+
type: "deep";
|
|
3073
|
+
/**
|
|
3074
|
+
* Alternative query formulations for deep search to skip automatic LLM-based query expansion.
|
|
3075
|
+
* Max 5 queries.
|
|
3076
|
+
* @example ["machine learning", "ML algorithms", "neural networks"]
|
|
3077
|
+
*/
|
|
3078
|
+
additionalQueries?: string[];
|
|
3079
|
+
/**
|
|
3080
|
+
* Options for retrieving page contents. For deep search, context is always returned.
|
|
3081
|
+
*/
|
|
3082
|
+
contents?: DeepContentsOptions;
|
|
3083
|
+
};
|
|
3084
|
+
/**
|
|
3085
|
+
* Search options for non-deep search types (keyword, neural, auto, hybrid, fast)
|
|
3086
|
+
*/
|
|
3087
|
+
type NonDeepSearchOptions = BaseRegularSearchOptions & {
|
|
3088
|
+
type?: "keyword" | "neural" | "auto" | "hybrid" | "fast";
|
|
3089
|
+
};
|
|
3090
|
+
/**
|
|
3091
|
+
* Search options for performing a search query.
|
|
3092
|
+
* Uses a discriminated union to ensure additionalQueries is only allowed when type is "deep".
|
|
3093
|
+
*/
|
|
3094
|
+
type RegularSearchOptions = DeepSearchOptions | NonDeepSearchOptions;
|
|
3063
3095
|
/**
|
|
3064
3096
|
* Options for finding similar links.
|
|
3065
3097
|
* @typedef {Object} FindSimilarOptions
|
|
@@ -3376,10 +3408,10 @@ declare class Exa {
|
|
|
3376
3408
|
* When no contents option is specified, returns text contents by default.
|
|
3377
3409
|
*
|
|
3378
3410
|
* @param {string} query - The query string.
|
|
3379
|
-
* @param {Omit<
|
|
3411
|
+
* @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents
|
|
3380
3412
|
* @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
|
|
3381
3413
|
*/
|
|
3382
|
-
search(query: string, options: Omit<
|
|
3414
|
+
search(query: string, options: Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">): Promise<SearchResponse<{
|
|
3383
3415
|
text: true;
|
|
3384
3416
|
}>>;
|
|
3385
3417
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -3020,7 +3020,7 @@ type ContentsOptions = {
|
|
|
3020
3020
|
* Options for performing a search query
|
|
3021
3021
|
* @typedef {Object} SearchOptions
|
|
3022
3022
|
* @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
|
|
3023
|
-
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans.
|
|
3023
|
+
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans. For deep search, recommend leaving blank - number of results will be determined dynamically for your query.
|
|
3024
3024
|
* @property {string[]} [includeDomains] - List of domains to include in the search.
|
|
3025
3025
|
* @property {string[]} [excludeDomains] - List of domains to exclude in the search.
|
|
3026
3026
|
* @property {string} [startCrawlDate] - Start date for results based on crawl date.
|
|
@@ -3049,17 +3049,49 @@ type BaseSearchOptions = {
|
|
|
3049
3049
|
userLocation?: string;
|
|
3050
3050
|
};
|
|
3051
3051
|
/**
|
|
3052
|
-
*
|
|
3053
|
-
* @typedef {Object} RegularSearchOptions
|
|
3052
|
+
* Base search options shared across all search types
|
|
3054
3053
|
*/
|
|
3055
|
-
type
|
|
3054
|
+
type BaseRegularSearchOptions = BaseSearchOptions & {
|
|
3056
3055
|
/**
|
|
3057
3056
|
* If true, the search results are moderated for safety.
|
|
3058
3057
|
*/
|
|
3059
3058
|
moderation?: boolean;
|
|
3060
3059
|
useAutoprompt?: boolean;
|
|
3061
|
-
type?: "keyword" | "neural" | "auto" | "hybrid" | "fast" | "deep";
|
|
3062
3060
|
};
|
|
3061
|
+
/**
|
|
3062
|
+
* Contents options for deep search - context is always returned and cannot be disabled
|
|
3063
|
+
*/
|
|
3064
|
+
type DeepContentsOptions = Omit<ContentsOptions, "context"> & {
|
|
3065
|
+
context?: Omit<ContextOptions, never> | true;
|
|
3066
|
+
};
|
|
3067
|
+
/**
|
|
3068
|
+
* Search options for deep search type, which supports additional queries.
|
|
3069
|
+
* Note: context is always returned by the API for deep search and cannot be set to false.
|
|
3070
|
+
*/
|
|
3071
|
+
type DeepSearchOptions = Omit<BaseRegularSearchOptions, "contents"> & {
|
|
3072
|
+
type: "deep";
|
|
3073
|
+
/**
|
|
3074
|
+
* Alternative query formulations for deep search to skip automatic LLM-based query expansion.
|
|
3075
|
+
* Max 5 queries.
|
|
3076
|
+
* @example ["machine learning", "ML algorithms", "neural networks"]
|
|
3077
|
+
*/
|
|
3078
|
+
additionalQueries?: string[];
|
|
3079
|
+
/**
|
|
3080
|
+
* Options for retrieving page contents. For deep search, context is always returned.
|
|
3081
|
+
*/
|
|
3082
|
+
contents?: DeepContentsOptions;
|
|
3083
|
+
};
|
|
3084
|
+
/**
|
|
3085
|
+
* Search options for non-deep search types (keyword, neural, auto, hybrid, fast)
|
|
3086
|
+
*/
|
|
3087
|
+
type NonDeepSearchOptions = BaseRegularSearchOptions & {
|
|
3088
|
+
type?: "keyword" | "neural" | "auto" | "hybrid" | "fast";
|
|
3089
|
+
};
|
|
3090
|
+
/**
|
|
3091
|
+
* Search options for performing a search query.
|
|
3092
|
+
* Uses a discriminated union to ensure additionalQueries is only allowed when type is "deep".
|
|
3093
|
+
*/
|
|
3094
|
+
type RegularSearchOptions = DeepSearchOptions | NonDeepSearchOptions;
|
|
3063
3095
|
/**
|
|
3064
3096
|
* Options for finding similar links.
|
|
3065
3097
|
* @typedef {Object} FindSimilarOptions
|
|
@@ -3376,10 +3408,10 @@ declare class Exa {
|
|
|
3376
3408
|
* When no contents option is specified, returns text contents by default.
|
|
3377
3409
|
*
|
|
3378
3410
|
* @param {string} query - The query string.
|
|
3379
|
-
* @param {Omit<
|
|
3411
|
+
* @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents
|
|
3380
3412
|
* @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
|
|
3381
3413
|
*/
|
|
3382
|
-
search(query: string, options: Omit<
|
|
3414
|
+
search(query: string, options: Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">): Promise<SearchResponse<{
|
|
3383
3415
|
text: true;
|
|
3384
3416
|
}>>;
|
|
3385
3417
|
/**
|
package/dist/index.js
CHANGED