exa-js 2.0.5 → 2.0.7

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
@@ -1551,6 +1551,11 @@ interface components {
1551
1551
  };
1552
1552
  PreviewWebsetParameters: {
1553
1553
  search: {
1554
+ /**
1555
+ * @description When query parameter search=true, the number of preview items to return.
1556
+ * @default 10
1557
+ */
1558
+ count: number;
1554
1559
  /** @description Entity used to inform the decomposition.
1555
1560
  *
1556
1561
  * It is not required to provide it, we automatically detect the entity from all the information provided in the query. Only use this when you need more fine control. */
@@ -3015,7 +3020,7 @@ type ContentsOptions = {
3015
3020
  * Options for performing a search query
3016
3021
  * @typedef {Object} SearchOptions
3017
3022
  * @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
3018
- * @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.
3019
3024
  * @property {string[]} [includeDomains] - List of domains to include in the search.
3020
3025
  * @property {string[]} [excludeDomains] - List of domains to exclude in the search.
3021
3026
  * @property {string} [startCrawlDate] - Start date for results based on crawl date.
@@ -3044,17 +3049,49 @@ type BaseSearchOptions = {
3044
3049
  userLocation?: string;
3045
3050
  };
3046
3051
  /**
3047
- * Search options for performing a search query.
3048
- * @typedef {Object} RegularSearchOptions
3052
+ * Base search options shared across all search types
3049
3053
  */
3050
- type RegularSearchOptions = BaseSearchOptions & {
3054
+ type BaseRegularSearchOptions = BaseSearchOptions & {
3051
3055
  /**
3052
3056
  * If true, the search results are moderated for safety.
3053
3057
  */
3054
3058
  moderation?: boolean;
3055
3059
  useAutoprompt?: boolean;
3056
- type?: "keyword" | "neural" | "auto" | "hybrid" | "fast" | "deep";
3057
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;
3058
3095
  /**
3059
3096
  * Options for finding similar links.
3060
3097
  * @typedef {Object} FindSimilarOptions
@@ -3371,10 +3408,10 @@ declare class Exa {
3371
3408
  * When no contents option is specified, returns text contents by default.
3372
3409
  *
3373
3410
  * @param {string} query - The query string.
3374
- * @param {Omit<RegularSearchOptions, 'contents'>} options - Search options without contents
3411
+ * @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents
3375
3412
  * @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
3376
3413
  */
3377
- search(query: string, options: Omit<RegularSearchOptions, "contents">): Promise<SearchResponse<{
3414
+ search(query: string, options: Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">): Promise<SearchResponse<{
3378
3415
  text: true;
3379
3416
  }>>;
3380
3417
  /**
package/dist/index.d.ts CHANGED
@@ -1551,6 +1551,11 @@ interface components {
1551
1551
  };
1552
1552
  PreviewWebsetParameters: {
1553
1553
  search: {
1554
+ /**
1555
+ * @description When query parameter search=true, the number of preview items to return.
1556
+ * @default 10
1557
+ */
1558
+ count: number;
1554
1559
  /** @description Entity used to inform the decomposition.
1555
1560
  *
1556
1561
  * It is not required to provide it, we automatically detect the entity from all the information provided in the query. Only use this when you need more fine control. */
@@ -3015,7 +3020,7 @@ type ContentsOptions = {
3015
3020
  * Options for performing a search query
3016
3021
  * @typedef {Object} SearchOptions
3017
3022
  * @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.
3018
- * @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.
3019
3024
  * @property {string[]} [includeDomains] - List of domains to include in the search.
3020
3025
  * @property {string[]} [excludeDomains] - List of domains to exclude in the search.
3021
3026
  * @property {string} [startCrawlDate] - Start date for results based on crawl date.
@@ -3044,17 +3049,49 @@ type BaseSearchOptions = {
3044
3049
  userLocation?: string;
3045
3050
  };
3046
3051
  /**
3047
- * Search options for performing a search query.
3048
- * @typedef {Object} RegularSearchOptions
3052
+ * Base search options shared across all search types
3049
3053
  */
3050
- type RegularSearchOptions = BaseSearchOptions & {
3054
+ type BaseRegularSearchOptions = BaseSearchOptions & {
3051
3055
  /**
3052
3056
  * If true, the search results are moderated for safety.
3053
3057
  */
3054
3058
  moderation?: boolean;
3055
3059
  useAutoprompt?: boolean;
3056
- type?: "keyword" | "neural" | "auto" | "hybrid" | "fast" | "deep";
3057
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;
3058
3095
  /**
3059
3096
  * Options for finding similar links.
3060
3097
  * @typedef {Object} FindSimilarOptions
@@ -3371,10 +3408,10 @@ declare class Exa {
3371
3408
  * When no contents option is specified, returns text contents by default.
3372
3409
  *
3373
3410
  * @param {string} query - The query string.
3374
- * @param {Omit<RegularSearchOptions, 'contents'>} options - Search options without contents
3411
+ * @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents
3375
3412
  * @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
3376
3413
  */
3377
- search(query: string, options: Omit<RegularSearchOptions, "contents">): Promise<SearchResponse<{
3414
+ search(query: string, options: Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">): Promise<SearchResponse<{
3378
3415
  text: true;
3379
3416
  }>>;
3380
3417
  /**
package/dist/index.js CHANGED
@@ -74,7 +74,7 @@ var import_cross_fetch = __toESM(require("cross-fetch"));
74
74
  // package.json
75
75
  var package_default = {
76
76
  name: "exa-js",
77
- version: "2.0.5",
77
+ version: "2.0.7",
78
78
  description: "Exa SDK for Node.js and the browser",
79
79
  publishConfig: {
80
80
  access: "public"