exa-js 1.8.18 → 1.8.20

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
@@ -1,3 +1,5 @@
1
+ import { ZodSchema } from 'zod';
2
+
1
3
  /**
2
4
  * Base client for Websets API
3
5
  */
@@ -287,7 +289,8 @@ interface components$1 {
287
289
  *
288
290
  * Any URLs provided will be crawled and used as additional context for the search. */
289
291
  query: string;
290
- /** @description Whether to compute recall metrics for the search */
292
+ /** @description Whether to provide an estimate of how many total relevant results could exist for this search.
293
+ * Result of the analysis will be available in the `recall` field within the search request. */
291
294
  recall?: boolean;
292
295
  };
293
296
  };
@@ -329,7 +332,8 @@ interface components$1 {
329
332
  *
330
333
  * Any URLs provided will be crawled and used as additional context for the search. */
331
334
  query: string;
332
- /** @description Whether to compute recall metrics for the search */
335
+ /** @description Whether to provide an estimate of how many total relevant results could exist for this search.
336
+ * Result of the analysis will be available in the `recall` field within the search request. */
333
337
  recall?: boolean;
334
338
  };
335
339
  /** Custom */
@@ -358,7 +362,10 @@ interface components$1 {
358
362
  snippet: string | null;
359
363
  /** @description The title of the reference */
360
364
  title: string | null;
361
- /** @description The URL of the reference */
365
+ /**
366
+ * Format: uri
367
+ * @description The URL of the reference
368
+ */
362
369
  url: string;
363
370
  }[];
364
371
  /** @description The result of the enrichment. */
@@ -695,7 +702,7 @@ interface components$1 {
695
702
  * @default append
696
703
  * @enum {string}
697
704
  */
698
- behavior: MonitorBehaviorConfigBehavior;
705
+ behavior: WebsetSearchBehavior;
699
706
  /** @description The maximum number of results to find */
700
707
  count: number;
701
708
  /** @description The criteria to search for. By default, the criteria from the last search is used. */
@@ -775,7 +782,7 @@ interface components$1 {
775
782
  * @default append
776
783
  * @enum {string}
777
784
  */
778
- behavior: MonitorBehaviorConfigBehavior;
785
+ behavior: WebsetSearchBehavior;
779
786
  /** @description The maximum number of results to find */
780
787
  count: number;
781
788
  /** @description The criteria to search for. By default, the criteria from the last search is used. */
@@ -826,6 +833,8 @@ interface components$1 {
826
833
  * @description When the run failed
827
834
  */
828
835
  failedAt: string | null;
836
+ /** @description The reason the run failed */
837
+ failedReason: string | null;
829
838
  /** @description The unique identifier for the Monitor Run */
830
839
  id: string;
831
840
  /** @description The monitor that the run is associated with */
@@ -1020,6 +1029,8 @@ interface components$1 {
1020
1029
  status: WebsetStatus;
1021
1030
  /** @description The Streams for the Webset. */
1022
1031
  streams: unknown[];
1032
+ /** @description The title of the webset */
1033
+ title: string | null;
1023
1034
  /**
1024
1035
  * Format: date-time
1025
1036
  * @description The date and time the webset was updated
@@ -1214,7 +1225,10 @@ interface components$1 {
1214
1225
  snippet: string | null;
1215
1226
  /** @description The title of the reference */
1216
1227
  title: string | null;
1217
- /** @description The URL of the reference */
1228
+ /**
1229
+ * Format: uri
1230
+ * @description The URL of the reference
1231
+ */
1218
1232
  url: string;
1219
1233
  }[];
1220
1234
  /**
@@ -1527,10 +1541,6 @@ declare enum MonitorStatus {
1527
1541
  enabled = "enabled",
1528
1542
  disabled = "disabled"
1529
1543
  }
1530
- declare enum MonitorBehaviorConfigBehavior {
1531
- override = "override",
1532
- append = "append"
1533
- }
1534
1544
  declare enum MonitorRunObject {
1535
1545
  monitor_run = "monitor_run"
1536
1546
  }
@@ -1538,7 +1548,8 @@ declare enum MonitorRunStatus {
1538
1548
  created = "created",
1539
1549
  running = "running",
1540
1550
  completed = "completed",
1541
- canceled = "canceled"
1551
+ canceled = "canceled",
1552
+ failed = "failed"
1542
1553
  }
1543
1554
  declare enum MonitorRunType {
1544
1555
  search = "search",
@@ -1796,6 +1807,15 @@ declare class ImportsClient extends WebsetsBaseClient {
1796
1807
  * Client for managing Webset Items
1797
1808
  */
1798
1809
 
1810
+ /**
1811
+ * Options for listing webset items
1812
+ */
1813
+ interface ListWebsetItemsOptions extends PaginationParams {
1814
+ /**
1815
+ * The id of the source to filter items by
1816
+ */
1817
+ sourceId?: string;
1818
+ }
1799
1819
  /**
1800
1820
  * Client for managing Webset Items
1801
1821
  */
@@ -1803,24 +1823,24 @@ declare class WebsetItemsClient extends WebsetsBaseClient {
1803
1823
  /**
1804
1824
  * List all Items for a Webset
1805
1825
  * @param websetId The ID of the Webset
1806
- * @param params - Optional pagination parameters
1826
+ * @param params - Optional pagination and filtering parameters
1807
1827
  * @returns A promise that resolves with the list of Items
1808
1828
  */
1809
- list(websetId: string, params?: PaginationParams): Promise<ListWebsetItemResponse>;
1829
+ list(websetId: string, params?: ListWebsetItemsOptions): Promise<ListWebsetItemResponse>;
1810
1830
  /**
1811
1831
  * Iterate through all Items in a Webset, handling pagination automatically
1812
1832
  * @param websetId The ID of the Webset
1813
1833
  * @param options Pagination options
1814
1834
  * @returns Async generator of Webset Items
1815
1835
  */
1816
- listAll(websetId: string, options?: PaginationParams): AsyncGenerator<WebsetItem>;
1836
+ listAll(websetId: string, options?: ListWebsetItemsOptions): AsyncGenerator<WebsetItem>;
1817
1837
  /**
1818
1838
  * Collect all items from a Webset into an array
1819
1839
  * @param websetId The ID of the Webset
1820
1840
  * @param options Pagination options
1821
1841
  * @returns Promise resolving to an array of all Webset Items
1822
1842
  */
1823
- getAll(websetId: string, options?: PaginationParams): Promise<WebsetItem[]>;
1843
+ getAll(websetId: string, options?: ListWebsetItemsOptions): Promise<WebsetItem[]>;
1824
1844
  /**
1825
1845
  * Get an Item by ID
1826
1846
  * @param websetId The ID of the Webset
@@ -1959,6 +1979,10 @@ interface ListWebhookAttemptsOptions extends PaginationParams {
1959
1979
  * The type of event to filter by
1960
1980
  */
1961
1981
  eventType?: EventType;
1982
+ /**
1983
+ * Filter attempts by their success status
1984
+ */
1985
+ successful?: boolean;
1962
1986
  }
1963
1987
  /**
1964
1988
  * Client for managing Webset Webhooks
@@ -2185,6 +2209,10 @@ declare class ResearchBaseClient {
2185
2209
  */
2186
2210
  declare class ResearchClient extends ResearchBaseClient {
2187
2211
  constructor(client: Exa);
2212
+ /**
2213
+ * Create a new research task with Zod schema for strongly typed output
2214
+ */
2215
+ createTask<T>(params: ResearchCreateTaskParamsTyped<ZodSchema<T>>): Promise<SchemaResearchCreateTaskResponseDto>;
2188
2216
  /**
2189
2217
  * Create a new research task.
2190
2218
  *
@@ -2738,29 +2766,12 @@ type HighlightsContentsOptions = {
2738
2766
  */
2739
2767
  type SummaryContentsOptions = {
2740
2768
  query?: string;
2741
- schema?: JSONSchema;
2769
+ schema?: Record<string, unknown> | ZodSchema;
2742
2770
  };
2743
2771
  /**
2744
- * Represents a JSON Schema definition used for structured summary output.
2745
- * To learn more visit https://json-schema.org/overview/what-is-jsonschema.
2772
+ * @deprecated Use Record<string, unknown> instead.
2746
2773
  */
2747
- type JSONSchema = {
2748
- $schema?: string;
2749
- title?: string;
2750
- description?: string;
2751
- type: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
2752
- properties?: Record<string, JSONSchema>;
2753
- items?: JSONSchema | JSONSchema[];
2754
- required?: string[];
2755
- enum?: any[];
2756
- additionalProperties?: boolean | JSONSchema;
2757
- definitions?: Record<string, JSONSchema>;
2758
- patternProperties?: Record<string, JSONSchema>;
2759
- allOf?: JSONSchema[];
2760
- anyOf?: JSONSchema[];
2761
- oneOf?: JSONSchema[];
2762
- not?: JSONSchema;
2763
- };
2774
+ type JSONSchema = Record<string, unknown>;
2764
2775
  /**
2765
2776
  * Options for retrieving the context from a list of search results. The context is a string
2766
2777
  * representation of all the search results.
@@ -2958,6 +2969,39 @@ type AnswerStreamResponse = {
2958
2969
  answer?: string;
2959
2970
  citations?: SearchResult<{}>[];
2960
2971
  };
2972
+ /**
2973
+ * Enhanced answer options that accepts either JSON schema or Zod schema
2974
+ */
2975
+ type AnswerOptionsTyped<T> = Omit<AnswerOptions, "outputSchema"> & {
2976
+ outputSchema: T;
2977
+ };
2978
+ /**
2979
+ * Enhanced answer response with strongly typed answer when using Zod
2980
+ */
2981
+ type AnswerResponseTyped<T> = Omit<AnswerResponse, "answer"> & {
2982
+ answer: T;
2983
+ };
2984
+ /**
2985
+ * Enhanced summary contents options that accepts either JSON schema or Zod schema
2986
+ */
2987
+ type SummaryContentsOptionsTyped<T> = Omit<SummaryContentsOptions, "schema"> & {
2988
+ schema: T;
2989
+ };
2990
+ /**
2991
+ * Enhanced research task output options that accepts either JSON schema or Zod schema
2992
+ */
2993
+ type ResearchTaskOutputTyped<T> = {
2994
+ inferSchema?: boolean;
2995
+ schema: T;
2996
+ };
2997
+ /**
2998
+ * Enhanced research task creation params with zod schema support
2999
+ */
3000
+ type ResearchCreateTaskParamsTyped<T> = {
3001
+ instructions: string;
3002
+ model?: "exa-research" | "exa-research-pro";
3003
+ output?: ResearchTaskOutputTyped<T>;
3004
+ };
2961
3005
  /**
2962
3006
  * The Exa class encapsulates the API's endpoints.
2963
3007
  */
@@ -3030,6 +3074,10 @@ declare class Exa {
3030
3074
  * @returns {Promise<SearchResponse<T>>} A list of document contents for the requested URLs.
3031
3075
  */
3032
3076
  getContents<T extends ContentsOptions>(urls: string | string[] | SearchResult<T>[], options?: T): Promise<SearchResponse<T>>;
3077
+ /**
3078
+ * Generate an answer with Zod schema for strongly typed output
3079
+ */
3080
+ answer<T>(query: string, options: AnswerOptionsTyped<ZodSchema<T>>): Promise<AnswerResponseTyped<T>>;
3033
3081
  /**
3034
3082
  * Generate an answer to a query.
3035
3083
  * @param {string} query - The question or query to answer.
@@ -3053,6 +3101,16 @@ declare class Exa {
3053
3101
  * ```
3054
3102
  */
3055
3103
  answer(query: string, options?: AnswerOptions): Promise<AnswerResponse>;
3104
+ /**
3105
+ * Stream an answer with Zod schema for structured output (non-streaming content)
3106
+ * Note: Structured output works only with non-streaming content, not with streaming chunks
3107
+ */
3108
+ streamAnswer<T>(query: string, options: {
3109
+ text?: boolean;
3110
+ model?: "exa" | "exa-pro";
3111
+ systemPrompt?: string;
3112
+ outputSchema: ZodSchema<T>;
3113
+ }): AsyncGenerator<AnswerStreamChunk>;
3056
3114
  /**
3057
3115
  * Stream an answer as an async generator
3058
3116
  *
@@ -3082,4 +3140,4 @@ declare class Exa {
3082
3140
  private parseSSEStream;
3083
3141
  }
3084
3142
 
3085
- export { type AnswerOptions, type AnswerResponse, 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, CreateWebsetParametersImportSource, CreateWebsetParametersSearchExcludeSource, type CreateWebsetSearchParameters, CreateWebsetSearchParametersExcludeSource, 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 SchemaListResearchTasksRequestDto as ListResearchTasksRequest, type SchemaListResearchTasksResponseDto as ListResearchTasksResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type RegularSearchOptions, ResearchClient, type SchemaResearchCreateTaskRequestDto as ResearchCreateTaskRequest, type SchemaResearchCreateTaskResponseDto as ResearchCreateTaskResponse, type ResearchPaperEntity, type SchemaResearchTaskDto as ResearchTask, type ResearchTaskEvent, type ResearchTaskOperation, type SearchResponse, type SearchResult, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
3143
+ 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, CreateWebsetParametersImportSource, CreateWebsetParametersSearchExcludeSource, type CreateWebsetSearchParameters, CreateWebsetSearchParametersExcludeSource, 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 SchemaListResearchTasksRequestDto as ListResearchTasksRequest, type SchemaListResearchTasksResponseDto as ListResearchTasksResponse, 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 RegularSearchOptions, ResearchClient, type ResearchCreateTaskParamsTyped, type SchemaResearchCreateTaskRequestDto as ResearchCreateTaskRequest, type SchemaResearchCreateTaskResponseDto as ResearchCreateTaskResponse, type ResearchPaperEntity, type SchemaResearchTaskDto as ResearchTask, type ResearchTaskEvent, type ResearchTaskOperation, type ResearchTaskOutputTyped, type SearchResponse, type SearchResult, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { ZodSchema } from 'zod';
2
+
1
3
  /**
2
4
  * Base client for Websets API
3
5
  */
@@ -287,7 +289,8 @@ interface components$1 {
287
289
  *
288
290
  * Any URLs provided will be crawled and used as additional context for the search. */
289
291
  query: string;
290
- /** @description Whether to compute recall metrics for the search */
292
+ /** @description Whether to provide an estimate of how many total relevant results could exist for this search.
293
+ * Result of the analysis will be available in the `recall` field within the search request. */
291
294
  recall?: boolean;
292
295
  };
293
296
  };
@@ -329,7 +332,8 @@ interface components$1 {
329
332
  *
330
333
  * Any URLs provided will be crawled and used as additional context for the search. */
331
334
  query: string;
332
- /** @description Whether to compute recall metrics for the search */
335
+ /** @description Whether to provide an estimate of how many total relevant results could exist for this search.
336
+ * Result of the analysis will be available in the `recall` field within the search request. */
333
337
  recall?: boolean;
334
338
  };
335
339
  /** Custom */
@@ -358,7 +362,10 @@ interface components$1 {
358
362
  snippet: string | null;
359
363
  /** @description The title of the reference */
360
364
  title: string | null;
361
- /** @description The URL of the reference */
365
+ /**
366
+ * Format: uri
367
+ * @description The URL of the reference
368
+ */
362
369
  url: string;
363
370
  }[];
364
371
  /** @description The result of the enrichment. */
@@ -695,7 +702,7 @@ interface components$1 {
695
702
  * @default append
696
703
  * @enum {string}
697
704
  */
698
- behavior: MonitorBehaviorConfigBehavior;
705
+ behavior: WebsetSearchBehavior;
699
706
  /** @description The maximum number of results to find */
700
707
  count: number;
701
708
  /** @description The criteria to search for. By default, the criteria from the last search is used. */
@@ -775,7 +782,7 @@ interface components$1 {
775
782
  * @default append
776
783
  * @enum {string}
777
784
  */
778
- behavior: MonitorBehaviorConfigBehavior;
785
+ behavior: WebsetSearchBehavior;
779
786
  /** @description The maximum number of results to find */
780
787
  count: number;
781
788
  /** @description The criteria to search for. By default, the criteria from the last search is used. */
@@ -826,6 +833,8 @@ interface components$1 {
826
833
  * @description When the run failed
827
834
  */
828
835
  failedAt: string | null;
836
+ /** @description The reason the run failed */
837
+ failedReason: string | null;
829
838
  /** @description The unique identifier for the Monitor Run */
830
839
  id: string;
831
840
  /** @description The monitor that the run is associated with */
@@ -1020,6 +1029,8 @@ interface components$1 {
1020
1029
  status: WebsetStatus;
1021
1030
  /** @description The Streams for the Webset. */
1022
1031
  streams: unknown[];
1032
+ /** @description The title of the webset */
1033
+ title: string | null;
1023
1034
  /**
1024
1035
  * Format: date-time
1025
1036
  * @description The date and time the webset was updated
@@ -1214,7 +1225,10 @@ interface components$1 {
1214
1225
  snippet: string | null;
1215
1226
  /** @description The title of the reference */
1216
1227
  title: string | null;
1217
- /** @description The URL of the reference */
1228
+ /**
1229
+ * Format: uri
1230
+ * @description The URL of the reference
1231
+ */
1218
1232
  url: string;
1219
1233
  }[];
1220
1234
  /**
@@ -1527,10 +1541,6 @@ declare enum MonitorStatus {
1527
1541
  enabled = "enabled",
1528
1542
  disabled = "disabled"
1529
1543
  }
1530
- declare enum MonitorBehaviorConfigBehavior {
1531
- override = "override",
1532
- append = "append"
1533
- }
1534
1544
  declare enum MonitorRunObject {
1535
1545
  monitor_run = "monitor_run"
1536
1546
  }
@@ -1538,7 +1548,8 @@ declare enum MonitorRunStatus {
1538
1548
  created = "created",
1539
1549
  running = "running",
1540
1550
  completed = "completed",
1541
- canceled = "canceled"
1551
+ canceled = "canceled",
1552
+ failed = "failed"
1542
1553
  }
1543
1554
  declare enum MonitorRunType {
1544
1555
  search = "search",
@@ -1796,6 +1807,15 @@ declare class ImportsClient extends WebsetsBaseClient {
1796
1807
  * Client for managing Webset Items
1797
1808
  */
1798
1809
 
1810
+ /**
1811
+ * Options for listing webset items
1812
+ */
1813
+ interface ListWebsetItemsOptions extends PaginationParams {
1814
+ /**
1815
+ * The id of the source to filter items by
1816
+ */
1817
+ sourceId?: string;
1818
+ }
1799
1819
  /**
1800
1820
  * Client for managing Webset Items
1801
1821
  */
@@ -1803,24 +1823,24 @@ declare class WebsetItemsClient extends WebsetsBaseClient {
1803
1823
  /**
1804
1824
  * List all Items for a Webset
1805
1825
  * @param websetId The ID of the Webset
1806
- * @param params - Optional pagination parameters
1826
+ * @param params - Optional pagination and filtering parameters
1807
1827
  * @returns A promise that resolves with the list of Items
1808
1828
  */
1809
- list(websetId: string, params?: PaginationParams): Promise<ListWebsetItemResponse>;
1829
+ list(websetId: string, params?: ListWebsetItemsOptions): Promise<ListWebsetItemResponse>;
1810
1830
  /**
1811
1831
  * Iterate through all Items in a Webset, handling pagination automatically
1812
1832
  * @param websetId The ID of the Webset
1813
1833
  * @param options Pagination options
1814
1834
  * @returns Async generator of Webset Items
1815
1835
  */
1816
- listAll(websetId: string, options?: PaginationParams): AsyncGenerator<WebsetItem>;
1836
+ listAll(websetId: string, options?: ListWebsetItemsOptions): AsyncGenerator<WebsetItem>;
1817
1837
  /**
1818
1838
  * Collect all items from a Webset into an array
1819
1839
  * @param websetId The ID of the Webset
1820
1840
  * @param options Pagination options
1821
1841
  * @returns Promise resolving to an array of all Webset Items
1822
1842
  */
1823
- getAll(websetId: string, options?: PaginationParams): Promise<WebsetItem[]>;
1843
+ getAll(websetId: string, options?: ListWebsetItemsOptions): Promise<WebsetItem[]>;
1824
1844
  /**
1825
1845
  * Get an Item by ID
1826
1846
  * @param websetId The ID of the Webset
@@ -1959,6 +1979,10 @@ interface ListWebhookAttemptsOptions extends PaginationParams {
1959
1979
  * The type of event to filter by
1960
1980
  */
1961
1981
  eventType?: EventType;
1982
+ /**
1983
+ * Filter attempts by their success status
1984
+ */
1985
+ successful?: boolean;
1962
1986
  }
1963
1987
  /**
1964
1988
  * Client for managing Webset Webhooks
@@ -2185,6 +2209,10 @@ declare class ResearchBaseClient {
2185
2209
  */
2186
2210
  declare class ResearchClient extends ResearchBaseClient {
2187
2211
  constructor(client: Exa);
2212
+ /**
2213
+ * Create a new research task with Zod schema for strongly typed output
2214
+ */
2215
+ createTask<T>(params: ResearchCreateTaskParamsTyped<ZodSchema<T>>): Promise<SchemaResearchCreateTaskResponseDto>;
2188
2216
  /**
2189
2217
  * Create a new research task.
2190
2218
  *
@@ -2738,29 +2766,12 @@ type HighlightsContentsOptions = {
2738
2766
  */
2739
2767
  type SummaryContentsOptions = {
2740
2768
  query?: string;
2741
- schema?: JSONSchema;
2769
+ schema?: Record<string, unknown> | ZodSchema;
2742
2770
  };
2743
2771
  /**
2744
- * Represents a JSON Schema definition used for structured summary output.
2745
- * To learn more visit https://json-schema.org/overview/what-is-jsonschema.
2772
+ * @deprecated Use Record<string, unknown> instead.
2746
2773
  */
2747
- type JSONSchema = {
2748
- $schema?: string;
2749
- title?: string;
2750
- description?: string;
2751
- type: "object" | "array" | "string" | "number" | "boolean" | "null" | "integer";
2752
- properties?: Record<string, JSONSchema>;
2753
- items?: JSONSchema | JSONSchema[];
2754
- required?: string[];
2755
- enum?: any[];
2756
- additionalProperties?: boolean | JSONSchema;
2757
- definitions?: Record<string, JSONSchema>;
2758
- patternProperties?: Record<string, JSONSchema>;
2759
- allOf?: JSONSchema[];
2760
- anyOf?: JSONSchema[];
2761
- oneOf?: JSONSchema[];
2762
- not?: JSONSchema;
2763
- };
2774
+ type JSONSchema = Record<string, unknown>;
2764
2775
  /**
2765
2776
  * Options for retrieving the context from a list of search results. The context is a string
2766
2777
  * representation of all the search results.
@@ -2958,6 +2969,39 @@ type AnswerStreamResponse = {
2958
2969
  answer?: string;
2959
2970
  citations?: SearchResult<{}>[];
2960
2971
  };
2972
+ /**
2973
+ * Enhanced answer options that accepts either JSON schema or Zod schema
2974
+ */
2975
+ type AnswerOptionsTyped<T> = Omit<AnswerOptions, "outputSchema"> & {
2976
+ outputSchema: T;
2977
+ };
2978
+ /**
2979
+ * Enhanced answer response with strongly typed answer when using Zod
2980
+ */
2981
+ type AnswerResponseTyped<T> = Omit<AnswerResponse, "answer"> & {
2982
+ answer: T;
2983
+ };
2984
+ /**
2985
+ * Enhanced summary contents options that accepts either JSON schema or Zod schema
2986
+ */
2987
+ type SummaryContentsOptionsTyped<T> = Omit<SummaryContentsOptions, "schema"> & {
2988
+ schema: T;
2989
+ };
2990
+ /**
2991
+ * Enhanced research task output options that accepts either JSON schema or Zod schema
2992
+ */
2993
+ type ResearchTaskOutputTyped<T> = {
2994
+ inferSchema?: boolean;
2995
+ schema: T;
2996
+ };
2997
+ /**
2998
+ * Enhanced research task creation params with zod schema support
2999
+ */
3000
+ type ResearchCreateTaskParamsTyped<T> = {
3001
+ instructions: string;
3002
+ model?: "exa-research" | "exa-research-pro";
3003
+ output?: ResearchTaskOutputTyped<T>;
3004
+ };
2961
3005
  /**
2962
3006
  * The Exa class encapsulates the API's endpoints.
2963
3007
  */
@@ -3030,6 +3074,10 @@ declare class Exa {
3030
3074
  * @returns {Promise<SearchResponse<T>>} A list of document contents for the requested URLs.
3031
3075
  */
3032
3076
  getContents<T extends ContentsOptions>(urls: string | string[] | SearchResult<T>[], options?: T): Promise<SearchResponse<T>>;
3077
+ /**
3078
+ * Generate an answer with Zod schema for strongly typed output
3079
+ */
3080
+ answer<T>(query: string, options: AnswerOptionsTyped<ZodSchema<T>>): Promise<AnswerResponseTyped<T>>;
3033
3081
  /**
3034
3082
  * Generate an answer to a query.
3035
3083
  * @param {string} query - The question or query to answer.
@@ -3053,6 +3101,16 @@ declare class Exa {
3053
3101
  * ```
3054
3102
  */
3055
3103
  answer(query: string, options?: AnswerOptions): Promise<AnswerResponse>;
3104
+ /**
3105
+ * Stream an answer with Zod schema for structured output (non-streaming content)
3106
+ * Note: Structured output works only with non-streaming content, not with streaming chunks
3107
+ */
3108
+ streamAnswer<T>(query: string, options: {
3109
+ text?: boolean;
3110
+ model?: "exa" | "exa-pro";
3111
+ systemPrompt?: string;
3112
+ outputSchema: ZodSchema<T>;
3113
+ }): AsyncGenerator<AnswerStreamChunk>;
3056
3114
  /**
3057
3115
  * Stream an answer as an async generator
3058
3116
  *
@@ -3082,4 +3140,4 @@ declare class Exa {
3082
3140
  private parseSSEStream;
3083
3141
  }
3084
3142
 
3085
- export { type AnswerOptions, type AnswerResponse, 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, CreateWebsetParametersImportSource, CreateWebsetParametersSearchExcludeSource, type CreateWebsetSearchParameters, CreateWebsetSearchParametersExcludeSource, 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 SchemaListResearchTasksRequestDto as ListResearchTasksRequest, type SchemaListResearchTasksResponseDto as ListResearchTasksResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, type PersonEntity, type RegularSearchOptions, ResearchClient, type SchemaResearchCreateTaskRequestDto as ResearchCreateTaskRequest, type SchemaResearchCreateTaskResponseDto as ResearchCreateTaskResponse, type ResearchPaperEntity, type SchemaResearchTaskDto as ResearchTask, type ResearchTaskEvent, type ResearchTaskOperation, type SearchResponse, type SearchResult, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };
3143
+ 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, CreateWebsetParametersImportSource, CreateWebsetParametersSearchExcludeSource, type CreateWebsetSearchParameters, CreateWebsetSearchParametersExcludeSource, 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 SchemaListResearchTasksRequestDto as ListResearchTasksRequest, type SchemaListResearchTasksResponseDto as ListResearchTasksResponse, 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 RegularSearchOptions, ResearchClient, type ResearchCreateTaskParamsTyped, type SchemaResearchCreateTaskRequestDto as ResearchCreateTaskRequest, type SchemaResearchCreateTaskResponseDto as ResearchCreateTaskResponse, type ResearchPaperEntity, type SchemaResearchTaskDto as ResearchTask, type ResearchTaskEvent, type ResearchTaskOperation, type ResearchTaskOutputTyped, type SearchResponse, type SearchResult, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateWebhookParameters, type UpdateWebsetRequest, type WaitUntilCompletedOptions, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, Exa as default };