exa-js 2.25.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +124 -8
- package/dist/index.d.mts +839 -352
- package/dist/index.d.ts +839 -352
- package/dist/index.js +1430 -529
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1428 -529
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../package.json","../src/errors.ts","../src/zod-utils.ts","../src/agent/base.ts","../src/agent/betas.ts","../src/agent/monitors/types.ts","../src/agent/monitors/base.ts","../src/agent/monitors/client.ts","../src/agent/types.ts","../src/agent/client.ts","../src/monitors/base.ts","../src/monitors/client.ts","../src/research/base.ts","../src/research/client.ts","../src/websets/base.ts","../src/websets/enrichments.ts","../src/websets/events.ts","../src/websets/openapi.ts","../src/websets/imports.ts","../src/websets/items.ts","../src/websets/monitors.ts","../src/websets/searches.ts","../src/websets/webhooks.ts","../src/websets/client.ts","../src/tools/core.ts","../src/tools/anthropic.ts","../src/tools/openai.ts"],"sourcesContent":["import fetch, { Headers } from \"cross-fetch\";\nimport { ZodSchema } from \"zod\";\nimport packageJson from \"../package.json\";\nimport { AgentClient, BetaClient } from \"./agent/client\";\nimport { headersForBetas } from \"./agent/betas\";\nimport { ExaError, HttpStatusCode } from \"./errors\";\nimport { SearchMonitorsClient } from \"./monitors/client\";\nimport { ResearchClient } from \"./research/client\";\nimport { WebsetsClient } from \"./websets/client\";\nimport { isZodSchema, zodToJsonSchema } from \"./zod-utils\";\nimport { AnthropicTools } from \"./tools/anthropic\";\nimport { OpenAITools } from \"./tools/openai\";\nimport {\n createGetContentsTool,\n createWebSearchTool,\n ToolRegistry,\n type ToolNamespace,\n} from \"./tools/core\";\n\n// Use native fetch in Node.js environments\nconst fetchImpl =\n typeof global !== \"undefined\" && global.fetch ? global.fetch : fetch;\nconst HeadersImpl =\n typeof global !== \"undefined\" && global.Headers ? global.Headers : Headers;\n\nconst DEFAULT_MAX_CHARACTERS = 10_000;\n\n/** Exa-Beta token required for Dynamic Highlights (research preview). */\nexport const DYNAMIC_HIGHLIGHTS_BETA = \"dynamic-highlights-2026-08-28\";\n\n// Longest snippet of a non-JSON response body to include in error messages.\nconst NON_JSON_BODY_SNIPPET_LENGTH = 500;\n\n/**\n * Reads a fetch Response body once and attempts to parse it as JSON.\n *\n * API gateways and proxies (Cloudflare, load balancers, nginx) sometimes\n * return HTML or plain-text error pages even when the SDK expects JSON.\n * Calling `response.json()` on those bodies throws an opaque\n * `SyntaxError: Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON`\n * that hides the real HTTP status. Reading the body as text first lets the\n * caller surface the actual status and a snippet of the response instead.\n *\n * @returns The parsed JSON value (or `undefined` when the body is empty or not\n * valid JSON) alongside the raw response text.\n */\nasync function readResponseBody(\n response: Response\n): Promise<{ json: any; text: string }> {\n const text = await response.text();\n if (!text) {\n return { json: undefined, text };\n }\n try {\n return { json: JSON.parse(text), text };\n } catch {\n return { json: undefined, text };\n }\n}\n\n/**\n * Collapses whitespace and truncates a non-JSON response body so it stays\n * readable when embedded in an error message.\n */\nfunction truncateResponseBody(text: string): string {\n const collapsed = text.replace(/\\s+/g, \" \").trim();\n return collapsed.length > NON_JSON_BODY_SNIPPET_LENGTH\n ? `${collapsed.slice(0, NON_JSON_BODY_SNIPPET_LENGTH)}…`\n : collapsed;\n}\n\n/**\n * Options for retrieving page contents\n * @typedef {Object} ContentsOptions\n * @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.\n * @property {HighlightsContentsOptions | boolean} [highlights] - Recommended: `true`. Exa dynamically chooses the number of characters based on each document's relevance to your query.\n * @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.\n * @property {ContextOptions | boolean} [context] - DEPRECATED: Use `text` or `highlights` instead. Will be removed in a future version.\n * @property {number} [maxAgeHours] - Maximum age of cached content in hours. If content is older, it will be fetched fresh. Special values: 0 = always fetch fresh content, -1 = never fetch fresh (use cached content only). Example: 168 = fetch fresh for pages older than 7 days.\n * @property {string} [snapshotAsOf] - ISO 8601 datetime. Return the newest stored version at or before this instant instead of live content.\n * @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.\n * @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result.\n * @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.\n * @property {ExtrasOptions} [extras] - Miscelleneous data derived from results\n */\nexport type ContentsOptions = {\n text?: TextContentsOptions | true;\n /**\n * Recommended default: `true`. Exa dynamically chooses the number of\n * characters based on each document's relevance to your query.\n * Use this for concise AI context, RAG, and search previews without\n * choosing a character budget yourself. Read `result.highlights`.\n * Set `maxCharacters` only when your application has an explicit\n * character-limit requirement; it overrides the recommended default.\n */\n highlights?: HighlightsContentsOptions | true;\n summary?: SummaryContentsOptions | true;\n livecrawl?: LivecrawlOptions;\n /**\n * DEPRECATED: Use `text` or `highlights` instead. Will be removed in a future version.\n * @deprecated Use `text` or `highlights` instead. This legacy `context` field will be removed in a future version.\n */\n context?: ContextOptions | true;\n livecrawlTimeout?: number;\n maxAgeHours?: number;\n snapshotAsOf?: string;\n filterEmptyResults?: boolean;\n subpages?: number;\n subpageTarget?: string | string[];\n extras?: ExtrasOptions;\n};\n\nexport type RequestOptions = {\n /** Per-call body overrides, except stream. */\n body?: Record<string, unknown>;\n};\n\n/**\n * Options for performing a search query\n * @typedef {Object} SearchOptions\n * @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.\n * @property {number} [numResults] - Number of search results to return. Default 10.\n * @property {string[]} [includeDomains] - List of domains to include in the search.\n * @property {string[]} [excludeDomains] - List of domains to exclude in the search.\n * @property {string} [startCrawlDate] - Deprecated and will be removed in a future release. Start date for results based on crawl date.\n * @property {string} [endCrawlDate] - Deprecated and will be removed in a future release. End date for results based on crawl date.\n * @property {string} [startPublishedDate] - Start date for results based on published date.\n * @property {string} [endPublishedDate] - End date for results based on published date.\n * @property {string} [category] - A data category to focus on, with higher comprehensivity and data cleanliness.\n * @property {string[]} [includeText] - List of strings that must be present in webpage text of results. Currently only supports 1 string of up to 5 words.\n * @property {string[]} [excludeText] - List of strings that must not be present in webpage text of results. Currently only supports 1 string of up to 5 words.\n * @property {string[]} [flags] - Experimental flags\n * @property {string} [userLocation] - The two-letter ISO country code of the user, e.g. US.\n * @property {boolean} [stream] - Whether to stream back OpenAI-style chat completion chunks. Use `streamSearch()` instead of `search({ stream: true })`.\n */\nexport type BaseSearchOptions = {\n contents?: ContentsOptions;\n numResults?: number;\n includeDomains?: string[];\n excludeDomains?: string[];\n /** @deprecated Will be removed in a future release. Do not use in new code. */\n startCrawlDate?: string;\n /** @deprecated Will be removed in a future release. Do not use in new code. */\n endCrawlDate?: string;\n startPublishedDate?: string;\n endPublishedDate?: string;\n category?:\n | \"company\"\n | \"publication\"\n | \"news\"\n | \"personal site\"\n | \"financial report\"\n | \"people\";\n includeText?: string[];\n excludeText?: string[];\n flags?: string[];\n userLocation?: string;\n stream?: boolean;\n};\n\n/**\n * Base search options shared across all search types\n */\ntype BaseRegularSearchOptions = BaseSearchOptions & {\n /**\n * The broader goal this search serves: the task the caller is working on,\n * beyond the query itself. When an agent picks the query as one step of a\n * larger task, pass the goal of that step — which documents should rank\n * first, which should be excluded, and what to pull from them. Up to 4096\n * characters.\n */\n objective?: string;\n /**\n * If true, the search results are moderated for safety.\n */\n moderation?: boolean;\n useAutoprompt?: boolean;\n /**\n * Additional instructions that guide both the search process and the final returned synthesis.\n * Use this to prefer certain sources, emphasize novelty, avoid duplicates, or constrain output style.\n */\n systemPrompt?: string;\n /**\n * Output schema for search responses. When provided, the API returns synthesized output in `output`.\n * - `type: \"text\"` for plain text output (optionally guided by `description`)\n * - `type: \"object\"` for structured JSON output\n *\n * Note: For object schemas, the API enforces max depth 2 and max 10 total properties.\n */\n outputSchema?: DeepOutputSchema;\n};\n\nexport type DeepSearchType = \"deep-lite\" | \"deep\" | \"deep-reasoning\";\n\n/**\n * Deep search output schema mode for plain text responses.\n */\nexport type DeepTextOutputSchema = {\n type: \"text\";\n /**\n * Optional formatting guidance for text output.\n */\n description?: string;\n};\n\n/**\n * Deep search output schema mode for structured JSON object responses.\n */\nexport type DeepObjectOutputSchema = {\n type: \"object\";\n /**\n * JSON-schema-style properties for the result object.\n */\n properties?: Record<string, unknown>;\n /**\n * Required property names.\n */\n required?: string[];\n};\n\n/**\n * Search output schema.\n * - `type: \"text\"` returns plain text in `output.content` (with optional description guidance).\n * - `type: \"object\"` returns structured JSON in `output.content`.\n *\n * Note: For object schemas, the API enforces a maximum nesting depth of 2 and a maximum of 10 total properties.\n */\nexport type DeepOutputSchema = DeepTextOutputSchema | DeepObjectOutputSchema;\n\n/**\n * Contents options for deep search.\n */\ntype DeepContentsOptions = Omit<ContentsOptions, \"context\"> & {\n /**\n * DEPRECATED: Use `text` or `highlights` instead. Will be removed in a future version.\n * @deprecated Use `text` or `highlights` instead. This legacy `context` field will be removed in a future version.\n */\n context?: ContextOptions | true;\n};\n\n/**\n * Search options for deep search types, which additionally support additional queries.\n */\ntype DeepSearchOptions = Omit<BaseRegularSearchOptions, \"contents\"> & {\n type: DeepSearchType;\n /**\n * Alternative query formulations for deep search variants to skip automatic LLM-based query expansion.\n * Max 5 queries.\n * @example [\"machine learning\", \"ML algorithms\", \"neural networks\"]\n */\n additionalQueries?: string[];\n /**\n * Options for retrieving page contents.\n */\n contents?: DeepContentsOptions;\n};\n\n/**\n * Search options for non-deep search types (keyword, neural, auto, hybrid, fast, instant)\n */\ntype NonDeepSearchOptions = BaseRegularSearchOptions & {\n type?: \"keyword\" | \"neural\" | \"auto\" | \"hybrid\" | \"fast\" | \"instant\";\n};\n\n/**\n * Search options for performing a search query.\n * Uses a discriminated union to ensure additionalQueries is only allowed when type is a deep search variant.\n */\nexport type RegularSearchOptions = DeepSearchOptions | NonDeepSearchOptions;\n\n/**\n * Options for opting into Exa-Beta features.\n * @typedef {Object} BetaOptions\n * @property {string[]} [betas] - Exa-Beta tokens to send with the request (e.g. `[DYNAMIC_HIGHLIGHTS_BETA]` for Dynamic Highlights).\n */\nexport type BetaOptions = {\n betas?: string[];\n};\n\n/**\n * DEPRECATED: Used only by deprecated `findSimilar()` APIs. Use `search()` and `RegularSearchOptions` for new search flows. Will be removed in a future version.\n * @deprecated Use `search()` and `RegularSearchOptions` for new search flows. There is no direct replacement for URL-based similarity.\n *\n * Options for finding similar links.\n * @typedef {Object} FindSimilarOptions\n * @property {boolean} [excludeSourceDomain] - If true, excludes links from the base domain of the input.\n */\nexport type FindSimilarOptions = BaseSearchOptions & {\n excludeSourceDomain?: boolean;\n};\n\nexport type ExtrasOptions = { links?: number; imageLinks?: number };\n\n/**\n * Options for livecrawling contents\n * @typedef {string} LivecrawlOptions\n */\nexport type LivecrawlOptions =\n | \"never\"\n | \"fallback\"\n | \"always\"\n | \"auto\"\n | \"preferred\";\n\n/**\n * Verbosity levels for content filtering.\n * - compact: Most concise output, main content only (default)\n * - standard: Balanced content with more detail\n * - full: Complete content including all sections\n */\nexport type VerbosityOptions = \"compact\" | \"standard\" | \"full\";\n\n/**\n * Section tags for semantic content filtering.\n */\nexport type SectionTag =\n | \"unspecified\"\n | \"header\"\n | \"navigation\"\n | \"banner\"\n | \"body\"\n | \"sidebar\"\n | \"footer\"\n | \"metadata\";\n\n/**\n * Options for retrieving text from page.\n * @typedef {Object} TextContentsOptions\n * @property {number} [maxCharacters] - The maximum number of characters to return.\n * @property {boolean} [includeHtmlTags] - If true, includes HTML tags in the returned text. Default: false\n * @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: \"compact\". Requires maxAgeHours: 0.\n * @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires maxAgeHours: 0.\n * @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires maxAgeHours: 0.\n */\nexport type TextContentsOptions = {\n maxCharacters?: number;\n includeHtmlTags?: boolean;\n verbosity?: VerbosityOptions;\n includeSections?: SectionTag[];\n excludeSections?: SectionTag[];\n};\n\n/**\n * Overrides for highlights. Prefer `highlights: true`: Exa dynamically\n * chooses the number of characters based on each document's relevance\n * to your query. A request for concise context does not require setting\n * a fixed character budget.\n * Deep search variants also support these options for returned highlights.\n * @typedef {Object} HighlightsContentsOptions\n * @property {string} [query] - The query string to use for highlights search.\n * @property {number} [maxCharacters] - Explicit character-limit override. Prefer `highlights: true` unless your application requires a specific limit. Not compatible with `dynamic`.\n * @property {boolean} [dynamic] - Enable Dynamic Highlights (research preview): allocates one shared context budget across all results instead of a per-document budget; the model sizes the output itself. Not compatible with `maxCharacters`. Beta: requires passing `betas: [DYNAMIC_HIGHLIGHTS_BETA]` to the request.\n * @property {number} [numSentences] - DEPRECATED: Use maxCharacters instead.\n * @property {number} [highlightsPerUrl] - DEPRECATED: Use maxCharacters instead.\n */\nexport type HighlightsContentsOptions = {\n query?: string;\n /**\n * Override for an explicit application character limit. Prefer\n * `highlights: true` to let Exa choose the length based on relevance.\n * A general need for concise context does not require a fixed limit.\n */\n maxCharacters?: number;\n dynamic?: boolean;\n /**\n * DEPRECATED: Use `maxCharacters` instead. Will be removed in a future version.\n * @deprecated Use `maxCharacters` instead. This legacy sizing field will be removed in a future version.\n */\n numSentences?: number;\n /**\n * DEPRECATED: Use `maxCharacters` instead. Will be removed in a future version.\n * @deprecated Use `maxCharacters` instead. This legacy sizing field will be removed in a future version.\n */\n highlightsPerUrl?: number;\n};\n/**\n * Options for retrieving summary from page.\n * @typedef {Object} SummaryContentsOptions\n * @property {string} [query] - The query string to use for summary generation.\n * @property {Record<string, unknown> | ZodSchema} [schema] - JSON schema for structured output from summary.\n */\nexport type SummaryContentsOptions = {\n query?: string;\n schema?: Record<string, unknown> | ZodSchema;\n};\n\n/**\n * DEPRECATED: Use `Record<string, unknown>` instead. Will be removed in a future version.\n * @deprecated Use `Record<string, unknown>` instead.\n */\nexport type JSONSchema = Record<string, unknown>;\n\n/**\n * DEPRECATED: Use `text` or `highlights` instead. Will be removed in a future version.\n * @deprecated Use `text` or `highlights` instead. The `context` option will be removed in a future version.\n *\n * Options for retrieving the context from a list of search results. The context is a string\n * representation of all the search results.\n * @typedef {Object} ContextOptions\n * @property {number} [maxCharacters] - The maximum number of characters.\n */\nexport type ContextOptions = {\n maxCharacters?: number;\n};\n\n/**\n * @typedef {Object} TextResponse\n * @property {string} text - Text from page\n */\nexport type TextResponse = { text: string };\n\n/**\n * @typedef {Object} HighlightsResponse\n * @property {string[]} highlights - The highlights as an array of strings.\n * @property {number[]} [highlightScores] - The corresponding scores as an array of floats, 0 to 1\n */\nexport type HighlightsResponse = {\n highlights: string[];\n highlightScores?: number[];\n};\n\n/**\n * @typedef {Object} SummaryResponse\n * @property {string} summary - The generated summary of the page content.\n */\nexport type SummaryResponse = { summary: string };\n\n/**\n * @typedef {Object} ExtrasResponse\n * @property {string[]} links - The links on the page of a result\n * @property {string[]} imageLinks - The image links on the page of a result\n */\nexport type ExtrasResponse = {\n extras: { links?: string[]; imageLinks?: string[] };\n};\n\n/**\n * @typedef {Object} SubpagesResponse\n * @property {ContentsResultComponent<T extends ContentsOptions>} subpages - The subpages for a result\n */\nexport type SubpagesResponse<T extends ContentsOptions> = {\n subpages: ContentsResultComponent<T>[];\n};\n\nexport type Default<T extends {}, U> = [keyof T] extends [never] ? U : T;\n\n/**\n * @typedef {Object} ContentsResultComponent\n * Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'HighlightsResponse', 'SummaryResponse', or an empty object.\n *\n * @template T - A type extending from 'ContentsOptions'.\n */\nexport type ContentsResultComponent<T extends ContentsOptions> =\n (T[\"text\"] extends object | true ? TextResponse : {}) &\n (T[\"highlights\"] extends object | true ? HighlightsResponse : {}) &\n (T[\"summary\"] extends object | true ? SummaryResponse : {}) &\n (T[\"subpages\"] extends number ? SubpagesResponse<T> : {}) &\n (T[\"extras\"] extends object ? ExtrasResponse : {});\n\n/**\n * Represents the cost breakdown related to contents retrieval. Fields are optional because\n * only non-zero costs are included.\n * @typedef {Object} CostDollarsContents\n * @property {number} [text] - The cost in dollars for retrieving text.\n * @property {number} [highlights] - The cost in dollars for retrieving highlights.\n * @property {number} [summary] - The cost in dollars for retrieving summary.\n */\nexport type CostDollarsContents = {\n text?: number;\n highlights?: number;\n summary?: number;\n};\n\n/**\n * Represents the cost breakdown related to search. Fields are optional because\n * only non-zero costs are included.\n * @typedef {Object} CostDollarsSeearch\n * @property {number} [neural] - The cost in dollars for neural search.\n * @property {number} [keyword] - The cost in dollars for keyword search.\n */\nexport type CostDollarsSeearch = {\n neural?: number;\n keyword?: number;\n};\n\n/**\n * Represents the total cost breakdown. Only non-zero costs are included.\n * @typedef {Object} CostDollars\n * @property {number} total - The total cost in dollars.\n * @property {CostDollarsSeearch} [search] - The cost breakdown for search.\n * @property {CostDollarsContents} [contents] - The cost breakdown for contents.\n */\nexport type CostDollars = {\n total: number;\n search?: CostDollarsSeearch;\n contents?: CostDollarsContents;\n};\n\n/**\n * Entity types for company/people search results.\n * Only returned when using category=company or category=people searches.\n */\n\n/** Company workforce information. */\nexport type EntityCompanyPropertiesWorkforce = {\n total?: number | null;\n};\n\n/** Company headquarters information. */\nexport type EntityCompanyPropertiesHeadquarters = {\n address?: string | null;\n city?: string | null;\n postalCode?: string | null;\n country?: string | null;\n};\n\n/** Funding round information. */\nexport type EntityCompanyPropertiesFundingRound = {\n name?: string | null;\n date?: string | null;\n amount?: number | null;\n};\n\n/** Company financial information. */\nexport type EntityCompanyPropertiesFinancials = {\n revenueAnnual?: number | null;\n fundingTotal?: number | null;\n fundingLatestRound?: EntityCompanyPropertiesFundingRound | null;\n};\n\n/** Company web traffic information. */\nexport type EntityCompanyPropertiesWebTraffic = {\n visitsMonthly?: number | null;\n};\n\n/** Structured properties for a company entity. */\nexport type EntityCompanyProperties = {\n name?: string | null;\n foundedYear?: number | null;\n description?: string | null;\n workforce?: EntityCompanyPropertiesWorkforce | null;\n headquarters?: EntityCompanyPropertiesHeadquarters | null;\n financials?: EntityCompanyPropertiesFinancials | null;\n webTraffic?: EntityCompanyPropertiesWebTraffic | null;\n};\n\n/** Date range for work history entries. */\nexport type EntityDateRange = {\n from?: string | null;\n to?: string | null;\n};\n\n/** Reference to a company in work history. */\nexport type EntityPersonPropertiesCompanyRef = {\n id?: string | null;\n name?: string | null;\n};\n\n/** A single work history entry for a person. */\nexport type EntityPersonPropertiesWorkHistoryEntry = {\n title?: string | null;\n location?: string | null;\n dates?: EntityDateRange | null;\n company?: EntityPersonPropertiesCompanyRef | null;\n};\n\n/** Structured properties for a person entity. */\nexport type EntityPersonProperties = {\n name?: string | null;\n location?: string | null;\n workHistory?: EntityPersonPropertiesWorkHistoryEntry[];\n};\n\n/** Structured entity data for a company. */\nexport type CompanyEntity = {\n id: string;\n type: \"company\";\n version: number;\n properties: EntityCompanyProperties;\n};\n\n/** Structured entity data for a person. */\nexport type PersonEntity = {\n id: string;\n type: \"person\";\n version: number;\n properties: EntityPersonProperties;\n};\n\n/** Structured entity data for company or person search results. */\nexport type Entity = CompanyEntity | PersonEntity;\n\n/**\n * Represents a search result object.\n * @typedef {Object} SearchResult\n * @property {string} title - The title of the search result.\n * @property {string} url - The URL of the search result.\n * @property {string} [publishedDate] - The estimated creation date of the content.\n * @property {string} [author] - The author of the content, if available.\n * @property {number} [score] - Similarity score between the query/url and the result.\n * @property {string} id - The temporary ID for the document.\n * @property {string} [image] - A representative image for the content, if any.\n * @property {string} [favicon] - A favicon for the site, if any.\n * @property {string} [snapshotAt] - Crawl instant of the stored version served for a snapshotAsOf request.\n * @property {Entity[]} [entities] - Structured entity data for company or person search results.\n */\nexport type SearchResult<T extends ContentsOptions> = {\n title: string | null;\n url: string;\n publishedDate?: string;\n author?: string;\n score?: number;\n id: string;\n image?: string;\n favicon?: string;\n snapshotAt?: string;\n entities?: Entity[];\n} & ContentsResultComponent<T>;\n\nexport type DeepSearchOutputGroundingCitation = {\n url: string;\n title: string;\n};\n\nexport type DeepSearchOutputGroundingConfidence = \"low\" | \"medium\" | \"high\";\n\nexport type DeepSearchOutputGrounding = {\n field: string;\n citations: DeepSearchOutputGroundingCitation[];\n confidence: DeepSearchOutputGroundingConfidence;\n};\n\nexport type DeepSearchOutput = {\n content: string | Record<string, unknown>;\n grounding: DeepSearchOutputGrounding[];\n};\n\n/**\n * Represents a search response object.\n * @typedef {Object} SearchResponse\n * @property {Result[]} results - The list of search results.\n * @property {string} [context] - DEPRECATED: Use `text` or `highlights` on individual results instead. Will be removed in a future version.\n * @property {DeepSearchOutput} [output] - Search synthesized output object returned when `outputSchema` is provided.\n * @property {string} [autoDate] - The autoprompt date, if applicable.\n * @property {string} requestId - The request ID for the search.\n * @property {CostDollars} [costDollars] - The cost breakdown for this request.\n * @property {string} [resolvedSearchType] - The resolved search type ('neural' or 'keyword') when using 'auto' search.\n * @property {number} [searchTime] - Time taken for the search in milliseconds.\n */\nexport type SearchResponse<T extends ContentsOptions> = {\n results: SearchResult<T>[];\n /**\n * DEPRECATED: Use `text` or `highlights` on individual results instead. Will be removed in a future version.\n * @deprecated Use `text` or `highlights` on individual results instead. This legacy `context` field will be removed in a future version.\n */\n context?: string;\n output?: DeepSearchOutput;\n autoDate?: string;\n requestId: string;\n statuses?: Array<Status>;\n costDollars?: CostDollars;\n resolvedSearchType?: string;\n searchTime?: number;\n};\n\n/** Error details for a failed content retrieval. */\nexport type ContentStatusError = {\n tag?: string;\n httpStatusCode?: number | null;\n};\n\n/** Status information for a requested URL. */\nexport type Status = {\n id: string;\n status: string;\n source?: string;\n error?: ContentStatusError | null;\n};\n\n/**\n * Options for the answer endpoint\n * @typedef {Object} AnswerOptions\n * @property {boolean} [stream] - Whether to stream the response. Default false.\n * @property {boolean} [text] - Whether to include text in the source results. Default false.\n * @property {\"exa\"} [model] - The model to use for generating the answer. Default \"exa\".\n * @property {string} [systemPrompt] - A system prompt to guide the LLM's behavior when generating the answer.\n * @property {Object} [outputSchema] - A JSON Schema specification for the structure you expect the output to take\n */\nexport type AnswerOptions = {\n stream?: boolean;\n text?: boolean;\n model?: \"exa\";\n systemPrompt?: string;\n outputSchema?: Record<string, unknown>;\n userLocation?: string;\n};\n\n/**\n * Represents an answer response object from the /answer endpoint.\n * @typedef {Object} AnswerResponse\n * @property {string | Object} answer - The generated answer text (or an object matching `outputSchema`, if provided)\n * @property {SearchResult<{}>[]} citations - The sources used to generate the answer.\n * @property {CostDollars} [costDollars] - The cost breakdown for this request.\n * @property {string} [requestId] - Optional request ID for the answer.\n */\nexport type AnswerResponse = {\n answer: string | Record<string, unknown>;\n citations: SearchResult<{}>[];\n requestId?: string;\n costDollars?: CostDollars;\n};\n\nexport type AnswerStreamChunk = {\n /**\n * The partial text content of the answer (if present in this chunk).\n */\n content?: string;\n /**\n * Citations associated with the current chunk of text (if present).\n */\n citations?: Array<{\n id: string;\n url: string;\n title?: string;\n publishedDate?: string;\n author?: string;\n text?: string;\n }>;\n};\n\nexport type SearchStreamChunk = AnswerStreamChunk;\n\n/**\n * Represents a streaming answer response chunk from the /answer endpoint.\n * @typedef {Object} AnswerStreamResponse\n * @property {string} [answer] - A chunk of the generated answer text.\n * @property {SearchResult<{}>[]]} [citations] - The sources used to generate the answer.\n */\nexport type AnswerStreamResponse = {\n answer?: string;\n citations?: SearchResult<{}>[];\n};\n\n// ==========================================\n// Zod-Enhanced Types\n// ==========================================\n\n/**\n * Enhanced answer options that accepts either JSON schema or Zod schema\n */\nexport type AnswerOptionsTyped<T> = Omit<AnswerOptions, \"outputSchema\"> & {\n outputSchema: T;\n};\n\n/**\n * Enhanced answer response with strongly typed answer when using Zod\n */\nexport type AnswerResponseTyped<T> = Omit<AnswerResponse, \"answer\"> & {\n answer: T;\n};\n\n/**\n * Enhanced summary contents options that accepts either JSON schema or Zod schema\n */\nexport type SummaryContentsOptionsTyped<T> = Omit<\n SummaryContentsOptions,\n \"schema\"\n> & {\n schema: T;\n};\n\n/**\n * The Exa class encapsulates the API's endpoints.\n */\nexport class Exa {\n private baseURL: string;\n private headers: Headers;\n\n /**\n * Websets API client\n */\n websets: WebsetsClient;\n\n /**\n * Research API client\n */\n research: ResearchClient;\n\n /**\n * Search Monitors API client\n */\n monitors: SearchMonitorsClient;\n\n /**\n * Agent API client\n */\n agent: AgentClient;\n\n /**\n * Beta API clients\n */\n beta: BetaClient;\n\n /** Provider-neutral Exa tools. */\n tools: ToolNamespace;\n\n /** OpenAI Chat Completions and Responses API tools. */\n openai: OpenAITools;\n\n /** Anthropic Messages API tools. */\n anthropic: AnthropicTools;\n\n private readonly toolRegistry = new ToolRegistry();\n\n /**\n * Helper method to separate out the contents-specific options from the rest.\n */\n private extractContentsOptions<T extends ContentsOptions>(\n options: T\n ): {\n contentsOptions: ContentsOptions;\n restOptions: Omit<T, keyof ContentsOptions>;\n } {\n const {\n text,\n highlights,\n summary,\n subpages,\n subpageTarget,\n extras,\n livecrawl,\n livecrawlTimeout,\n maxAgeHours,\n snapshotAsOf,\n // DEPRECATED FIELD: preserve legacy `context` only for backward compatibility.\n context,\n ...rest\n } = options;\n\n const contentsOptions: ContentsOptions = {};\n\n // Default: if none of text, summary, or highlights is provided, we retrieve text\n if (\n text === undefined &&\n summary === undefined &&\n highlights === undefined &&\n extras === undefined\n ) {\n contentsOptions.text = true;\n }\n\n if (text !== undefined) contentsOptions.text = text;\n if (highlights !== undefined) contentsOptions.highlights = highlights;\n if (summary !== undefined) {\n // Handle zod schema conversion for summary\n if (\n typeof summary === \"object\" &&\n summary !== null &&\n \"schema\" in summary &&\n summary.schema &&\n isZodSchema(summary.schema)\n ) {\n contentsOptions.summary = {\n ...summary,\n schema: zodToJsonSchema(summary.schema),\n };\n } else {\n contentsOptions.summary = summary;\n }\n }\n if (subpages !== undefined) contentsOptions.subpages = subpages;\n if (subpageTarget !== undefined)\n contentsOptions.subpageTarget = subpageTarget;\n if (extras !== undefined) contentsOptions.extras = extras;\n if (livecrawl !== undefined) contentsOptions.livecrawl = livecrawl;\n if (livecrawlTimeout !== undefined)\n contentsOptions.livecrawlTimeout = livecrawlTimeout;\n if (maxAgeHours !== undefined) contentsOptions.maxAgeHours = maxAgeHours;\n if (snapshotAsOf !== undefined) contentsOptions.snapshotAsOf = snapshotAsOf;\n // DEPRECATED FIELD: pass through only so existing callers do not break.\n if (context !== undefined) contentsOptions.context = context;\n\n return {\n contentsOptions,\n restOptions: rest as Omit<T, keyof ContentsOptions>,\n };\n }\n\n private mergeSearchRequestBody(\n body: Record<string, unknown>,\n requestOptions?: RequestOptions\n ): Record<string, unknown> {\n const merged = { ...body, ...requestOptions?.body };\n delete merged.stream;\n return merged;\n }\n\n private buildSearchRequestBody(\n query: string,\n options?: RegularSearchOptions & {\n contents?: ContentsOptions | false | null | undefined;\n },\n requestOptions?: RequestOptions\n ): Record<string, unknown> {\n const body = { ...(options ?? {}) } as Record<string, unknown>;\n delete body.betas;\n if (options === undefined || !(\"contents\" in options)) {\n body.contents = { text: { maxCharacters: DEFAULT_MAX_CHARACTERS } };\n } else if (\n options.contents === false ||\n options.contents === null ||\n options.contents === undefined\n ) {\n delete body.contents;\n }\n return this.mergeSearchRequestBody({ query, ...body }, requestOptions);\n }\n\n /**\n * Constructs the Exa API client.\n * @param {string} apiKey - The API key for authentication.\n * @param {string} [baseURL] - The base URL of the Exa API.\n */\n constructor(apiKey?: string, baseURL: string = \"https://api.exa.ai\") {\n this.baseURL = baseURL;\n if (!apiKey) {\n apiKey = process.env.EXA_API_KEY;\n if (!apiKey) {\n throw new ExaError(\n \"API key must be provided as an argument or as an environment variable (EXA_API_KEY)\",\n HttpStatusCode.Unauthorized\n );\n }\n }\n this.headers = new HeadersImpl({\n \"x-api-key\": apiKey,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `exa-node ${packageJson.version}`,\n });\n\n // Initialize the Websets client\n this.websets = new WebsetsClient(this);\n // Initialize the Research client\n this.research = new ResearchClient(this);\n // Initialize the Search Monitors client\n this.monitors = new SearchMonitorsClient(this);\n // Initialize the Agent client\n this.agent = new AgentClient(this);\n // Initialize beta clients\n this.beta = new BetaClient(this.agent);\n this.tools = {\n webSearch: (options) =>\n createWebSearchTool(this, this.toolRegistry, options),\n getContents: (options) =>\n createGetContentsTool(this, this.toolRegistry, options),\n };\n this.openai = new OpenAITools(this, this.toolRegistry);\n this.anthropic = new AnthropicTools(this, this.toolRegistry);\n }\n\n /**\n * Makes a request to the Exa API.\n * @param {string} endpoint - The API endpoint to call.\n * @param {string} method - The HTTP method to use.\n * @param {any} [body] - The request body for POST requests.\n * @param {Record<string, any>} [params] - The query parameters.\n * @returns {Promise<any>} The response from the API.\n * @throws {ExaError} When any API request fails with structured error information\n */\n async request<T = unknown>(\n endpoint: string,\n method: string,\n body?: any,\n params?: Record<string, any>,\n headers?: Record<string, string>\n ): Promise<T> {\n // Build URL with query parameters if provided\n let url = this.baseURL + endpoint;\n if (params && Object.keys(params).length > 0) {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, item);\n }\n } else if (value !== undefined) {\n searchParams.append(key, String(value));\n }\n }\n url += `?${searchParams.toString()}`;\n }\n\n let combinedHeaders: Record<string, string> = {};\n\n if (this.headers instanceof HeadersImpl) {\n this.headers.forEach((value, key) => {\n combinedHeaders[key] = value;\n });\n } else {\n combinedHeaders = { ...(this.headers as Record<string, string>) };\n }\n\n if (headers) {\n combinedHeaders = { ...combinedHeaders, ...headers };\n }\n\n const response = await fetchImpl(url, {\n method,\n headers: combinedHeaders,\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!response.ok) {\n const { json, text } = await readResponseBody(response);\n\n // Gateways/proxies can return non-JSON (e.g. HTML) error pages. Surface\n // the real status and a snippet of the body rather than throwing an\n // opaque JSON parse error that hides the underlying failure.\n if (!json || typeof json !== \"object\") {\n const snippet = truncateResponseBody(text);\n const message = snippet\n ? `Request failed with status ${response.status}. Response body was not valid JSON: ${snippet}`\n : `Request failed with status ${response.status}.`;\n throw new ExaError(\n message,\n response.status,\n new Date().toISOString(),\n endpoint\n );\n }\n\n const errorData = json;\n if (!errorData.statusCode) {\n errorData.statusCode = response.status;\n }\n if (!errorData.timestamp) {\n errorData.timestamp = new Date().toISOString();\n }\n if (!errorData.path) {\n errorData.path = endpoint;\n }\n\n // Structured envelope (`error` is an object): message and metadata live\n // inside it — e.g. { error: { type, code, message, detail }, requestId }.\n const envelope =\n typeof errorData.error === \"object\" && errorData.error !== null\n ? (errorData.error as {\n type?: string;\n code?: string;\n message?: string;\n detail?: unknown;\n requestId?: string;\n })\n : undefined;\n let message: string;\n if (envelope) {\n message = envelope.message || errorData.message || \"Unknown error\";\n } else {\n message = errorData.error || \"Unknown error\";\n if (errorData.message) {\n message += (message.length > 0 ? \". \" : \"\") + errorData.message;\n }\n }\n throw new ExaError(\n message,\n response.status,\n errorData.timestamp,\n errorData.path,\n envelope\n ? {\n type: envelope.type,\n code: envelope.code,\n detail: envelope.detail,\n requestId: errorData.requestId ?? envelope.requestId,\n }\n : errorData.requestId\n ? { requestId: errorData.requestId }\n : undefined\n );\n }\n\n // If the server responded with an SSE stream, parse it and return the final payload.\n const contentType = response.headers.get(\"content-type\") || \"\";\n if (contentType.includes(\"text/event-stream\")) {\n return (await this.parseSSEStream<T>(response)) as T;\n }\n\n const { json, text } = await readResponseBody(response);\n\n // A successful status with a non-JSON body usually means a proxy returned\n // an error/redirect page; surface it instead of an opaque parse error.\n if (json === undefined && text) {\n throw new ExaError(\n `Expected a JSON response but received a non-JSON body (status ${response.status}): ${truncateResponseBody(text)}`,\n response.status,\n new Date().toISOString(),\n endpoint\n );\n }\n\n return json as T;\n }\n\n async rawRequest(\n endpoint: string,\n method: string = \"POST\",\n body?: Record<string, unknown>,\n queryParams?: Record<\n string,\n string | number | boolean | string[] | undefined\n >,\n headers?: Record<string, string>\n ): Promise<Response> {\n let url = this.baseURL + endpoint;\n\n if (queryParams) {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(queryParams)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, String(item));\n }\n } else if (value !== undefined) {\n searchParams.append(key, String(value));\n }\n }\n url += `?${searchParams.toString()}`;\n }\n\n let combinedHeaders: Record<string, string> = {};\n\n if (this.headers instanceof HeadersImpl) {\n this.headers.forEach((value, key) => {\n combinedHeaders[key] = value;\n });\n } else {\n combinedHeaders = { ...(this.headers as Record<string, string>) };\n }\n\n if (headers) {\n combinedHeaders = { ...combinedHeaders, ...headers };\n }\n\n const response = await fetchImpl(url, {\n method,\n headers: combinedHeaders,\n body: body ? JSON.stringify(body) : undefined,\n });\n\n return response;\n }\n\n /**\n * Performs a search with an Exa prompt-engineered query.\n * For AI answers, RAG, and search previews, prefer query-relevant passages:\n * `exa.search(query, { contents: { highlights: true } })`.\n * `highlights: true` is the recommended default: Exa dynamically chooses\n * the number of characters based on each document's relevance to your query.\n * You do not need to choose `maxCharacters` to keep context concise;\n * use it only for an explicit application character-limit requirement.\n * Read each result's `highlights` array. Request `text` only when you need\n * the full page; use `contents: false` when you only need titles and URLs.\n * Omitting contents still returns text by default.\n *\n * @param {string} query - The query string.\n * @param {RequestOptions} [requestOptions] - Per-call body overrides.\n * @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of relevant search results with text contents.\n */\n async search(\n query: string,\n options?: undefined,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>;\n /**\n * Performs a search without contents.\n *\n * @param {string} query - The query string.\n * @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled\n * @param {RequestOptions} [requestOptions] - Per-call body overrides.\n * @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.\n */\n async search(\n query: string,\n options: RegularSearchOptions &\n BetaOptions & { contents: false | null | undefined },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{}>>;\n /**\n * Performs a search with specific contents.\n * Prefer `{ contents: { highlights: true } }` for query-relevant passages\n * for AI answers, RAG, and search previews. Read `result.highlights`.\n * `highlights: true` is the recommended default: Exa dynamically chooses\n * the number of characters based on each document's relevance to your query.\n * No manual character budget is needed. Set `maxCharacters` only when\n * your application requires a specific numeric character limit; otherwise\n * keep `highlights: true`.\n * Use the boolean `true`; do not set the deprecated `numSentences` or\n * `highlightsPerUrl` options. Request `text` when you need the full page.\n *\n * @example\n * const response = await exa.search(\"recent advances in battery recycling\", {\n * contents: { highlights: true },\n * });\n * for (const result of response.results) {\n * console.log(result.url, result.highlights);\n * }\n *\n * @param {string} query - The query string.\n * @param {RegularSearchOptions & { contents: T }} options - Search options with specific contents\n * @param {RequestOptions} [requestOptions] - Per-call body overrides.\n * @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.\n */\n async search<T extends ContentsOptions>(\n query: string,\n options: RegularSearchOptions & BetaOptions & { contents: T },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>>;\n /**\n * Performs a search with an Exa prompt-engineered query.\n * When no contents option is specified, returns text contents by default.\n * For query-relevant passages, explicitly pass\n * `{ contents: { highlights: true } }` and read `result.highlights`.\n *\n * @param {string} query - The query string.\n * @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents\n * @param {RequestOptions} [requestOptions] - Per-call body overrides.\n * @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.\n */\n async search(\n query: string,\n options: (\n | Omit<DeepSearchOptions, \"contents\">\n | Omit<NonDeepSearchOptions, \"contents\">\n ) &\n BetaOptions,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{ text: true }>>;\n async search<T extends ContentsOptions>(\n query: string,\n options?: RegularSearchOptions &\n BetaOptions & { contents?: T | false | null | undefined },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T | { text: true } | {}>> {\n if (options?.stream) {\n throw new ExaError(\n \"For streaming responses, please use streamSearch() instead:\\n\\n\" +\n \"for await (const chunk of exa.streamSearch(query)) {\\n\" +\n \" // Handle chunks\\n\" +\n \"}\",\n HttpStatusCode.BadRequest\n );\n }\n\n const body = this.buildSearchRequestBody(query, options, requestOptions);\n const betaHeaders = headersForBetas(options?.betas);\n return betaHeaders\n ? await this.request(\"/search\", \"POST\", body, undefined, betaHeaders)\n : await this.request(\"/search\", \"POST\", body);\n }\n\n /**\n * Stream a search response as an async generator of OpenAI-style chat completion chunks.\n *\n * Each iteration yields a chunk with partial text (`content`) or new citations.\n * Use this if you'd like to read synthesized search output incrementally.\n * @param {RequestOptions} [requestOptions] - Per-call body overrides.\n */\n streamSearch(\n query: string,\n options?: RegularSearchOptions & {\n contents?: ContentsOptions | false | null | undefined;\n },\n requestOptions?: RequestOptions\n ): AsyncGenerator<SearchStreamChunk> {\n return this.streamChatCompletions(\"/search\", {\n ...this.buildSearchRequestBody(query, options, requestOptions),\n stream: true,\n });\n }\n\n /**\n * DEPRECATED: Use `search()` instead. This legacy wrapper will be removed in a future version.\n * @deprecated Use `search()` instead. The search method now returns text contents by default.\n *\n * Migration examples:\n * - `searchAndContents(query)` → `search(query)`\n * - `searchAndContents(query, { text: true })` → `search(query, { contents: { text: true } })`\n * - `searchAndContents(query, { summary: true })` → `search(query, { contents: { summary: true } })`\n *\n * Compatibility wrapper for the legacy top-level contents options shape.\n *\n * @param {string} query - The query string.\n * @param {RegularSearchOptions & T} [options] - Additional search + contents options\n * @param {RequestOptions} [requestOptions] - Per-call body overrides.\n * @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.\n */\n async searchAndContents<T extends ContentsOptions>(\n query: string,\n options?: RegularSearchOptions & T,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>> {\n const { contentsOptions, restOptions } =\n options === undefined\n ? {\n contentsOptions: {\n text: { maxCharacters: DEFAULT_MAX_CHARACTERS },\n },\n restOptions: {},\n }\n : this.extractContentsOptions(options);\n\n return await this.request(\n \"/search\",\n \"POST\",\n this.mergeSearchRequestBody(\n { query, contents: contentsOptions, ...restOptions },\n requestOptions\n )\n );\n }\n\n /**\n * DEPRECATED: Use `search()` for new discovery flows. There is no direct replacement for URL-based similarity.\n * @deprecated Use `search()` for new discovery flows. This legacy URL-similarity method will be removed in a future version.\n *\n * Finds similar links to the provided URL.\n * By default, returns text contents. Use contents: false to opt-out.\n *\n * @param {string} url - The URL for which to find similar links.\n * @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of similar search results with text contents.\n */\n async findSimilar(\n url: string\n ): Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>;\n /**\n * DEPRECATED: Use `search()` for new discovery flows. There is no direct replacement for URL-based similarity.\n * @deprecated Use `search()` for new discovery flows. This legacy URL-similarity method will be removed in a future version.\n *\n * Finds similar links to the provided URL without contents.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {FindSimilarOptions & { contents: false }} options - Options with contents explicitly disabled\n * @returns {Promise<SearchResponse<{}>>} A list of similar search results without contents.\n */\n async findSimilar(\n url: string,\n options: FindSimilarOptions & { contents: false | null | undefined }\n ): Promise<SearchResponse<{}>>;\n /**\n * DEPRECATED: Use `search()` with `contents` for new discovery flows. There is no direct replacement for URL-based similarity.\n * @deprecated Use `search()` with `contents` for new discovery flows. This legacy URL-similarity method will be removed in a future version.\n *\n * Finds similar links to the provided URL with specific contents.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {FindSimilarOptions & { contents: T }} options - Options with specific contents\n * @returns {Promise<SearchResponse<T>>} A list of similar search results with requested contents.\n */\n async findSimilar<T extends ContentsOptions>(\n url: string,\n options: FindSimilarOptions & { contents: T }\n ): Promise<SearchResponse<T>>;\n /**\n * DEPRECATED: Use `search()` for new discovery flows. There is no direct replacement for URL-based similarity.\n * @deprecated Use `search()` for new discovery flows. This legacy URL-similarity method will be removed in a future version.\n *\n * Finds similar links to the provided URL.\n * When no contents option is specified, returns text contents by default.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {Omit<FindSimilarOptions, 'contents'>} options - Options without contents\n * @returns {Promise<SearchResponse<{ text: true }>>} A list of similar search results with text contents.\n */\n async findSimilar(\n url: string,\n options: Omit<FindSimilarOptions, \"contents\">\n ): Promise<SearchResponse<{ text: true }>>;\n async findSimilar<T extends ContentsOptions>(\n url: string,\n options?: FindSimilarOptions & { contents?: T | false | null | undefined }\n ): Promise<SearchResponse<T | { text: { maxCharacters: 10_000 } } | {}>> {\n // DEPRECATED METHOD: preserve legacy URL-similarity endpoint for compatibility.\n if (options === undefined || !(\"contents\" in options)) {\n // No options or no contents property → default to text contents\n return await this.request(\"/findSimilar\", \"POST\", {\n url,\n ...options,\n contents: { text: { maxCharacters: DEFAULT_MAX_CHARACTERS } },\n });\n }\n\n // If contents is false, null, or undefined, don't send it to the API\n if (\n options.contents === false ||\n options.contents === null ||\n options.contents === undefined\n ) {\n const { contents, ...restOptions } = options;\n return await this.request(\"/findSimilar\", \"POST\", {\n url,\n ...restOptions,\n });\n }\n\n // Contents property exists with value - pass it through\n return await this.request(\"/findSimilar\", \"POST\", { url, ...options });\n }\n\n /**\n * DEPRECATED: Use `search()` for new discovery flows instead. This legacy wrapper will be removed in a future version.\n * @deprecated Use `search()` for new discovery flows instead. There is no direct replacement for URL-based similarity.\n *\n * Migration examples:\n * - `findSimilarAndContents(url)` → `search(query)`\n * - `findSimilarAndContents(url, { text: true })` → `search(query, { contents: { text: true } })`\n * - `findSimilarAndContents(url, { summary: true })` → `search(query, { contents: { summary: true } })`\n *\n * Compatibility wrapper for the legacy top-level contents options shape.\n * @param {string} url - The URL for which to find similar links.\n * @param {FindSimilarOptions & T} [options] - Additional options for finding similar links + contents.\n * @returns {Promise<SearchResponse<T>>} A list of similar search results, including requested contents.\n */\n async findSimilarAndContents<T extends ContentsOptions>(\n url: string,\n options?: FindSimilarOptions & T\n ): Promise<SearchResponse<T>> {\n const { contentsOptions, restOptions } =\n options === undefined\n ? {\n contentsOptions: {\n text: { maxCharacters: DEFAULT_MAX_CHARACTERS },\n },\n restOptions: {},\n }\n : this.extractContentsOptions(options);\n\n return await this.request(\"/findSimilar\", \"POST\", {\n url,\n contents: contentsOptions,\n ...restOptions,\n });\n }\n\n /**\n * Retrieves contents of documents based on URLs.\n * @param {string | string[] | SearchResult[]} urls - A URL or array of URLs, or an array of SearchResult objects.\n * @param {ContentsOptions} [options] - Additional options for retrieving document contents.\n * @returns {Promise<SearchResponse<T>>} A list of document contents for the requested URLs.\n */\n async getContents<T extends ContentsOptions>(\n urls: string | string[] | SearchResult<T>[],\n options?: T & BetaOptions\n ): Promise<SearchResponse<T>> {\n if (!urls || (Array.isArray(urls) && urls.length === 0)) {\n throw new ExaError(\n \"Must provide at least one URL\",\n HttpStatusCode.BadRequest\n );\n }\n\n let requestUrls: string[];\n\n if (typeof urls === \"string\") {\n requestUrls = [urls];\n } else if (typeof urls[0] === \"string\") {\n requestUrls = urls as string[];\n } else {\n requestUrls = (urls as SearchResult<T>[]).map((result) => result.url);\n }\n\n const { betas, ...contentsOptions } = options ?? {};\n\n const payload = {\n urls: requestUrls,\n ...contentsOptions,\n };\n\n const betaHeaders = headersForBetas(betas);\n return betaHeaders\n ? await this.request(\"/contents\", \"POST\", payload, undefined, betaHeaders)\n : await this.request(\"/contents\", \"POST\", payload);\n }\n\n /**\n * Generate an answer with Zod schema for strongly typed output\n */\n async answer<T>(\n query: string,\n options: AnswerOptionsTyped<ZodSchema<T>>\n ): Promise<AnswerResponseTyped<T>>;\n\n /**\n * Generate an answer to a query.\n * @param {string} query - The question or query to answer.\n * @param {AnswerOptions} [options] - Additional options for answer generation.\n * @returns {Promise<AnswerResponse>} The generated answer and source references.\n *\n * Example with systemPrompt:\n * ```ts\n * const answer = await exa.answer(\"What is quantum computing?\", {\n * text: true,\n * model: \"exa\",\n * systemPrompt: \"Answer in a technical manner suitable for experts.\"\n * });\n * ```\n *\n * Note: For streaming responses, use the `streamAnswer` method:\n * ```ts\n * for await (const chunk of exa.streamAnswer(query)) {\n * // Handle chunks\n * }\n * ```\n */\n async answer(query: string, options?: AnswerOptions): Promise<AnswerResponse>;\n\n async answer<T>(\n query: string,\n options?: AnswerOptions | AnswerOptionsTyped<ZodSchema<T>>\n ): Promise<AnswerResponse | AnswerResponseTyped<T>> {\n if (options?.stream) {\n throw new ExaError(\n \"For streaming responses, please use streamAnswer() instead:\\n\\n\" +\n \"for await (const chunk of exa.streamAnswer(query)) {\\n\" +\n \" // Handle chunks\\n\" +\n \"}\",\n HttpStatusCode.BadRequest\n );\n }\n\n // For non-streaming requests, make a regular API call\n let outputSchema = options?.outputSchema;\n\n // Convert Zod schema to JSON schema if needed\n if (outputSchema && isZodSchema(outputSchema)) {\n outputSchema = zodToJsonSchema(outputSchema);\n }\n\n const requestBody = {\n query,\n stream: false,\n text: options?.text ?? false,\n model: options?.model ?? \"exa\",\n systemPrompt: options?.systemPrompt,\n outputSchema,\n userLocation: options?.userLocation,\n };\n\n return await this.request(\"/answer\", \"POST\", requestBody);\n }\n\n /**\n * Stream an answer with Zod schema for structured output (non-streaming content)\n * Note: Structured output works only with non-streaming content, not with streaming chunks\n */\n streamAnswer<T>(\n query: string,\n options: {\n text?: boolean;\n model?: \"exa\" | \"exa-pro\";\n systemPrompt?: string;\n outputSchema: ZodSchema<T>;\n userLocation?: string;\n }\n ): AsyncGenerator<AnswerStreamChunk>;\n\n /**\n * Stream an answer as an async generator\n *\n * Each iteration yields a chunk with partial text (`content`) or new citations.\n * Use this if you'd like to read the answer incrementally, e.g. in a chat UI.\n *\n * Example usage:\n * ```ts\n * for await (const chunk of exa.streamAnswer(\"What is quantum computing?\", {\n * text: false,\n * systemPrompt: \"Answer in a concise manner suitable for beginners.\"\n * })) {\n * if (chunk.content) process.stdout.write(chunk.content);\n * if (chunk.citations) {\n * console.log(\"\\nCitations: \", chunk.citations);\n * }\n * }\n * ```\n */\n streamAnswer(\n query: string,\n options?: {\n text?: boolean;\n model?: \"exa\" | \"exa-pro\";\n systemPrompt?: string;\n outputSchema?: Record<string, unknown>;\n userLocation?: string;\n }\n ): AsyncGenerator<AnswerStreamChunk>;\n\n async *streamAnswer<T>(\n query: string,\n options?: {\n text?: boolean;\n model?: \"exa\" | \"exa-pro\";\n systemPrompt?: string;\n outputSchema?: Record<string, unknown> | ZodSchema<T>;\n userLocation?: string;\n }\n ): AsyncGenerator<AnswerStreamChunk> {\n // Convert Zod schema to JSON schema if needed\n let outputSchema = options?.outputSchema;\n if (outputSchema && isZodSchema(outputSchema)) {\n outputSchema = zodToJsonSchema(outputSchema);\n }\n\n // Build the POST body and fetch the streaming response.\n const body = {\n query,\n text: options?.text ?? false,\n stream: true,\n model: options?.model ?? \"exa\",\n systemPrompt: options?.systemPrompt,\n outputSchema,\n userLocation: options?.userLocation,\n };\n\n yield* this.streamChatCompletions(\"/answer\", body);\n }\n\n private async *streamChatCompletions(\n endpoint: string,\n body: Record<string, unknown>\n ): AsyncGenerator<AnswerStreamChunk> {\n const response = await this.rawRequest(endpoint, \"POST\", body);\n\n if (!response.ok) {\n const message = await response.text();\n throw new ExaError(message, response.status, new Date().toISOString());\n }\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new ExaError(\n \"No response body available for streaming.\",\n 500,\n new Date().toISOString()\n );\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n\n const jsonStr = line.replace(/^data:\\s*/, \"\").trim();\n if (!jsonStr || jsonStr === \"[DONE]\") {\n continue;\n }\n\n let chunkData: any;\n try {\n chunkData = JSON.parse(jsonStr);\n } catch (err) {\n continue;\n }\n\n const chunk = this.processChunk(chunkData);\n if (chunk.content || chunk.citations) {\n yield chunk;\n }\n }\n }\n\n if (buffer.startsWith(\"data: \")) {\n const leftover = buffer.replace(/^data:\\s*/, \"\").trim();\n if (leftover && leftover !== \"[DONE]\") {\n try {\n const chunkData = JSON.parse(leftover);\n const chunk = this.processChunk(chunkData);\n if (chunk.content || chunk.citations) {\n yield chunk;\n }\n } catch (e) {}\n }\n }\n } finally {\n reader.releaseLock();\n }\n }\n\n private processChunk(chunkData: any): AnswerStreamChunk {\n let content: string | undefined;\n let citations:\n | Array<{\n id: string;\n url: string;\n title?: string;\n publishedDate?: string;\n author?: string;\n text?: string;\n }>\n | undefined;\n\n if (\n chunkData.choices &&\n chunkData.choices[0] &&\n chunkData.choices[0].delta\n ) {\n content = chunkData.choices[0].delta.content;\n }\n\n if (chunkData.citations && chunkData.citations !== \"null\") {\n citations = chunkData.citations.map((c: any) => ({\n id: c.id,\n url: c.url,\n title: c.title,\n publishedDate: c.publishedDate,\n author: c.author,\n text: c.text,\n }));\n }\n\n return { content, citations };\n }\n\n private async parseSSEStream<T>(response: Response): Promise<T> {\n const reader = response.body?.getReader();\n if (!reader) {\n throw new ExaError(\n \"No response body available for streaming.\",\n 500,\n new Date().toISOString()\n );\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n return new Promise<T>(async (resolve, reject) => {\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n\n const jsonStr = line.replace(/^data:\\s*/, \"\").trim();\n if (!jsonStr || jsonStr === \"[DONE]\") {\n continue;\n }\n\n let chunk: any;\n try {\n chunk = JSON.parse(jsonStr);\n } catch {\n continue; // Ignore malformed JSON lines\n }\n\n switch (chunk.tag) {\n case \"complete\":\n reader.releaseLock();\n resolve(chunk.data as T);\n return;\n case \"error\": {\n const message = chunk.error?.message || \"Unknown error\";\n reader.releaseLock();\n reject(\n new ExaError(\n message,\n HttpStatusCode.InternalServerError,\n new Date().toISOString()\n )\n );\n return;\n }\n // 'progress' and any other tags are ignored for the blocking variant\n default:\n break;\n }\n }\n }\n\n // If we exit the loop without receiving a completion event\n reject(\n new ExaError(\n \"Stream ended without a completion event.\",\n HttpStatusCode.InternalServerError,\n new Date().toISOString()\n )\n );\n } catch (err) {\n reject(err as Error);\n } finally {\n try {\n reader.releaseLock();\n } catch {\n /* ignore */\n }\n }\n });\n }\n}\n\n// Re-export Websets related types and enums\nexport * from \"./websets\";\n// Re-export Research related types and client\nexport * from \"./research\";\n// Re-export Search Monitors related types and client\nexport * from \"./monitors\";\n// Re-export Agent related types and client\nexport * from \"./agent\";\nexport * from \"./tools\";\n\n// Export the main class\nexport default Exa;\n\n// Re-export errors\nexport * from \"./errors\";\n","{\n \"name\": \"exa-js\",\n \"version\": \"2.25.0\",\n \"description\": \"Exa SDK for Node.js and the browser\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"files\": [\n \"dist\"\n ],\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"require\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"build-fast\": \"tsup src/index.ts --format cjs,esm\",\n \"build\": \"tsup\",\n \"test\": \"vitest run\",\n \"test:unit\": \"vitest run --config vitest.unit.config.ts\",\n \"test:integration\": \"vitest run --config vitest.integration.config.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"typecheck:examples\": \"tsc -p examples/tsconfig.json --noEmit\",\n \"generate:types:websets\": \"openapi-typescript https://raw.githubusercontent.com/exa-labs/openapi-spec/refs/heads/master/exa-websets-spec.yaml --enum --root-types --alphabetize --root-types-no-schema-prefix --output ./src/websets/openapi.ts && npm run format:websets\",\n \"format\": \"prettier --write \\\"src/**/*.ts\\\" \\\"examples/**/*.ts\\\"\",\n \"format:websets\": \"prettier --write src/websets/openapi.ts\",\n \"generate-docs\": \"npx tsx scripts/generate-docs.ts\",\n \"build:beta\": \"cross-env NPM_CONFIG_TAG=beta npm run build\",\n \"version:beta\": \"npm version prerelease --preid=beta\",\n \"version:stable\": \"npm version patch\",\n \"publish:beta\": \"npm run version:beta && npm run build:beta && npm publish --tag beta\",\n \"publish:stable\": \"npm run version:stable && npm run build && npm publish\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@anthropic-ai/sdk\": \"^0.115.0\",\n \"@types/node\": \"~22.14.0\",\n \"cross-env\": \"~7.0.3\",\n \"openapi-typescript\": \"~7.6.1\",\n \"prettier\": \"~3.5.3\",\n \"ts-morph\": \"^27.0.2\",\n \"ts-node\": \"~10.9.2\",\n \"tsup\": \"~8.4.0\",\n \"tsx\": \"^4.21.0\",\n \"typescript\": \"~5.8.3\",\n \"vitest\": \"~3.1.1\"\n },\n \"dependencies\": {\n \"cross-fetch\": \"~4.1.0\",\n \"dotenv\": \"~16.4.7\",\n \"openai\": \"^5.0.1\",\n \"zod\": \"^3.22.0\",\n \"zod-to-json-schema\": \"^3.20.0\"\n },\n \"directories\": {\n \"test\": \"test\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/exa-labs/exa-js.git\"\n },\n \"keywords\": [\n \"exa\",\n \"metaphor\",\n \"search\",\n \"AI\",\n \"LLMs\",\n \"RAG\",\n \"retrieval\",\n \"augmented\",\n \"generation\"\n ],\n \"author\": \"jeffzwang\",\n \"bugs\": {\n \"url\": \"https://github.com/exa-labs/exa-js/issues\"\n },\n \"homepage\": \"https://github.com/exa-labs/exa-js#readme\"\n}\n","/**\n * HTTP status codes\n */\nexport enum HttpStatusCode {\n BadRequest = 400,\n NotFound = 404,\n Unauthorized = 401,\n Forbidden = 403,\n TooManyRequests = 429,\n RequestTimeout = 408,\n InternalServerError = 500,\n ServiceUnavailable = 503,\n}\n\n/**\n * Structured fields from the API's error envelope\n * (e.g. `{ \"error\": { \"type\", \"code\", \"message\", \"detail\" }, \"requestId\" }`).\n */\nexport interface ExaErrorEnvelope {\n /**\n * Error category, e.g. \"NOT_FOUND\", \"INVALID_REQUEST\", \"CONFLICT\"\n */\n type?: string;\n\n /**\n * Specific error code, e.g. \"MONITOR_NOT_FOUND\"\n */\n code?: string;\n\n /**\n * Additional context, e.g. which validation rule failed\n */\n detail?: unknown;\n\n /**\n * Server-side request id for support/debugging\n */\n requestId?: string;\n}\n\n/**\n * Base error class for all Exa API errors\n */\nexport class ExaError extends Error {\n /**\n * HTTP status code\n */\n statusCode: number;\n\n /**\n * ISO timestamp from API\n */\n timestamp?: string;\n\n /**\n * Path that caused the error (may be undefined for client-side errors)\n */\n path?: string;\n\n /**\n * Error category from the API's error envelope, e.g. \"NOT_FOUND\"\n */\n type?: string;\n\n /**\n * Specific error code from the API's error envelope, e.g. \"MONITOR_NOT_FOUND\"\n */\n code?: string;\n\n /**\n * Additional context from the API's error envelope\n */\n detail?: unknown;\n\n /**\n * Server-side request id for support/debugging\n */\n requestId?: string;\n\n /**\n * Create a new ExaError\n * @param message Error message\n * @param statusCode HTTP status code\n * @param timestamp ISO timestamp from API\n * @param path Path that caused the error\n * @param envelope Structured fields from the API's error envelope\n */\n constructor(\n message: string,\n statusCode: number,\n timestamp?: string,\n path?: string,\n envelope?: ExaErrorEnvelope\n ) {\n super(message);\n this.name = \"ExaError\";\n this.statusCode = statusCode;\n this.timestamp = timestamp ?? new Date().toISOString();\n this.path = path;\n if (envelope) {\n this.type = envelope.type;\n this.code = envelope.code;\n this.detail = envelope.detail;\n this.requestId = envelope.requestId;\n }\n }\n}\n","import { ZodType, ZodSchema } from \"zod\";\nimport { zodToJsonSchema as convertZodToJsonSchema } from \"zod-to-json-schema\";\n\nexport function isZodSchema(obj: any): obj is ZodSchema<any> {\n return obj instanceof ZodType;\n}\n\nexport function zodToJsonSchema(\n schema: ZodSchema<any>\n): Record<string, unknown> {\n return convertZodToJsonSchema(schema, {\n $refStrategy: \"none\",\n }) as Record<string, unknown>;\n}\n","/**\n * Base client for the Exa Agent API.\n */\n\nimport { Exa } from \"../index\";\nimport { ListAgentRunEventsParams, ListAgentRunsParams } from \"./types\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\ntype RequestBody = Record<string, unknown>;\n\nexport class AgentBaseClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<T> {\n return this.client.request<T>(\n `/agent/runs${endpoint}`,\n method,\n data,\n params,\n headers\n );\n }\n\n protected async rawRequest(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<Response> {\n return this.client.rawRequest(\n `/agent/runs${endpoint}`,\n method,\n data,\n params,\n headers\n );\n }\n\n protected buildPaginationParams(\n pagination?: ListAgentRunsParams | ListAgentRunEventsParams\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n\n return params;\n }\n}\n","/**\n * Shared Exa-Beta header construction for the agent API surfaces.\n */\n\nexport function headersForBetas(\n betas?: string[]\n): Record<string, string> | undefined {\n const betaValues = betas?.filter(Boolean);\n if (!betaValues?.length) return undefined;\n return { \"Exa-Beta\": betaValues.join(\",\") };\n}\n","/**\n * Types for the Exa Agent Monitors API (`/agent/monitors`).\n *\n * An Agent Monitor keeps a table of entities × fields fresh: static fields\n * are answered once per entity over the live web, dynamic fields are tracked\n * from news on every refresh, on the monitor's cadence.\n */\n\n/** Beta identifier required for the Agent Monitors API. */\nexport const AGENT_MONITORS_BETA_HEADER = \"agent-monitors-2026-08-04\";\n\nexport interface AgentMonitorsBetaOptions {\n /** Beta feature identifiers to enable for this request. */\n betas: string[];\n}\n\nexport type AgentMonitorStatus =\n | \"creating\"\n | \"pending_first_refresh\"\n | \"active\";\n\nexport type AgentMonitorFieldMode = \"static\" | \"dynamic\";\n\n/** The type of a field's cell values. */\nexport type AgentMonitorFieldValueType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"url\"\n | \"email\"\n | \"phone\";\n\n/**\n * A field the monitor keeps fresh for every entity. Fields are dynamic\n * (tracked from news on every refresh) unless declared `mode: \"static\"`\n * (answered once over the live web).\n */\nexport interface AgentMonitorField {\n id: string;\n name: string;\n description: string;\n /** @deprecated The static/dynamic knob is becoming internal-only. */\n mode: AgentMonitorFieldMode;\n /** The type of the field's cell values. */\n type: AgentMonitorFieldValueType;\n}\n\n/** An entity tracked by the monitor. */\nexport interface AgentMonitorEntity {\n id: string;\n name: string;\n domain?: string;\n canonicalEntityId?: string;\n}\n\n/** One grounding citation for a cell value; the Agent API's citation shape. */\nexport interface AgentMonitorCitation {\n url: string;\n title?: string;\n note?: string;\n}\n\n/** One cell value: a field's current content for an entity. */\nexport interface AgentMonitorContent {\n value: unknown;\n /** Grounding for the value, in the Agent API's citation shape. */\n citations?: AgentMonitorCitation[];\n updatedAt: string;\n}\n\n/** Refresh progress on the monitor object; `idle` outside an active refresh. */\nexport type AgentMonitorRefresh =\n | { state: \"idle\" }\n | {\n state: \"running\";\n entitiesProcessed: number;\n entitiesTotal: number;\n startedAt: string;\n };\n\n/** Creation progress on the monitor object; `idle` once the monitor is set up. */\nexport type AgentMonitorCreation =\n | { state: \"idle\" }\n | {\n state: \"running\";\n entitiesProcessed: number;\n entitiesTotal: number;\n startedAt: string;\n };\n\n/** ACU consumption on the monitor object; ACUs are the unit Agent runs bill in. */\nexport interface AgentMonitorUsage {\n /** Lifetime ACUs consumed by the monitor's refreshes (creation's first refresh included). */\n totalAcus: number;\n /** ACUs consumed by the most recently completed refresh run. */\n lastRefreshAcus: number;\n}\n\nexport interface AgentMonitor {\n id: string;\n object: \"agent_monitor\";\n status: AgentMonitorStatus;\n /** Refresh cadence, e.g. `\"12h\"` or `\"7d\"`; also each refresh's lookback window. */\n cadence: string;\n fields: AgentMonitorField[];\n entityCount: number;\n version: number;\n createdAt: string;\n lastRefreshAt: string | null;\n refresh: AgentMonitorRefresh;\n creation: AgentMonitorCreation;\n usage: AgentMonitorUsage;\n sourceRunId?: string;\n}\n\n/** One entity and its current contents, keyed by field id. */\nexport interface AgentMonitorEntityView {\n entity: AgentMonitorEntity;\n contents: Record<string, AgentMonitorContent>;\n}\n\n/**\n * Entity/field references on a change item. `id` is the canonical, stable\n * join key; the name attributes are denormalized for display, resolved as of\n * read time, and absent when the entity/field no longer exists.\n */\nexport interface AgentMonitorChangeEntity {\n id: string;\n name?: string;\n domain?: string;\n canonicalEntityId?: string;\n}\n\nexport interface AgentMonitorChangeField {\n id: string;\n name?: string;\n}\n\n/** One content change from the monitor's change feed. */\nexport interface AgentMonitorChange {\n type: \"content.upserted\";\n entity: AgentMonitorChangeEntity;\n field: AgentMonitorChangeField;\n content: AgentMonitorContent;\n version: number;\n /** ISO-8601 commit time of the change event. */\n createdAt: string;\n}\n\n// --- Request params ---\n\n/** An entity to track. `domain` anchors entity resolution and must be unique per monitor. */\nexport interface CreateAgentMonitorEntityParams {\n name: string;\n /** Resolution anchor: entities resolve by first-party or domain-verified evidence. */\n domain: string;\n /** Extra disambiguation context for entity resolution of ambiguous names. */\n description?: string;\n}\n\n/** A field to keep fresh. Dynamic (the default) unless declared `mode: \"static\"`. */\nexport interface CreateAgentMonitorFieldParams {\n name: string;\n description: string;\n /**\n * The type of the field's cell values; defaults to `\"string\"`. Cell values\n * are normalized to the declared type best-effort on write, never rejected\n * — but declaring an unsupported type (e.g. `\"object\"`) is a 400.\n * `\"static\"`/`\"dynamic\"` are accepted as deprecated aliases of `mode`;\n * declaring both spellings is a 400.\n */\n type?: AgentMonitorFieldValueType | AgentMonitorFieldMode;\n /** @deprecated The static/dynamic knob is becoming internal-only. */\n mode?: AgentMonitorFieldMode;\n}\n\nexport interface CreateAgentMonitorParams {\n /**\n * How often the monitor refreshes, e.g. `\"12h\"` or `\"7d\"` (minimum 6h).\n * Also each refresh's news lookback window.\n */\n cadence: string;\n entities: CreateAgentMonitorEntityParams[];\n fields: CreateAgentMonitorFieldParams[];\n}\n\nexport interface CreateAgentMonitorOptions {\n /**\n * Sent as the `Idempotency-Key` header. A retried create with the same key\n * returns the monitor the first attempt created (resuming any unfinished\n * entity ingestion) instead of creating a duplicate. Reusing a key with a\n * different body is a 409.\n */\n idempotencyKey?: string;\n}\n\nexport interface ListAgentMonitorsParams {\n cursor?: string;\n limit?: number;\n}\n\nexport interface ListAgentMonitorEntitiesParams {\n cursor?: string;\n limit?: number;\n /** Only return entities whose contents were updated at or after this ISO-8601 timestamp. */\n since?: string;\n}\n\nexport interface ListAgentMonitorChangesParams {\n cursor?: string;\n limit?: number;\n /** Only return changes committed at or after this ISO-8601 timestamp. */\n since?: string;\n}\n\nexport interface AddAgentMonitorEntitiesParams {\n entities: CreateAgentMonitorEntityParams[];\n}\n\n// --- Responses ---\n\nexport interface ListAgentMonitorsResponse {\n object: \"list\";\n data: AgentMonitor[];\n hasMore: boolean;\n nextCursor: string | null;\n}\n\nexport interface ListAgentMonitorEntitiesResponse {\n object: \"list\";\n data: AgentMonitorEntityView[];\n hasMore: boolean;\n nextCursor: string | null;\n /** Store head change token — \"am I caught up?\" display only, NOT the cursor. */\n version: number;\n}\n\nexport interface ListAgentMonitorChangesResponse {\n object: \"list\";\n data: AgentMonitorChange[];\n hasMore: boolean;\n /** Opaque; resume the feed from the last served change. Null when data is empty. */\n nextCursor: string | null;\n /** Store head change token — \"am I caught up?\" display only, NOT the cursor. */\n version: number;\n}\n\nexport interface DeletedAgentMonitor {\n id: string;\n object: \"agent_monitor.deleted\";\n deleted: true;\n}\n\n// --- Backtests ---\n\n/**\n * Params for a one-shot backtest of entities × fields over an explicit past\n * news window. The backtest runs one monitor refresh over the requested\n * window, then tears down its temporary monitor.\n */\nexport interface CreateAgentMonitorBacktestParams {\n entities: CreateAgentMonitorEntityParams[];\n fields: CreateAgentMonitorFieldParams[];\n /** Start of the news window as an ISO-8601 UTC timestamp. */\n startTime: string;\n /** End of the news window as an ISO-8601 UTC timestamp. */\n endTime: string;\n}\n\n/** One backtest cell: a value and its grounding citations. */\nexport interface AgentMonitorBacktestContent {\n value: unknown;\n citations: AgentMonitorCitation[];\n}\n\n/** One entity's backtest result, with populated cells keyed by field name. */\nexport interface AgentMonitorBacktestEntity {\n name: string;\n /** Populated cells by field name; fields with no update are absent. */\n contents: Record<string, AgentMonitorBacktestContent>;\n}\n\n/** The computed body of a finished backtest, embedded in the job once it completes. */\nexport interface AgentMonitorBacktestResult {\n data: AgentMonitorBacktestEntity[];\n failedEntities?: Array<{ name: string; reason: string }>;\n /** Caveats about how the backtest was computed. */\n warnings?: string[];\n}\n\nexport type AgentMonitorBacktestStatus = \"running\" | \"completed\" | \"failed\";\n\n/**\n * A backtest job: `create` returns it as `running`, and `get` polls it to\n * `completed` (result fields present) or `failed`. Jobs expire and read as\n * 404 after `expiresAt`.\n */\nexport type AgentMonitorBacktest = {\n id: string;\n object: \"agent_monitor.backtest\";\n /** The backtested news window, echoed back as normalized ISO-8601 timestamps. */\n startTime: string;\n endTime: string;\n createdAt: string;\n expiresAt: string;\n} & (\n | { status: \"running\" }\n | ({ status: \"completed\" } & AgentMonitorBacktestResult)\n | { status: \"failed\"; error: string }\n);\n\nexport interface AgentMonitorBacktestWaitOptions {\n pollInterval?: number;\n timeoutMs?: number;\n}\n","/**\n * Base client for the Exa Agent Monitors API.\n */\n\nimport { ExaError, HttpStatusCode } from \"../../errors\";\nimport { Exa } from \"../../index\";\nimport { headersForBetas } from \"../betas\";\nimport {\n AGENT_MONITORS_BETA_HEADER,\n ListAgentMonitorChangesParams,\n ListAgentMonitorEntitiesParams,\n ListAgentMonitorsParams,\n} from \"./types\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\ntype RequestBody = Record<string, any>;\n\nexport class AgentMonitorsBaseClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n betas: string[],\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<T> {\n if (!betas?.includes(AGENT_MONITORS_BETA_HEADER)) {\n throw new ExaError(\n `betas must include the Agent Monitors beta identifier (\"${AGENT_MONITORS_BETA_HEADER}\")`,\n HttpStatusCode.BadRequest\n );\n }\n\n return this.client.request<T>(\n `/agent/monitors${endpoint}`,\n method,\n data,\n params,\n {\n ...headersForBetas(betas),\n ...headers,\n }\n );\n }\n\n protected buildPaginationParams(\n pagination?:\n | ListAgentMonitorsParams\n | ListAgentMonitorEntitiesParams\n | ListAgentMonitorChangesParams\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n if (\"since\" in pagination && pagination.since)\n params.since = pagination.since;\n\n return params;\n }\n}\n","/**\n * Client for the Exa Agent Monitors API (`/agent/monitors`).\n */\n\nimport { Exa } from \"../../index\";\nimport { AgentMonitorsBaseClient } from \"./base\";\nimport {\n AddAgentMonitorEntitiesParams,\n AgentMonitor,\n AgentMonitorChange,\n AgentMonitorEntityView,\n AgentMonitorBacktest,\n AgentMonitorBacktestWaitOptions,\n AgentMonitorsBetaOptions,\n CreateAgentMonitorOptions,\n CreateAgentMonitorParams,\n CreateAgentMonitorBacktestParams,\n DeletedAgentMonitor,\n ListAgentMonitorChangesParams,\n ListAgentMonitorChangesResponse,\n ListAgentMonitorEntitiesParams,\n ListAgentMonitorEntitiesResponse,\n ListAgentMonitorsParams,\n ListAgentMonitorsResponse,\n} from \"./types\";\n\nconst DEFAULT_BACKTEST_POLL_INTERVAL_MS = 2000;\nconst DEFAULT_BACKTEST_POLL_TIMEOUT_MS = 60 * 60 * 1000;\n\ntype AgentMonitorTerminalBacktest = AgentMonitorBacktest & {\n status: \"completed\" | \"failed\";\n};\ntype AgentMonitorCompletedBacktest = AgentMonitorBacktest & {\n status: \"completed\";\n};\n\nexport class AgentMonitorBacktestFailedError extends Error {\n backtest: AgentMonitorBacktest & { status: \"failed\" };\n\n constructor(backtest: AgentMonitorBacktest & { status: \"failed\" }) {\n super(backtest.error ?? `Agent monitor backtest ${backtest.id} failed`);\n this.name = \"AgentMonitorBacktestFailedError\";\n this.backtest = backtest;\n }\n}\n\nexport class AgentMonitorEntitiesClient extends AgentMonitorsBaseClient {\n /**\n * Add entities to an existing Agent Monitor. Added entities are resolved\n * and backfilled shortly after the request completes, then update on the\n * monitor's regular refresh cadence.\n */\n async add(\n monitorId: string,\n params: AddAgentMonitorEntitiesParams & AgentMonitorsBetaOptions\n ): Promise<AgentMonitor> {\n const { betas, ...payload } = params;\n return this.request<AgentMonitor>(\n `/${monitorId}/entities`,\n betas,\n \"POST\",\n payload\n );\n }\n\n /**\n * Page an Agent Monitor's current entities and contents, optionally\n * filtered by update time.\n */\n async list(\n monitorId: string,\n options: ListAgentMonitorEntitiesParams & AgentMonitorsBetaOptions\n ): Promise<ListAgentMonitorEntitiesResponse> {\n const { betas, ...pagination } = options;\n const params = this.buildPaginationParams(pagination);\n return this.request<ListAgentMonitorEntitiesResponse>(\n `/${monitorId}/entities`,\n betas,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all of a monitor's entities, handling pagination\n * automatically.\n */\n async *listAll(\n monitorId: string,\n options: ListAgentMonitorEntitiesParams & AgentMonitorsBetaOptions\n ): AsyncGenerator<AgentMonitorEntityView> {\n let cursor: string | undefined = options.cursor;\n const { betas, ...pagination } = options;\n const pageOptions: ListAgentMonitorEntitiesParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(monitorId, { ...pageOptions, betas });\n\n for (const entityView of response.data) {\n yield entityView;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all of a monitor's entities into an array.\n */\n async getAll(\n monitorId: string,\n options: ListAgentMonitorEntitiesParams & AgentMonitorsBetaOptions\n ): Promise<AgentMonitorEntityView[]> {\n const entities: AgentMonitorEntityView[] = [];\n for await (const entityView of this.listAll(monitorId, options)) {\n entities.push(entityView);\n }\n return entities;\n }\n}\n\nexport class AgentMonitorChangesClient extends AgentMonitorsBaseClient {\n /**\n * Page an Agent Monitor's content change feed since a cursor or timestamp.\n */\n async list(\n monitorId: string,\n options: ListAgentMonitorChangesParams & AgentMonitorsBetaOptions\n ): Promise<ListAgentMonitorChangesResponse> {\n const { betas, ...pagination } = options;\n const params = this.buildPaginationParams(pagination);\n return this.request<ListAgentMonitorChangesResponse>(\n `/${monitorId}/changes`,\n betas,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through a monitor's change feed, handling pagination\n * automatically.\n */\n async *listAll(\n monitorId: string,\n options: ListAgentMonitorChangesParams & AgentMonitorsBetaOptions\n ): AsyncGenerator<AgentMonitorChange> {\n let cursor: string | undefined = options.cursor;\n const { betas, ...pagination } = options;\n const pageOptions: ListAgentMonitorChangesParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(monitorId, { ...pageOptions, betas });\n\n for (const change of response.data) {\n yield change;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect a monitor's change feed into an array.\n */\n async getAll(\n monitorId: string,\n options: ListAgentMonitorChangesParams & AgentMonitorsBetaOptions\n ): Promise<AgentMonitorChange[]> {\n const changes: AgentMonitorChange[] = [];\n for await (const change of this.listAll(monitorId, options)) {\n changes.push(change);\n }\n return changes;\n }\n}\n\nexport class AgentMonitorBacktestsClient extends AgentMonitorsBaseClient {\n /**\n * Start an async backtest of entities × fields over an explicit past news\n * window. Returns a `running` job; poll with `get` (or use `createAndWait`)\n * for the result.\n */\n async create(\n params: CreateAgentMonitorBacktestParams & AgentMonitorsBetaOptions\n ): Promise<AgentMonitorBacktest> {\n const { betas, ...payload } = params;\n return this.request<AgentMonitorBacktest>(\n \"/backtest\",\n betas,\n \"POST\",\n payload\n );\n }\n\n /**\n * Poll a backtest job for its status and, once completed, its result.\n * Jobs expire and read as 404 after `expiresAt`.\n */\n async get(\n backtestId: string,\n options: AgentMonitorsBetaOptions\n ): Promise<AgentMonitorBacktest> {\n return this.request<AgentMonitorBacktest>(\n `/backtest/${backtestId}`,\n options.betas,\n \"GET\"\n );\n }\n\n /**\n * Poll a backtest job until it reaches a terminal status.\n */\n async pollUntilFinished(\n backtestId: string,\n options: AgentMonitorBacktestWaitOptions & AgentMonitorsBetaOptions\n ): Promise<AgentMonitorTerminalBacktest> {\n const pollInterval =\n options.pollInterval ?? DEFAULT_BACKTEST_POLL_INTERVAL_MS;\n const timeoutMs = options.timeoutMs ?? DEFAULT_BACKTEST_POLL_TIMEOUT_MS;\n const startTime = Date.now();\n\n while (true) {\n const backtest = await this.get(backtestId, { betas: options.betas });\n if (backtest.status !== \"running\") {\n return backtest;\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Agent monitor backtest ${backtestId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n\n /**\n * Start a backtest and wait for its result. Throws\n * AgentMonitorBacktestFailedError if the backtest fails.\n */\n async createAndWait(\n params: CreateAgentMonitorBacktestParams & AgentMonitorsBetaOptions,\n options?: AgentMonitorBacktestWaitOptions\n ): Promise<AgentMonitorCompletedBacktest> {\n const backtest = await this.create(params);\n const terminalBacktest =\n backtest.status === \"running\"\n ? await this.pollUntilFinished(backtest.id, {\n ...options,\n betas: params.betas,\n })\n : backtest;\n if (terminalBacktest.status === \"failed\") {\n throw new AgentMonitorBacktestFailedError(terminalBacktest);\n }\n return terminalBacktest as AgentMonitorCompletedBacktest;\n }\n}\n\nexport class AgentMonitorsClient extends AgentMonitorsBaseClient {\n /**\n * Client for a monitor's entities.\n */\n entities: AgentMonitorEntitiesClient;\n\n /**\n * Client for a monitor's content change feed.\n */\n changes: AgentMonitorChangesClient;\n\n /**\n * Client for one-shot backtest jobs.\n */\n backtests: AgentMonitorBacktestsClient;\n\n constructor(client: Exa) {\n super(client);\n this.entities = new AgentMonitorEntitiesClient(client);\n this.changes = new AgentMonitorChangesClient(client);\n this.backtests = new AgentMonitorBacktestsClient(client);\n }\n\n /**\n * Create an Agent Monitor from its entities, fields, and cadence.\n * Creation is async: the monitor is returned with status `creating` and\n * becomes `active` once its first refresh completes.\n */\n async create(\n params: CreateAgentMonitorParams & AgentMonitorsBetaOptions,\n options?: CreateAgentMonitorOptions\n ): Promise<AgentMonitor> {\n const { betas, ...payload } = params;\n const headers = options?.idempotencyKey\n ? { \"Idempotency-Key\": options.idempotencyKey }\n : undefined;\n return this.request<AgentMonitor>(\n \"\",\n betas,\n \"POST\",\n payload,\n undefined,\n headers\n );\n }\n\n /**\n * Get an Agent Monitor by ID, including refresh progress.\n */\n async get(\n monitorId: string,\n options: AgentMonitorsBetaOptions\n ): Promise<AgentMonitor> {\n return this.request<AgentMonitor>(`/${monitorId}`, options.betas, \"GET\");\n }\n\n /**\n * List the team's Agent Monitors.\n */\n async list(\n options: ListAgentMonitorsParams & AgentMonitorsBetaOptions\n ): Promise<ListAgentMonitorsResponse> {\n const { betas, ...pagination } = options;\n const params = this.buildPaginationParams(pagination);\n return this.request<ListAgentMonitorsResponse>(\n \"\",\n betas,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all Agent Monitors, handling pagination automatically.\n */\n async *listAll(\n options: ListAgentMonitorsParams & AgentMonitorsBetaOptions\n ): AsyncGenerator<AgentMonitor> {\n let cursor: string | undefined = options.cursor;\n const { betas, ...pagination } = options;\n const pageOptions: ListAgentMonitorsParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list({ ...pageOptions, betas });\n\n for (const monitor of response.data) {\n yield monitor;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Agent Monitors into an array.\n */\n async getAll(\n options: ListAgentMonitorsParams & AgentMonitorsBetaOptions\n ): Promise<AgentMonitor[]> {\n const monitors: AgentMonitor[] = [];\n for await (const monitor of this.listAll(options)) {\n monitors.push(monitor);\n }\n return monitors;\n }\n\n /**\n * Delete an Agent Monitor and stop its refreshes.\n */\n async delete(\n monitorId: string,\n options: AgentMonitorsBetaOptions\n ): Promise<DeletedAgentMonitor> {\n return this.request<DeletedAgentMonitor>(\n `/${monitorId}`,\n options.betas,\n \"DELETE\"\n );\n }\n}\n","/**\n * Types for the Exa Agent API.\n */\n\nimport { ZodSchema } from \"zod\";\n\n/**\n * @deprecated Agent API beta header is no longer required for `exa.agent`.\n * Retained for legacy `exa.beta.agent` compatibility.\n */\nexport const AGENT_BETA_HEADER = \"agent-2026-05-07\";\n\nexport const AGENT_MAX_EFFORT_BETA = \"agent-max-effort-2026-07-27\";\n\nexport interface AgentBetaOptions {\n /**\n * @deprecated Agent API beta header is no longer required for `exa.agent`.\n * Values supplied to `exa.beta.agent` are sent as the `Exa-Beta` header.\n */\n betas?: string[];\n}\n\nexport type AgentRunStatus =\n | \"queued\"\n | \"running\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\";\n\nexport type AgentStopReason =\n | \"schema_satisfied\"\n | \"budget_reached\"\n | \"time_limit_reached\"\n | \"stopped\"\n | \"error\"\n | \"cancelled\";\n\nexport type AgentConfidence = \"low\" | \"medium\" | \"high\";\n\nexport type AgentEffort =\n | \"minimal\"\n | \"low\"\n | \"medium\"\n | \"high\"\n | \"xhigh\"\n | \"auto\"\n | \"ultra\"\n | \"max\";\n\n/** Per-run spend ceiling for the metered `auto` and `ultra` efforts. */\nexport interface AgentBudget {\n /**\n * Maximum spend for the run in US dollars.\n * Only accepted by the API for `auto` and `ultra`; the server validates the\n * allowed range and applies defaults when omitted.\n */\n maxCostDollars?: number;\n /**\n * Soft wall-clock ceiling in seconds (300–10,800). Only accepted for `ultra`.\n */\n maxDurationSeconds?: number;\n}\n\n/**\n * Identifier of an Exa Connect data provider, e.g. `\"fiber_ai\"`,\n * `\"financial_datasets\"`, `\"similarweb\"`, `\"baselayer\"`, `\"affiliate\"`,\n * `\"particle_news\"`, or `\"jinko\"`.\n */\nexport type AgentDataSourceProvider = string;\n\n/** Exa Connect data source to enable for an Agent run. */\nexport interface AgentDataSource {\n /** Exa Connect data provider to enable for the run. */\n provider: AgentDataSourceProvider;\n}\n\nexport interface AgentInput {\n data?: Record<string, unknown>[];\n exclusion?: Record<string, unknown>[];\n [key: string]: unknown;\n}\n\nexport interface AgentGroundingCitation {\n url: string;\n title?: string | null;\n [key: string]: unknown;\n}\n\nexport interface AgentGroundingEntry {\n field: string;\n citations: AgentGroundingCitation[];\n score?: number | null;\n confidence?: AgentConfidence | null;\n [key: string]: unknown;\n}\n\nexport interface AgentOutput {\n text?: string | null;\n structured?: unknown;\n grounding?: AgentGroundingEntry[] | null;\n [key: string]: unknown;\n}\n\nexport interface AgentUsage {\n agentComputeUnits?: number;\n searches?: number;\n emails?: number;\n phoneNumbers?: number;\n /** Per-provider tool call counts for Exa Connect data sources used during the run. */\n dataSources?: Record<string, number>;\n [key: string]: unknown;\n}\n\nexport interface AgentCostDollars {\n total?: number;\n agentCompute?: number;\n search?: number;\n emails?: number;\n phoneNumbers?: number;\n /** Per-provider cost in dollars for Exa Connect data sources used during the run. */\n dataSources?: Record<string, number>;\n [key: string]: unknown;\n}\n\nexport interface AgentError {\n type?: string;\n code?: string;\n message?: string;\n path?: string;\n keyword?: string;\n expected?: unknown;\n actual?: unknown;\n [key: string]: unknown;\n}\n\nexport interface AgentRun {\n id: string;\n object?: string;\n status: AgentRunStatus;\n stopReason?: AgentStopReason | null;\n createdAt?: string;\n completedAt?: string | null;\n request?: Record<string, unknown>;\n output?: AgentOutput | null;\n usage?: AgentUsage;\n costDollars?: AgentCostDollars;\n error?: AgentError;\n [key: string]: unknown;\n}\n\nexport type AgentRunTyped<T> = AgentRun & {\n output?: (AgentOutput & { structured?: T }) | null;\n};\n\nexport interface ListAgentRunsParams {\n cursor?: string;\n limit?: number;\n}\n\nexport interface ListAgentRunsResponse {\n object?: string;\n data: AgentRun[];\n hasMore: boolean;\n nextCursor: string | null;\n}\n\nexport interface DeletedAgentRun {\n id: string;\n object?: string;\n deleted: boolean;\n}\n\nexport interface AgentEvent {\n id?: string;\n event: string;\n data: Record<string, unknown>;\n createdAt?: string;\n [key: string]: unknown;\n}\n\nexport interface ListAgentRunEventsParams {\n cursor?: string;\n limit?: number;\n}\n\nexport interface ListAgentRunEventsResponse {\n object?: string;\n data: AgentEvent[];\n hasMore: boolean;\n nextCursor: string | null;\n}\n\nexport interface CreateAgentRunParams {\n query: string;\n systemPrompt?: string;\n input?: AgentInput;\n outputSchema?: Record<string, unknown>;\n effort?: AgentEffort;\n budget?: AgentBudget;\n previousRunId?: string;\n metadata?: Record<string, unknown>;\n /** Exa Connect data providers to enable for the run. Each entry enables all of that provider's tools. */\n dataSources?: AgentDataSource[];\n}\n\nexport type CreateAgentRunParamsTyped<T> = Omit<\n CreateAgentRunParams,\n \"outputSchema\"\n> & {\n outputSchema?: T;\n};\n\nexport type AgentCreateOptions<T = Record<string, unknown>> =\n CreateAgentRunParamsTyped<Record<string, unknown> | ZodSchema<T>> & {\n stream?: boolean;\n };\n","/**\n * Client for the Exa Agent API.\n */\n\nimport { ZodSchema } from \"zod\";\nimport { Exa } from \"../index\";\nimport { ExaError } from \"../errors\";\nimport { isZodSchema, zodToJsonSchema } from \"../zod-utils\";\nimport { AgentBaseClient } from \"./base\";\nimport { headersForBetas } from \"./betas\";\nimport { AgentMonitorsClient } from \"./monitors/client\";\nimport {\n AGENT_MAX_EFFORT_BETA,\n AgentBetaOptions,\n AgentCreateOptions,\n AgentEvent,\n AgentRun,\n AgentRunTyped,\n CreateAgentRunParams,\n DeletedAgentRun,\n ListAgentRunEventsParams,\n ListAgentRunEventsResponse,\n ListAgentRunsParams,\n ListAgentRunsResponse,\n} from \"./types\";\n\ntype WithBetaOptions<T> = T & AgentBetaOptions;\ntype AgentTerminalStatus = \"completed\" | \"failed\" | \"cancelled\";\ntype AgentTerminalRun = AgentRun & { status: AgentTerminalStatus };\ntype AgentTerminalRunTyped<T> = AgentRunTyped<T> & {\n status: AgentTerminalStatus;\n};\ntype AgentCompletedRun = AgentRun & { status: \"completed\" };\ntype AgentCompletedRunTyped<T> = AgentRunTyped<T> & {\n status: \"completed\";\n};\nconst DEFAULT_AGENT_POLL_INTERVAL_MS = 1000;\nconst DEFAULT_AGENT_POLL_TIMEOUT_MS = 60 * 60 * 1000;\nconst DEFAULT_AGENT_CREATE_AND_WAIT_TIMEOUT_MS = 2 * 60 * 1000;\nconst TERMINAL_AGENT_RUN_STATUSES = new Set<AgentTerminalStatus>([\n \"completed\",\n \"failed\",\n \"cancelled\",\n]);\nexport type AgentWaitOptions = {\n pollInterval?: number;\n timeoutMs?: number;\n};\n\nexport class AgentRunFailedError extends Error {\n run: AgentRun & { status: \"failed\" };\n\n constructor(run: AgentRun & { status: \"failed\" }) {\n super(run.error?.message ?? `Agent run ${run.id} failed`);\n this.name = \"AgentRunFailedError\";\n this.run = run;\n }\n}\n\nexport class AgentRunCancelledError extends Error {\n run: AgentRun & { status: \"cancelled\" };\n\n constructor(run: AgentRun & { status: \"cancelled\" }) {\n super(`Agent run ${run.id} was cancelled`);\n this.name = \"AgentRunCancelledError\";\n this.run = run;\n }\n}\n\nfunction isTerminalAgentRunStatus(\n status: AgentRun[\"status\"]\n): status is AgentTerminalStatus {\n return TERMINAL_AGENT_RUN_STATUSES.has(status as AgentTerminalStatus);\n}\n\nfunction ensureCompletedRun<T>(\n run: AgentTerminalRunTyped<T>\n): AgentCompletedRunTyped<T> {\n if (run.status === \"failed\") {\n throw new AgentRunFailedError(run as AgentRun & { status: \"failed\" });\n }\n if (run.status === \"cancelled\") {\n throw new AgentRunCancelledError(run as AgentRun & { status: \"cancelled\" });\n }\n return run as AgentCompletedRunTyped<T>;\n}\n\nfunction createAndWaitPollOptions(\n options?: AgentWaitOptions\n): AgentWaitOptions {\n return {\n pollInterval: options?.pollInterval ?? DEFAULT_AGENT_POLL_INTERVAL_MS,\n timeoutMs: options?.timeoutMs ?? DEFAULT_AGENT_CREATE_AND_WAIT_TIMEOUT_MS,\n };\n}\n\nfunction buildAgentRunPayload<T>(params: AgentCreateOptions<T>): {\n stream?: boolean;\n payload: Record<string, unknown>;\n} {\n const { stream, outputSchema, ...rest } = params;\n let schema = outputSchema;\n if (schema && isZodSchema(schema)) {\n schema = zodToJsonSchema(schema as ZodSchema<T>);\n }\n\n const payload: Record<string, unknown> = { ...rest };\n if (schema) {\n payload.outputSchema = schema;\n }\n\n return { stream, payload };\n}\n\nasync function* streamAgentEvents(\n response: Response\n): AsyncGenerator<AgentEvent> {\n if (!response.body) {\n throw new Error(\"No response body for SSE stream\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n let doneReading = false;\n\n const processPart = (part: string): AgentEvent | null => {\n const event: Partial<AgentEvent> = {};\n const dataLines: string[] = [];\n\n for (const line of part.split(\"\\n\")) {\n if (!line || !line.includes(\":\")) continue;\n const [field, ...rest] = line.split(\":\");\n const value = rest.join(\":\").replace(/^ /, \"\");\n\n if (field === \"id\") event.id = value;\n if (field === \"event\") event.event = value;\n if (field === \"data\") dataLines.push(value);\n }\n\n if (!event.event || dataLines.length === 0) return null;\n\n try {\n event.data = JSON.parse(dataLines.join(\"\\n\"));\n } catch {\n event.data = { value: dataLines.join(\"\\n\") };\n }\n\n return event as AgentEvent;\n };\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n doneReading = true;\n break;\n }\n buffer += decoder.decode(value, { stream: true });\n\n const parts = buffer.split(\"\\n\\n\");\n buffer = parts.pop() ?? \"\";\n\n for (const part of parts) {\n const event = processPart(part);\n if (event) yield event;\n }\n }\n\n if (buffer.trim()) {\n const event = processPart(buffer.trim());\n if (event) yield event;\n }\n } finally {\n if (!doneReading) {\n await reader.cancel();\n }\n reader.releaseLock();\n }\n}\n\nexport class AgentRunEventsClient extends AgentBaseClient {\n /**\n * List stored events for an Agent run.\n */\n async list(\n runId: string,\n options?: ListAgentRunEventsParams\n ): Promise<ListAgentRunEventsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListAgentRunEventsResponse>(\n `/${runId}/events`,\n \"GET\",\n undefined,\n params\n );\n }\n}\n\nexport class AgentRunsClient extends AgentBaseClient {\n /**\n * Client for Agent run events.\n */\n events: AgentRunEventsClient;\n\n constructor(client: Exa) {\n super(client);\n this.events = new AgentRunEventsClient(client);\n }\n\n /**\n * Create an Agent run.\n */\n async create<T>(\n params: AgentCreateOptions<T> & { stream: true }\n ): Promise<AsyncGenerator<AgentEvent>>;\n async create<T>(\n params: AgentCreateOptions<T> & { stream?: false }\n ): Promise<AgentRunTyped<T>>;\n async create(params: CreateAgentRunParams): Promise<AgentRun>;\n async create<T>(\n params: AgentCreateOptions<T>\n ): Promise<AgentRun | AgentRunTyped<T> | AsyncGenerator<AgentEvent>> {\n const { stream, payload } = buildAgentRunPayload(params);\n\n if (stream) {\n const response = await this.rawRequest(\"\", \"POST\", payload, undefined, {\n Accept: \"text/event-stream\",\n });\n if (!response.ok) {\n const message = await response.text();\n throw new ExaError(\n message || `Request failed with status code ${response.status}`,\n response.status,\n new Date().toISOString(),\n \"/agent/runs\"\n );\n }\n return streamAgentEvents(response);\n }\n\n return this.request<AgentRunTyped<T>>(\"\", \"POST\", payload);\n }\n\n /**\n * Get an Agent run by ID.\n */\n async get(runId: string): Promise<AgentRun> {\n return this.request<AgentRun>(`/${runId}`, \"GET\");\n }\n\n /**\n * List Agent runs.\n */\n async list(options?: ListAgentRunsParams): Promise<ListAgentRunsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListAgentRunsResponse>(\"\", \"GET\", undefined, params);\n }\n\n /**\n * Iterate through all Agent runs, handling pagination automatically.\n */\n async *listAll(options?: ListAgentRunsParams): AsyncGenerator<AgentRun> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const run of response.data) {\n yield run;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Agent runs into an array.\n */\n async getAll(options?: ListAgentRunsParams): Promise<AgentRun[]> {\n const runs: AgentRun[] = [];\n for await (const run of this.listAll(options)) {\n runs.push(run);\n }\n return runs;\n }\n\n /**\n * Cancel a queued or running Agent run.\n */\n async cancel(runId: string): Promise<AgentRun> {\n return this.request<AgentRun>(`/${runId}/cancel`, \"POST\");\n }\n\n /**\n * Stop a running Agent run, completing it early with the results\n * gathered so far. Only supported for `ultra` effort runs.\n */\n async stop(runId: string): Promise<AgentRun> {\n return this.request<AgentRun>(`/${runId}/stop`, \"POST\");\n }\n\n /**\n * Delete a stored Agent run.\n */\n async delete(runId: string): Promise<DeletedAgentRun> {\n return this.request<DeletedAgentRun>(`/${runId}`, \"DELETE\");\n }\n\n /**\n * Poll an Agent run until it reaches a terminal status.\n */\n async pollUntilFinished(\n runId: string,\n options?: AgentWaitOptions\n ): Promise<AgentTerminalRun> {\n const pollInterval =\n options?.pollInterval ?? DEFAULT_AGENT_POLL_INTERVAL_MS;\n const timeoutMs = options?.timeoutMs ?? DEFAULT_AGENT_POLL_TIMEOUT_MS;\n const startTime = Date.now();\n\n while (true) {\n const run = await this.get(runId);\n if (isTerminalAgentRunStatus(run.status)) {\n return run as AgentTerminalRun;\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Agent run ${runId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n\n /**\n * Create an Agent run and wait until it reaches a terminal status.\n */\n async createAndWait<T>(\n params: Omit<AgentCreateOptions<T>, \"stream\">,\n options?: AgentWaitOptions\n ): Promise<AgentCompletedRunTyped<T>>;\n async createAndWait(\n params: CreateAgentRunParams,\n options?: AgentWaitOptions\n ): Promise<AgentCompletedRun>;\n async createAndWait<T>(\n params: Omit<AgentCreateOptions<T>, \"stream\">,\n options?: AgentWaitOptions\n ): Promise<AgentCompletedRunTyped<T>> {\n const { stream: _stream, ...createParams } =\n params as AgentCreateOptions<T>;\n const run = (await this.create(\n createParams as AgentCreateOptions<T> & { stream?: false }\n )) as AgentRunTyped<T>;\n const runId = (run as AgentRun).id;\n const terminalRun = (await this.pollUntilFinished(\n runId,\n createAndWaitPollOptions(options)\n )) as AgentTerminalRunTyped<T>;\n return ensureCompletedRun(terminalRun);\n }\n}\n\nexport class AgentClient {\n /**\n * @internal\n */\n readonly client: Exa;\n\n /**\n * Client for Agent runs.\n */\n runs: AgentRunsClient;\n\n constructor(client: Exa) {\n this.client = client;\n this.runs = new AgentRunsClient(client);\n }\n}\n\nexport class AgentBetaRunEventsClient extends AgentRunEventsClient {\n /**\n * List stored events for an Agent run.\n *\n * @deprecated Use exa.agent.runs.events instead.\n */\n async list(\n runId: string,\n options?: WithBetaOptions<ListAgentRunEventsParams>\n ): Promise<ListAgentRunEventsResponse> {\n const { betas, ...pagination } = options ?? {};\n const params = this.buildPaginationParams(pagination);\n return this.request<ListAgentRunEventsResponse>(\n `/${runId}/events`,\n \"GET\",\n undefined,\n params,\n headersForBetas(betas)\n );\n }\n}\n\nexport class AgentBetaRunsClient extends AgentRunsClient {\n /**\n * @deprecated Use exa.agent.runs.events instead.\n */\n events: AgentBetaRunEventsClient;\n\n constructor(client: Exa) {\n super(client);\n this.events = new AgentBetaRunEventsClient(client);\n }\n\n async create<T>(\n params: WithBetaOptions<AgentCreateOptions<T>> & { stream: true }\n ): Promise<AsyncGenerator<AgentEvent>>;\n async create<T>(\n params: WithBetaOptions<AgentCreateOptions<T>> & { stream?: false }\n ): Promise<AgentRunTyped<T>>;\n async create(\n params: CreateAgentRunParams & AgentBetaOptions\n ): Promise<AgentRun>;\n async create<T>(\n params: WithBetaOptions<AgentCreateOptions<T>>\n ): Promise<AgentRun | AgentRunTyped<T> | AsyncGenerator<AgentEvent>> {\n const { betas, ...createParams } = params;\n const { stream, payload } = buildAgentRunPayload(\n createParams as AgentCreateOptions<T>\n );\n const headers = headersForBetas(betas);\n\n if (stream) {\n const response = await this.rawRequest(\"\", \"POST\", payload, undefined, {\n ...headers,\n Accept: \"text/event-stream\",\n });\n if (!response.ok) {\n const message = await response.text();\n throw new ExaError(\n message || `Request failed with status code ${response.status}`,\n response.status,\n new Date().toISOString(),\n \"/agent/runs\"\n );\n }\n return streamAgentEvents(response);\n }\n\n return this.request<AgentRunTyped<T>>(\n \"\",\n \"POST\",\n payload,\n undefined,\n headers\n );\n }\n\n async get(runId: string, options?: AgentBetaOptions): Promise<AgentRun> {\n return this.request<AgentRun>(\n `/${runId}`,\n \"GET\",\n undefined,\n undefined,\n headersForBetas(options?.betas)\n );\n }\n\n async list(\n options?: WithBetaOptions<ListAgentRunsParams>\n ): Promise<ListAgentRunsResponse> {\n const { betas, ...pagination } = options ?? {};\n const params = this.buildPaginationParams(pagination);\n return this.request<ListAgentRunsResponse>(\n \"\",\n \"GET\",\n undefined,\n params,\n headersForBetas(betas)\n );\n }\n\n async *listAll(\n options?: WithBetaOptions<ListAgentRunsParams>\n ): AsyncGenerator<AgentRun> {\n let cursor: string | undefined = undefined;\n const { betas, ...pagination } = options ?? {};\n const pageOptions: ListAgentRunsParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list({ ...pageOptions, betas });\n\n for (const run of response.data) {\n yield run;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n async getAll(\n options?: WithBetaOptions<ListAgentRunsParams>\n ): Promise<AgentRun[]> {\n const runs: AgentRun[] = [];\n for await (const run of this.listAll(options)) {\n runs.push(run);\n }\n return runs;\n }\n\n async cancel(runId: string, options?: AgentBetaOptions): Promise<AgentRun> {\n return this.request<AgentRun>(\n `/${runId}/cancel`,\n \"POST\",\n undefined,\n undefined,\n headersForBetas(options?.betas)\n );\n }\n\n /**\n * Stop a running Agent run, completing it early with the results\n * gathered so far. Only supported for `ultra` effort runs.\n */\n async stop(runId: string, options?: AgentBetaOptions): Promise<AgentRun> {\n return this.request<AgentRun>(\n `/${runId}/stop`,\n \"POST\",\n undefined,\n undefined,\n headersForBetas(options?.betas ?? [AGENT_MAX_EFFORT_BETA])\n );\n }\n\n async delete(\n runId: string,\n options?: AgentBetaOptions\n ): Promise<DeletedAgentRun> {\n return this.request<DeletedAgentRun>(\n `/${runId}`,\n \"DELETE\",\n undefined,\n undefined,\n headersForBetas(options?.betas)\n );\n }\n\n async pollUntilFinished(\n runId: string,\n options?: WithBetaOptions<AgentWaitOptions>\n ): Promise<AgentTerminalRun> {\n const pollInterval =\n options?.pollInterval ?? DEFAULT_AGENT_POLL_INTERVAL_MS;\n const timeoutMs = options?.timeoutMs ?? DEFAULT_AGENT_POLL_TIMEOUT_MS;\n const startTime = Date.now();\n const headers = headersForBetas(options?.betas);\n\n while (true) {\n const run = await this.request<AgentRun>(\n `/${runId}`,\n \"GET\",\n undefined,\n undefined,\n headers\n );\n if (isTerminalAgentRunStatus(run.status)) {\n return run as AgentTerminalRun;\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Agent run ${runId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n\n async createAndWait<T>(\n params: WithBetaOptions<Omit<AgentCreateOptions<T>, \"stream\">>,\n options?: AgentWaitOptions\n ): Promise<AgentCompletedRunTyped<T>>;\n async createAndWait(\n params: CreateAgentRunParams & AgentBetaOptions,\n options?: AgentWaitOptions\n ): Promise<AgentCompletedRun>;\n async createAndWait<T>(\n params: WithBetaOptions<Omit<AgentCreateOptions<T>, \"stream\">>,\n options?: AgentWaitOptions\n ): Promise<AgentCompletedRunTyped<T>> {\n const {\n betas,\n stream: _stream,\n ...createParams\n } = params as WithBetaOptions<AgentCreateOptions<T>>;\n const run = (await this.create({\n ...createParams,\n betas,\n })) as AgentRunTyped<T>;\n const runId = (run as AgentRun).id;\n const terminalRun = (await this.pollUntilFinished(runId, {\n ...createAndWaitPollOptions(options),\n betas,\n })) as AgentTerminalRunTyped<T>;\n return ensureCompletedRun(terminalRun);\n }\n}\n\n/** Beta Agent API clients. */\nexport class AgentBetaClient extends AgentClient {\n /**\n * @deprecated Use exa.agent.runs instead.\n */\n runs: AgentBetaRunsClient;\n\n /**\n * Beta client for Agent Monitors.\n */\n monitors: AgentMonitorsClient;\n\n constructor(clientOrAgent: Exa | AgentClient) {\n const client =\n clientOrAgent instanceof AgentClient\n ? clientOrAgent.client\n : clientOrAgent;\n super(client);\n this.runs = new AgentBetaRunsClient(client);\n this.monitors = new AgentMonitorsClient(client);\n }\n}\n\nexport class BetaClient {\n /**\n * Beta Agent namespace. Stable Agent runs remain available here for\n * backwards compatibility; beta-only Agent products live here exclusively.\n */\n agent: AgentBetaClient;\n\n constructor(clientOrAgent: Exa | AgentClient) {\n this.agent = new AgentBetaClient(clientOrAgent);\n }\n}\n","/**\n * Base client for Search Monitors API\n */\nimport { Exa } from \"../index\";\nimport { ListSearchMonitorsParams, ListSearchMonitorRunsParams } from \"./types\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\nexport class SearchMonitorsBaseClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: Record<string, any>,\n params?: QueryParams\n ): Promise<T> {\n return this.client.request<T>(\n `/monitors${endpoint}`,\n method,\n data,\n params\n );\n }\n\n protected buildPaginationParams(\n pagination?: ListSearchMonitorsParams | ListSearchMonitorRunsParams\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n if (\"status\" in pagination && pagination.status)\n params.status = pagination.status;\n\n return params;\n }\n}\n","/**\n * Client for the Search Monitors API\n */\nimport { Exa } from \"..\";\nimport { SearchMonitorsBaseClient } from \"./base\";\nimport {\n CreateSearchMonitorParams,\n CreateSearchMonitorResponse,\n ListSearchMonitorRunsParams,\n ListSearchMonitorRunsResponse,\n ListSearchMonitorsParams,\n ListSearchMonitorsResponse,\n SearchMonitor,\n SearchMonitorRun,\n TriggerSearchMonitorResponse,\n UpdateSearchMonitorParams,\n} from \"./types\";\n\n/**\n * Client for managing Search Monitor Runs\n */\nexport class SearchMonitorRunsClient extends SearchMonitorsBaseClient {\n /**\n * List all runs for a Search Monitor\n * @param monitorId The ID of the Search Monitor\n * @param options Pagination options\n * @returns The list of Search Monitor runs\n */\n async list(\n monitorId: string,\n options?: ListSearchMonitorRunsParams\n ): Promise<ListSearchMonitorRunsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListSearchMonitorRunsResponse>(\n `/${monitorId}/runs`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Get a specific Search Monitor run\n * @param monitorId The ID of the Search Monitor\n * @param runId The ID of the run\n * @returns The Search Monitor run\n */\n async get(monitorId: string, runId: string): Promise<SearchMonitorRun> {\n return this.request<SearchMonitorRun>(\n `/${monitorId}/runs/${runId}`,\n \"GET\"\n );\n }\n\n /**\n * Iterate through all runs for a Search Monitor, handling pagination automatically\n * @param monitorId The ID of the Search Monitor\n * @param options Pagination options\n * @returns Async generator of Search Monitor runs\n */\n async *listAll(\n monitorId: string,\n options?: ListSearchMonitorRunsParams\n ): AsyncGenerator<SearchMonitorRun> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(monitorId, pageOptions);\n\n for (const run of response.data) {\n yield run;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all runs for a Search Monitor into an array\n * @param monitorId The ID of the Search Monitor\n * @param options Pagination options\n * @returns Promise resolving to an array of all Search Monitor runs\n */\n async getAll(\n monitorId: string,\n options?: ListSearchMonitorRunsParams\n ): Promise<SearchMonitorRun[]> {\n const runs: SearchMonitorRun[] = [];\n for await (const run of this.listAll(monitorId, options)) {\n runs.push(run);\n }\n return runs;\n }\n}\n\n/**\n * Client for managing Search Monitors\n */\nexport class SearchMonitorsClient extends SearchMonitorsBaseClient {\n /**\n * Client for managing Search Monitor Runs\n */\n runs: SearchMonitorRunsClient;\n\n constructor(client: Exa) {\n super(client);\n this.runs = new SearchMonitorRunsClient(client);\n }\n\n /**\n * Create a Search Monitor\n * @param params The monitor creation parameters\n * @returns The created Search Monitor with webhookSecret\n */\n async create(\n params: CreateSearchMonitorParams\n ): Promise<CreateSearchMonitorResponse> {\n return this.request<CreateSearchMonitorResponse>(\"\", \"POST\", params);\n }\n\n /**\n * Get a Search Monitor by ID\n * @param id The ID of the Search Monitor\n * @returns The Search Monitor\n */\n async get(id: string): Promise<SearchMonitor> {\n return this.request<SearchMonitor>(`/${id}`, \"GET\");\n }\n\n /**\n * List Search Monitors\n * @param options Pagination and filtering options\n * @returns The list of Search Monitors\n */\n async list(\n options?: ListSearchMonitorsParams\n ): Promise<ListSearchMonitorsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListSearchMonitorsResponse>(\n \"\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Update a Search Monitor\n * @param id The ID of the Search Monitor\n * @param params The update parameters\n * @returns The updated Search Monitor\n */\n async update(\n id: string,\n params: UpdateSearchMonitorParams\n ): Promise<SearchMonitor> {\n return this.request<SearchMonitor>(`/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete a Search Monitor\n * @param id The ID of the Search Monitor\n * @returns The deleted Search Monitor\n */\n async delete(id: string): Promise<SearchMonitor> {\n return this.request<SearchMonitor>(`/${id}`, \"DELETE\");\n }\n\n /**\n * Trigger a Search Monitor run immediately\n * @param id The ID of the Search Monitor\n * @returns Whether the monitor was triggered\n */\n async trigger(id: string): Promise<TriggerSearchMonitorResponse> {\n return this.request<TriggerSearchMonitorResponse>(\n `/${id}/trigger`,\n \"POST\"\n );\n }\n\n /**\n * Iterate through all Search Monitors, handling pagination automatically\n * @param options Pagination and filtering options\n * @returns Async generator of Search Monitors\n */\n async *listAll(\n options?: ListSearchMonitorsParams\n ): AsyncGenerator<SearchMonitor> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const monitor of response.data) {\n yield monitor;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Search Monitors into an array\n * @param options Pagination and filtering options\n * @returns Promise resolving to an array of all Search Monitors\n */\n async getAll(options?: ListSearchMonitorsParams): Promise<SearchMonitor[]> {\n const monitors: SearchMonitor[] = [];\n for await (const monitor of this.listAll(options)) {\n monitors.push(monitor);\n }\n return monitors;\n }\n}\n","import { Exa } from \"../index\";\nimport { ListResearchRequest } from \"./index\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\ninterface RequestBody {\n [key: string]: unknown;\n}\n\nexport class ResearchBaseClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams\n ): Promise<T> {\n return this.client.request<T>(\n `/research/v1${endpoint}`,\n method,\n data,\n params\n );\n }\n\n protected async rawRequest(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams\n ): Promise<Response> {\n return this.client.rawRequest(\n `/research/v1${endpoint}`,\n method,\n data,\n params\n );\n }\n\n protected buildPaginationParams(\n pagination?: ListResearchRequest\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n\n return params;\n }\n}\n","import { Exa } from \"../index\";\nimport {\n ListResearchRequest,\n ListResearchResponse,\n Research,\n ResearchCreateRequest,\n ResearchCreateResponse,\n ResearchStreamEvent,\n ResearchCreateParamsTyped,\n ResearchTyped,\n} from \"./index\";\nimport { ZodSchema } from \"zod\";\nimport { isZodSchema, zodToJsonSchema } from \"../zod-utils\";\nimport { ResearchBaseClient } from \"./base\";\n\nexport class ResearchClient extends ResearchBaseClient {\n constructor(client: Exa) {\n super(client);\n }\n\n async create<T>(\n params: ResearchCreateParamsTyped<ZodSchema<T>>\n ): Promise<ResearchCreateResponse>;\n\n async create(params: {\n instructions: string;\n model?: ResearchCreateRequest[\"model\"];\n outputSchema?: Record<string, unknown>;\n }): Promise<ResearchCreateResponse>;\n\n async create<T>(params: {\n instructions: string;\n model?: ResearchCreateRequest[\"model\"];\n outputSchema?: Record<string, unknown> | ZodSchema<T>;\n }): Promise<ResearchCreateResponse> {\n const { instructions, model, outputSchema } = params;\n\n let schema = outputSchema;\n if (schema && isZodSchema(schema)) {\n schema = zodToJsonSchema(schema);\n }\n\n const payload: ResearchCreateRequest = {\n instructions,\n model: model ?? \"exa-research-fast\",\n };\n\n if (schema) {\n payload.outputSchema = schema as Record<string, unknown>;\n }\n\n return this.request<ResearchCreateResponse>(\"\", \"POST\", payload);\n }\n\n get(researchId: string): Promise<Research>;\n get(\n researchId: string,\n options: { stream?: false; events?: boolean }\n ): Promise<Research>;\n get<T>(\n researchId: string,\n options: { stream?: false; events?: boolean; outputSchema: ZodSchema<T> }\n ): Promise<ResearchTyped<T>>;\n get(\n researchId: string,\n options: { stream: true; events?: boolean }\n ): Promise<AsyncGenerator<ResearchStreamEvent, any, any>>;\n get<T>(\n researchId: string,\n options: { stream: true; events?: boolean; outputSchema?: ZodSchema<T> }\n ): Promise<AsyncGenerator<ResearchStreamEvent, any, any>>;\n get<T = unknown>(\n researchId: string,\n options?: {\n stream?: boolean;\n events?: boolean;\n outputSchema?: ZodSchema<T>;\n }\n ):\n | Promise<Research | ResearchTyped<T>>\n | Promise<AsyncGenerator<ResearchStreamEvent>> {\n if (options?.stream) {\n const promise = async () => {\n const params: Record<string, string> = { stream: \"true\" };\n if (options.events !== undefined) {\n params.events = options.events.toString();\n }\n const resp = await this.rawRequest(\n `/${researchId}`,\n \"GET\",\n undefined,\n params\n );\n if (!resp.body) {\n throw new Error(\"No response body for SSE stream\");\n }\n const reader = resp.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n function processPart(part: string): ResearchStreamEvent | null {\n const lines = part.split(\"\\n\");\n let data = lines.slice(1).join(\"\\n\");\n if (data.startsWith(\"data:\")) {\n data = data.slice(5).trimStart();\n }\n try {\n return JSON.parse(data);\n } catch (e) {\n return null;\n }\n }\n\n async function* streamEvents() {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n\n let parts = buffer.split(\"\\n\\n\");\n buffer = parts.pop() ?? \"\";\n\n for (const part of parts) {\n const processed = processPart(part);\n if (processed) {\n yield processed;\n }\n }\n }\n if (buffer.trim()) {\n const processed = processPart(buffer.trim());\n if (processed) {\n yield processed;\n }\n }\n }\n\n return streamEvents();\n };\n return promise() as\n | Promise<Research>\n | Promise<AsyncGenerator<ResearchStreamEvent>>;\n } else {\n const params: Record<string, string> = { stream: \"false\" };\n if (options?.events !== undefined) {\n params.events = options.events.toString();\n }\n return this.request<Research>(\n `/${researchId}`,\n \"GET\",\n undefined,\n params\n ) as Promise<Research> | Promise<AsyncGenerator<ResearchStreamEvent>>;\n }\n }\n\n async list(options?: ListResearchRequest): Promise<ListResearchResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListResearchResponse>(\"\", \"GET\", undefined, params);\n }\n\n async pollUntilFinished(\n researchId: string,\n options?: {\n pollInterval?: number;\n timeoutMs?: number;\n events?: boolean;\n }\n ): Promise<Research & { status: \"completed\" | \"failed\" | \"canceled\" }>;\n async pollUntilFinished<T>(\n researchId: string,\n options?: {\n pollInterval?: number;\n timeoutMs?: number;\n events?: boolean;\n outputSchema: ZodSchema<T>;\n }\n ): Promise<\n ResearchTyped<T> & { status: \"completed\" | \"failed\" | \"canceled\" }\n >;\n async pollUntilFinished<T = unknown>(\n researchId: string,\n options?: {\n pollInterval?: number;\n timeoutMs?: number;\n events?: boolean;\n outputSchema?: ZodSchema<T>;\n }\n ): Promise<any> {\n const pollInterval = options?.pollInterval ?? 1000;\n const timeoutMs = options?.timeoutMs ?? 10 * 60 * 1000;\n const maxConsecutiveFailures = 5;\n const startTime = Date.now();\n let consecutiveFailures = 0;\n\n while (true) {\n try {\n const research = await this.get(researchId, {\n events: options?.events,\n });\n consecutiveFailures = 0;\n\n if (\n research.status === \"completed\" ||\n research.status === \"failed\" ||\n research.status === \"canceled\"\n ) {\n return research;\n }\n } catch (err) {\n consecutiveFailures += 1;\n if (consecutiveFailures >= maxConsecutiveFailures) {\n throw new Error(\n `Polling failed ${maxConsecutiveFailures} times in a row for research ${researchId}: ${err}`\n );\n }\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Research ${researchId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n}\n","/**\n * Base client for Websets API\n */\nimport { Exa } from \"../index\";\n\n/**\n * Type for API query parameters\n */\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\n/**\n * Type for API request body\n */\ninterface RequestBody {\n [key: string]: unknown;\n}\n\n/**\n * Common pagination parameters\n */\nexport interface PaginationParams {\n /**\n * Cursor for pagination\n */\n cursor?: string;\n\n /**\n * Maximum number of items per page\n */\n limit?: number;\n}\n\n/**\n * Base client class for all Websets-related API clients\n */\nexport class WebsetsBaseClient {\n protected client: Exa;\n\n /**\n * Initialize a new Websets base client\n * @param client The Exa client instance\n */\n constructor(client: Exa) {\n this.client = client;\n }\n\n /**\n * Make a request to the Websets API\n * @param endpoint The endpoint path\n * @param method The HTTP method\n * @param data Optional request body data\n * @param params Optional query parameters\n * @returns The response JSON\n * @throws ExaError with API error details if the request fails\n */\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<T> {\n return this.client.request<T>(\n `/websets${endpoint}`,\n method,\n data,\n params,\n headers\n );\n }\n\n /**\n * Helper to build pagination parameters\n * @param pagination The pagination parameters\n * @returns QueryParams object with pagination parameters\n */\n protected buildPaginationParams(pagination?: PaginationParams): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n\n return params;\n }\n}\n","/**\n * Client for managing Webset Enrichments\n */\nimport { WebsetsBaseClient } from \"./base\";\nimport {\n CreateEnrichmentParameters,\n UpdateEnrichmentParameters,\n WebsetEnrichment,\n} from \"./openapi\";\n\n/**\n * Client for managing Webset Enrichments\n */\nexport class WebsetEnrichmentsClient extends WebsetsBaseClient {\n /**\n * Create an Enrichment for a Webset\n * @param websetId The ID of the Webset\n * @param params The enrichment parameters\n * @returns The created Webset Enrichment\n */\n async create(\n websetId: string,\n params: CreateEnrichmentParameters\n ): Promise<WebsetEnrichment> {\n return this.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments`,\n \"POST\",\n params\n );\n }\n\n /**\n * Get an Enrichment by ID\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @returns The Webset Enrichment\n */\n async get(websetId: string, id: string): Promise<WebsetEnrichment> {\n return this.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments/${id}`,\n \"GET\"\n );\n }\n\n /**\n * Delete an Enrichment\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @returns The deleted Webset Enrichment\n */\n async delete(websetId: string, id: string): Promise<WebsetEnrichment> {\n return this.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments/${id}`,\n \"DELETE\"\n );\n }\n\n /**\n * Update an Enrichment\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @param params The enrichment update parameters\n * @returns Promise that resolves when the update is complete\n */\n async update(\n websetId: string,\n id: string,\n params: UpdateEnrichmentParameters\n ): Promise<void> {\n return this.request<void>(\n `/v0/websets/${websetId}/enrichments/${id}`,\n \"PATCH\",\n params\n );\n }\n\n /**\n * Cancel a running Enrichment\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @returns The canceled Webset Enrichment\n */\n async cancel(websetId: string, id: string): Promise<WebsetEnrichment> {\n return this.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments/${id}/cancel`,\n \"POST\"\n );\n }\n}\n","import { Exa } from \"../index\";\nimport { WebsetsBaseClient } from \"./base\";\nimport { Event, EventType, ListEventsResponse } from \"./openapi\";\n\n/**\n * Options for listing Events\n */\nexport interface ListEventsOptions {\n /**\n * The cursor to paginate through the results\n */\n cursor?: string;\n /**\n * The number of results to return\n */\n limit?: number;\n /**\n * The types of events to filter by\n */\n types?: EventType[];\n}\n\n/**\n * Client for managing Events\n */\nexport class EventsClient extends WebsetsBaseClient {\n /**\n * Initialize a new Events client\n * @param client The Exa client instance\n */\n constructor(client: Exa) {\n super(client);\n }\n\n /**\n * List all Events\n * @param options Optional filtering and pagination options\n * @returns The list of Events\n */\n async list(options?: ListEventsOptions): Promise<ListEventsResponse> {\n const params = {\n cursor: options?.cursor,\n limit: options?.limit,\n types: options?.types,\n };\n\n return this.request<ListEventsResponse>(\n \"/v0/events\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Get an Event by ID\n * @param id The ID of the Event\n * @returns The Event\n */\n async get(id: string): Promise<Event> {\n return this.request<Event>(`/v0/events/${id}`, \"GET\");\n }\n\n /**\n * Iterate through all Events, handling pagination automatically\n * @param options Filtering and pagination options\n * @returns Async generator of Events\n */\n async *listAll(options?: ListEventsOptions): AsyncGenerator<Event> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const event of response.data) {\n yield event;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Events into an array\n * @param options Filtering and pagination options\n * @returns Promise resolving to an array of all Events\n */\n async getAll(options?: ListEventsOptions): Promise<Event[]> {\n const events: Event[] = [];\n for await (const event of this.listAll(options)) {\n events.push(event);\n }\n return events;\n }\n}\n","/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n */\n\nexport interface paths {\n \"/v0/events\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List all Events\n * @description List all events that have occurred in the system.\n *\n * You can paginate through the results using the `cursor` parameter.\n */\n get: operations[\"events-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/events/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get an Event\n * @description Get a single Event by id.\n *\n * You can subscribe to Events by creating a Webhook.\n */\n get: operations[\"events-get\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/imports\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List Imports\n * @description Lists all imports for the Webset.\n */\n get: operations[\"imports-list\"];\n put?: never;\n /**\n * Create an Import\n * @description Creates a new import to upload your data into Websets. Imports can be used to:\n *\n * - **Enrich**: Enhance your data with additional information using our AI-powered enrichment engine\n * - **Search**: Query your data using Websets' agentic search with natural language filters\n * - **Exclude**: Prevent duplicate or already known results from appearing in your searches\n *\n * Once the import is created, you can upload your data to the returned `uploadUrl` until `uploadValidUntil` (by default 1 hour).\n */\n post: operations[\"imports-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/imports/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get Import\n * @description Gets a specific import.\n */\n get: operations[\"imports-get\"];\n put?: never;\n post?: never;\n /**\n * Delete Import\n * @description Deletes a import.\n */\n delete: operations[\"imports-delete\"];\n options?: never;\n head?: never;\n /**\n * Update Import\n * @description Updates a import configuration.\n */\n patch: operations[\"imports-update\"];\n trace?: never;\n };\n \"/v0/monitors\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List Monitors\n * @description Lists all monitors for the Webset.\n */\n get: operations[\"monitors-list\"];\n put?: never;\n /**\n * Create a Monitor\n * @description Creates a new `Monitor` to continuously keep your Websets updated with fresh data.\n *\n * Monitors automatically run on your defined schedule to ensure your Websets stay current without manual intervention:\n *\n * - **Find new content**: Execute `search` operations to discover fresh items matching your criteria\n * - **Update existing content**: Run `refresh` operations to update items contents and enrichments\n * - **Automated scheduling**: Configure `cron` expressions and `timezone` for precise scheduling control\n */\n post: operations[\"monitors-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/monitors/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get Monitor\n * @description Gets a specific monitor.\n */\n get: operations[\"monitors-get\"];\n put?: never;\n post?: never;\n /**\n * Delete Monitor\n * @description Deletes a monitor.\n */\n delete: operations[\"monitors-delete\"];\n options?: never;\n head?: never;\n /**\n * Update Monitor\n * @description Updates a monitor configuration.\n */\n patch: operations[\"monitors-update\"];\n trace?: never;\n };\n \"/v0/monitors/{monitor}/runs\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List Monitor Runs\n * @description Lists all runs for the Monitor.\n */\n get: operations[\"monitors-runs-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/monitors/{monitor}/runs/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get Monitor Run\n * @description Gets a specific monitor run.\n */\n get: operations[\"monitors-runs-get\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/webhooks\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List webhooks\n * @description Get a list of all webhooks in your account.\n * The results come in pages. Use `limit` to set how many webhooks to get per page (up to 200). Use `cursor` to get the next page of results.\n */\n get: operations[\"webhooks-list\"];\n put?: never;\n /**\n * Create a Webhook\n * @description Webhooks let you get notifications when things happen in your Websets. When you create a webhook, you choose which events you want to know about and where to send the notifications.\n *\n * When an event happens, Exa sends an HTTP POST request to your webhook URL with:\n * - Event details (type, time, ID)\n * - Full data of what triggered the event\n * - A signature to verify the request came from Exa\n *\n * The webhook starts as `active` and begins getting notifications right away. You'll get a secret key for checking webhook signatures - save this safely as it's only shown once when you create the webhook.\n */\n post: operations[\"webhooks-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/webhooks/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get a Webhook\n * @description Get information about a webhook using its ID.\n * The webhook secret is not shown here for security - you only get it when you first create the webhook.\n */\n get: operations[\"webhooks-get\"];\n put?: never;\n post?: never;\n /**\n * Delete a Webhook\n * @description Remove a webhook from your account. Once deleted, the webhook stops getting notifications right away and cannot be brought back.\n *\n * Important notes: - The webhook stops working as soon as you delete it - You cannot undo this - you'll need to create a new webhook if you want it back - Any notifications currently being sent may still complete\n */\n delete: operations[\"webhooks-delete\"];\n options?: never;\n head?: never;\n /**\n * Update a Webhook\n * @description Change a webhook's settings. You can update:\n * - Events: Add or remove which events you want to hear about - URL: Change where notifications are sent - Metadata: Update custom data linked to the webhook\n *\n * Changes happen right away. If you change the events list, the webhook will start or stop getting notifications for those events immediately.\n *\n * The webhook keeps its current status (`active` or `inactive`) when you update it.\n */\n patch: operations[\"webhooks-update\"];\n trace?: never;\n };\n \"/v0/webhooks/{id}/attempts\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List webhook attempts\n * @description List all attempts made by a Webhook ordered in descending order.\n */\n get: operations[\"webhooks-attempts-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List all Websets\n * @description Returns a list of Websets.\n *\n * You can paginate through the results using the `cursor` parameter.\n */\n get: operations[\"websets-list\"];\n put?: never;\n /**\n * Create a Webset\n * @description Creates a new Webset with optional search, import, and enrichment configurations. The Webset will automatically begin processing once created.\n *\n * You can specify an `externalId` to reference the Webset with your own identifiers for easier integration.\n */\n post: operations[\"websets-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get a Webset */\n get: operations[\"websets-get\"];\n put?: never;\n /** Update a Webset */\n post: operations[\"websets-update\"];\n /**\n * Delete a Webset\n * @description Deletes a Webset.\n *\n * Once deleted, the Webset and all its Items will no longer be available.\n */\n delete: operations[\"websets-delete\"];\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{id}/cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Cancel a running Webset\n * @description Cancels all operations being performed on a Webset.\n *\n * Any enrichment or search will be stopped and the Webset will be marked as `idle`.\n */\n post: operations[\"websets-cancel\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/enrichments\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Create an Enrichment\n * @description Create an Enrichment for a Webset.\n */\n post: operations[\"websets-enrichments-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/enrichments/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get an Enrichment */\n get: operations[\"websets-enrichments-get\"];\n put?: never;\n post?: never;\n /**\n * Delete an Enrichment\n * @description When deleting an Enrichment, any running enrichments will be canceled and all existing `enrichment_result` generated by this Enrichment will no longer be available.\n */\n delete: operations[\"websets-enrichments-delete\"];\n options?: never;\n head?: never;\n /**\n * Update an Enrichment\n * @description Update an Enrichment configuration for a Webset.\n */\n patch: operations[\"websets-enrichments-update\"];\n trace?: never;\n };\n \"/v0/websets/{webset}/enrichments/{id}/cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Cancel a running Enrichment\n * @description All running enrichments will be canceled. You can not resume an Enrichment after it has been canceled.\n */\n post: operations[\"websets-enrichments-cancel\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/items\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List all Items for a Webset\n * @description Returns a list of Webset Items.\n *\n * You can paginate through the Items using the `cursor` parameter.\n */\n get: operations[\"websets-items-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/items/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get an Item\n * @description Returns a Webset Item.\n */\n get: operations[\"websets-items-get\"];\n put?: never;\n post?: never;\n /**\n * Delete an Item\n * @description Deletes an Item from the Webset.\n *\n * This will cancel any enrichment process for it.\n */\n delete: operations[\"websets-items-delete\"];\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/searches\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Create a Search\n * @description Creates a new Search for the Webset.\n *\n * The default behavior is to reuse the previous Search results and evaluate them against the new criteria.\n */\n post: operations[\"websets-searches-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/searches/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get a Search\n * @description Gets a Search by id\n */\n get: operations[\"websets-searches-get\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/searches/{id}/cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Cancel a running Search\n * @description Cancels a currently running Search.\n *\n * You can cancel all searches at once by using the `websets/:webset/cancel` endpoint.\n */\n post: operations[\"websets-searches-cancel\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/preview\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Preview a webset\n * @description Preview how a search query will be decomposed before creating a webset. This endpoint performs the same query analysis that happens during webset creation, allowing you to see the detected entity type, generated search criteria, and available enrichment columns in advance.\n *\n * Use this to help users understand how their search will be interpreted before committing to a full webset creation.\n */\n post: operations[\"websets-preview\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n}\nexport type webhooks = Record<string, never>;\nexport interface components {\n schemas: {\n /** Article */\n ArticleEntity: {\n /**\n * @default article\n * @constant\n */\n type: \"article\";\n };\n /** Company */\n CompanyEntity: {\n /**\n * @default company\n * @constant\n */\n type: \"company\";\n };\n CreateCriterionParameters: {\n /** @description The description of the criterion */\n description: string;\n };\n CreateEnrichmentParameters: {\n /** @description Provide a description of the enrichment task you want to perform to each Webset Item. */\n description: string;\n /**\n * @description Format of the enrichment response.\n *\n * We automatically select the best format based on the description. If you want to explicitly specify the format, you can do so here.\n * @enum {string}\n */\n format?: CreateEnrichmentParametersFormat;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description When the format is options, the different options for the enrichment agent to choose from. */\n options?: {\n /** @description The label of the option */\n label: string;\n }[];\n };\n CreateImportParameters: {\n /** @description The number of records to import */\n count: number;\n /** @description When format is `csv`, these are the specific import parameters. */\n csv?: {\n /** @description Column containing the key identifier for the entity (e.g. URL, Name, etc.). If not provided, we will try to infer it from the file. */\n identifier?: number;\n };\n /** @description What type of entity the import contains (e.g. People, Companies, etc.), and thus should be attempted to be resolved as. */\n entity:\n | components[\"schemas\"][\"CompanyEntity\"]\n | components[\"schemas\"][\"PersonEntity\"]\n | components[\"schemas\"][\"ArticleEntity\"]\n | components[\"schemas\"][\"ResearchPaperEntity\"]\n | components[\"schemas\"][\"CustomEntity\"];\n /**\n * @description When the import is in CSV format, we expect a column containing the key identifier for the entity - for now URL. If not provided, import will fail to be processed.\n * @enum {string}\n */\n format: CreateImportParametersFormat;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description The size of the file in bytes. Maximum size is 50 MB. */\n size: number;\n /** @description The title of the import */\n title?: string;\n };\n /** @description The response to a successful import. Includes the upload URL and the upload valid until date. */\n CreateImportResponse: {\n /** @description The number of entities in the import */\n count: number;\n /**\n * Format: date-time\n * @description When the import was created\n */\n createdAt: string;\n /** @description The type of entity the import contains. */\n entity: components[\"schemas\"][\"Entity\"];\n /**\n * Format: date-time\n * @description When the import failed\n */\n failedAt: string | null;\n /** @description A human readable message of the import failure */\n failedMessage: string | null;\n /**\n * @description The reason the import failed\n * @enum {string|null}\n */\n failedReason: CreateImportResponseFailedReason;\n /**\n * @description The format of the import.\n * @enum {string}\n */\n format: CreateImportResponseFormat;\n /** @description The unique identifier for the Import */\n id: string;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata: {\n [key: string]: string;\n };\n /**\n * @description The type of object\n * @enum {string}\n */\n object: CreateImportResponseObject;\n /**\n * @description The status of the Import\n * @enum {string}\n */\n status: CreateImportResponseStatus;\n /** @description The title of the import */\n title: string;\n /**\n * Format: date-time\n * @description When the import was last updated\n */\n updatedAt: string;\n /** @description The URL to upload the file to */\n uploadUrl: string;\n /** @description The date and time until the upload URL is valid. The upload URL will be valid for 1 hour. */\n uploadValidUntil: string;\n };\n CreateMonitorParameters: {\n /** @description Behavior to perform when monitor runs */\n behavior: {\n /** @description Specify the search parameters for the Monitor.\n *\n * By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */\n config: {\n /**\n * @description The behaviour of the Search when it is added to a Webset.\n * @default append\n * @enum {string}\n */\n behavior: WebsetSearchBehavior;\n /** @description The maximum number of results to find */\n count: number;\n /** @description The criteria to search for. By default, the criteria from the last search is used. */\n criteria?: {\n description: string;\n }[];\n /**\n * Entity\n * @description The entity to search for. By default, the entity from the last search/import is used.\n */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description The query to search for. By default, the query from the last search is used. */\n query?: string;\n };\n /**\n * @default search\n * @constant\n */\n type: \"search\";\n };\n /** @description How often the monitor will run */\n cadence: {\n /** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */\n cron: string;\n /**\n * @description IANA timezone (e.g., \"America/New_York\")\n * @default Etc/UTC\n */\n timezone: string;\n };\n metadata?: {\n [key: string]: string;\n };\n /** @description The id of the Webset */\n websetId: string;\n };\n CreateWebhookParameters: {\n /** @description The events to trigger the webhook */\n events: EventType[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /**\n * Format: uri\n * @description The URL to send the webhook to\n */\n url: string;\n };\n CreateWebsetParameters: {\n /** @description Add enrichments to extract additional data from found items.\n *\n * Enrichments automatically search for and extract specific information (like contact details, funding data, employee counts, etc.) from each item added to your Webset. */\n enrichments?: components[\"schemas\"][\"CreateEnrichmentParameters\"][];\n /** @description Global exclusion sources (existing imports or websets) that apply to all operations within this Webset. Any results found within these sources will be omitted across all search and import operations. */\n exclude?: {\n /** @description The ID of the source to exclude. */\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description The external identifier for the webset.\n *\n * You can use this to reference the Webset by your own internal identifiers. */\n externalId?: string;\n /** @description Attach/load data from existing Imports or Websets into this Webset. For CSV Imports, this schedules ingestion and creates a staging pool of items (ImportItems do not automatically appear as Webset Items; searches create Webset Items). This does not filter searches. To filter a search to only look within an Import or Webset, use search.scope instead. */\n import?: {\n /** @description The ID of the source to search. */\n id: string;\n /** @enum {string} */\n source: WebsetImportSource;\n }[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description Create initial search for the Webset. */\n search?: {\n /**\n * @description Number of Items the Webset will attempt to find.\n *\n * The actual number of Items found may be less than this number depending on the search complexity.\n * @default 10\n */\n count: number;\n /** @description Criteria every item is evaluated against.\n *\n * It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query. Only use this when you need more fine control. */\n criteria?: components[\"schemas\"][\"CreateCriterionParameters\"][];\n /** @description Entity the Webset will return results for.\n *\n * 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. */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description Sources (existing imports or websets) to exclude from search results. Any results found within these sources will be omitted to prevent finding them during search. */\n exclude?: {\n /** @description The ID of the source to exclude. */\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description Optional soft cap for people searches. When set, the search will try to include at most this many matching people from the same current employer company. */\n maxPeoplePerCompany?: number;\n /** @description Natural language search query describing what you are looking for.\n *\n * Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results.\n *\n * Any URLs provided will be crawled and used as additional context for the search. */\n query: string;\n /** @description Whether to provide an estimate of how many total relevant results could exist for this search.\n * Result of the analysis will be available in the `recall` field within the search request. */\n recall?: boolean;\n /** @description Limit this search to only consider candidates from the listed sources (existing Imports or Websets). Scope applies per-search; if you run another search and want to stay within the same dataset, pass scope again. When scope is present, the search behavior is OVERRIDE (replaces results rather than appending). Note: Using the same Import in both top-level import and search.scope will return a 400 error. */\n scope?: {\n /** @description The ID of the source to search. */\n id: string;\n relationship?: {\n /** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. Only needed for hop searches (graph traversal) from the source entities to related targets. Examples: \"investors of\", \"current employer\", \"employees at\". Omit for simple filtering within the source. */\n definition: string;\n /** @description Number of related entities to find per source entity (fanout). Only used for hop searches. Range: 1-10. */\n limit: number;\n };\n /** @enum {string} */\n source: WebsetSearchScopeSource;\n }[];\n };\n };\n CreateWebsetSearchParameters: {\n /**\n * @description How this search interacts with existing items in the Webset:\n *\n * - **override**: Replace existing items and evaluate all items against new criteria\n * - **append**: Add new items to existing ones, keeping items that match the new criteria\n * @default override\n */\n behavior: WebsetSearchBehavior;\n /** @description Number of Items the Search will attempt to find.\n *\n * The actual number of Items found may be less than this number depending on the query complexity. */\n count: number;\n /** @description Criteria every item is evaluated against.\n *\n * It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query. Only use this when you need more fine control. */\n criteria?: components[\"schemas\"][\"CreateCriterionParameters\"][];\n /** @description Entity the search will return results for.\n *\n * 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. */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description Sources (existing imports or websets) to exclude from search results. Any results found within these sources will be omitted to prevent finding them during search. */\n exclude?: {\n /** @description The ID of the source to exclude. */\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description Optional soft cap for people searches. When set, the search will try to include at most this many matching people from the same current employer company. */\n maxPeoplePerCompany?: number;\n /** @description Natural language search query describing what you are looking for.\n *\n * Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results.\n *\n * Any URLs provided will be crawled and used as additional context for the search. */\n query: string;\n /** @description Whether to provide an estimate of how many total relevant results could exist for this search.\n * Result of the analysis will be available in the `recall` field within the search request. */\n recall?: boolean;\n /** @description Limit the search to specific sources (existing imports). Any results found within these sources matching the search criteria will be included in the Webset. */\n scope?: {\n /** @description The ID of the source to search. */\n id: string;\n relationship?: {\n /** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. */\n definition: string;\n limit: number;\n };\n /** @enum {string} */\n source: WebsetSearchScopeSource;\n }[];\n };\n /** Custom */\n CustomEntity: {\n description: string;\n /**\n * @default custom\n * @constant\n */\n type: \"custom\";\n };\n EnrichmentResult: {\n /** @description The id of the Enrichment that generated the result */\n enrichmentId: string;\n format: components[\"schemas\"][\"WebsetEnrichmentFormat\"];\n /**\n * @default enrichment_result\n * @constant\n */\n object: \"enrichment_result\";\n /** @description The reasoning for the result when an Agent is used. */\n reasoning: string | null;\n /** @description The references used to generate the result. */\n references: {\n /** @description The relevant snippet of the reference content */\n snippet: string | null;\n /** @description The title of the reference */\n title: string | null;\n /**\n * Format: uri\n * @description The URL of the reference\n */\n url: string;\n }[];\n /** @description The result of the enrichment. */\n result: string[] | null;\n /**\n * @description The status of the enrichment result.\n * @enum {string}\n */\n status: EnrichmentResultStatus;\n };\n Entity:\n | components[\"schemas\"][\"CompanyEntity\"]\n | components[\"schemas\"][\"PersonEntity\"]\n | components[\"schemas\"][\"ArticleEntity\"]\n | components[\"schemas\"][\"ResearchPaperEntity\"]\n | components[\"schemas\"][\"CustomEntity\"];\n /** Event */\n Event:\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.created\n * @constant\n */\n type: \"webset.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.deleted\n * @constant\n */\n type: \"webset.deleted\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.idle\n * @constant\n */\n type: \"webset.idle\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.paused\n * @constant\n */\n type: \"webset.paused\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetItem\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.item.created\n * @constant\n */\n type: \"webset.item.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetItem\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.item.enriched\n * @constant\n */\n type: \"webset.item.enriched\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.created\n * @constant\n */\n type: \"webset.search.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.updated\n * @constant\n */\n type: \"webset.search.updated\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.canceled\n * @constant\n */\n type: \"webset.search.canceled\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.completed\n * @constant\n */\n type: \"webset.search.completed\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Import\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default import.created\n * @constant\n */\n type: \"import.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Import\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default import.completed\n * @constant\n */\n type: \"import.completed\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Monitor\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.created\n * @constant\n */\n type: \"monitor.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Monitor\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.updated\n * @constant\n */\n type: \"monitor.updated\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Monitor\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.deleted\n * @constant\n */\n type: \"monitor.deleted\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"MonitorRun\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.run.created\n * @constant\n */\n type: \"monitor.run.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"MonitorRun\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.run.completed\n * @constant\n */\n type: \"monitor.run.completed\";\n };\n /** @enum {string} */\n EventType: EventType;\n GetWebsetResponse: components[\"schemas\"][\"Webset\"] & {\n /** @description When expand query parameter contains `items`, this will contain the items in the webset */\n items?: components[\"schemas\"][\"WebsetItem\"][];\n };\n Import: {\n /** @description The number of entities in the import */\n count: number;\n /**\n * Format: date-time\n * @description When the import was created\n */\n createdAt: string;\n /** @description The type of entity the import contains. */\n entity: components[\"schemas\"][\"Entity\"];\n /**\n * Format: date-time\n * @description When the import failed\n */\n failedAt: string | null;\n /** @description A human readable message of the import failure */\n failedMessage: string | null;\n /**\n * @description The reason the import failed\n * @enum {string|null}\n */\n failedReason: ImportFailedReason;\n /**\n * @description The format of the import.\n * @enum {string}\n */\n format: ImportFormat;\n /** @description The unique identifier for the Import */\n id: string;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata: {\n [key: string]: string;\n };\n /**\n * @description The type of object\n * @enum {string}\n */\n object: ImportObject;\n /**\n * @description The status of the Import\n * @enum {string}\n */\n status: ImportStatus;\n /** @description The title of the import */\n title: string;\n /**\n * Format: date-time\n * @description When the import was last updated\n */\n updatedAt: string;\n };\n ListEventsResponse: {\n /** @description The list of events */\n data: components[\"schemas\"][\"Event\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListImportsResponse: {\n /** @description The list of imports */\n data: components[\"schemas\"][\"Import\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListMonitorRunsResponse: {\n /** @description The list of monitor runs */\n data: components[\"schemas\"][\"MonitorRun\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListMonitorsResponse: {\n /** @description The list of monitors */\n data: components[\"schemas\"][\"Monitor\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListWebhookAttemptsResponse: {\n /** @description The list of webhook attempts */\n data: components[\"schemas\"][\"WebhookAttempt\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListWebhooksResponse: {\n /** @description The list of webhooks */\n data: components[\"schemas\"][\"Webhook\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListWebsetItemResponse: {\n /** @description The list of webset items */\n data: components[\"schemas\"][\"WebsetItem\"][];\n /** @description Whether there are more Items to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of Items */\n nextCursor: string | null;\n };\n ListWebsetsResponse: {\n /** @description The list of websets */\n data: components[\"schemas\"][\"Webset\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n Monitor: {\n /** @description Behavior to perform when monitor runs */\n behavior: {\n /** @description Specify the search parameters for the Monitor.\n *\n * By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */\n config: {\n /**\n * @description The behaviour of the Search when it is added to a Webset.\n * @default append\n * @enum {string}\n */\n behavior: WebsetSearchBehavior;\n /** @description The maximum number of results to find */\n count: number;\n /** @description The criteria to search for. By default, the criteria from the last search is used. */\n criteria?: {\n description: string;\n }[];\n /**\n * Entity\n * @description The entity to search for. By default, the entity from the last search/import is used.\n */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description The query to search for. By default, the query from the last search is used. */\n query?: string;\n };\n /**\n * @default search\n * @constant\n */\n type: \"search\";\n };\n /** @description How often the monitor will run */\n cadence: {\n /** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */\n cron: string;\n /**\n * @description IANA timezone (e.g., \"America/New_York\")\n * @default Etc/UTC\n */\n timezone: string;\n };\n /**\n * Format: date-time\n * @description When the monitor was created\n */\n createdAt: string;\n /** @description The unique identifier for the Monitor */\n id: string;\n /**\n * MonitorRun\n * @description The last run of the monitor\n */\n lastRun: components[\"schemas\"][\"MonitorRun\"];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata: {\n [key: string]: string;\n };\n /**\n * Format: date-time\n * @description Date and time when the next run will occur in\n */\n nextRunAt: string | null;\n /**\n * @description The type of object\n * @enum {string}\n */\n object: MonitorObject;\n /**\n * @description The status of the Monitor\n * @enum {string}\n */\n status: MonitorStatus;\n /**\n * Format: date-time\n * @description When the monitor was last updated\n */\n updatedAt: string;\n /** @description The id of the Webset the Monitor belongs to */\n websetId: string;\n };\n MonitorBehavior: {\n /** @description Specify the search parameters for the Monitor.\n *\n * By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */\n config: {\n /**\n * @description The behaviour of the Search when it is added to a Webset.\n * @default append\n * @enum {string}\n */\n behavior: WebsetSearchBehavior;\n /** @description The maximum number of results to find */\n count: number;\n /** @description The criteria to search for. By default, the criteria from the last search is used. */\n criteria?: {\n description: string;\n }[];\n /**\n * Entity\n * @description The entity to search for. By default, the entity from the last search/import is used.\n */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description The query to search for. By default, the query from the last search is used. */\n query?: string;\n };\n /**\n * @default search\n * @constant\n */\n type: \"search\";\n };\n MonitorCadence: {\n /** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */\n cron: string;\n /**\n * @description IANA timezone (e.g., \"America/New_York\")\n * @default Etc/UTC\n */\n timezone: string;\n };\n MonitorRun: {\n /**\n * Format: date-time\n * @description When the run was canceled\n */\n canceledAt: string | null;\n /**\n * Format: date-time\n * @description When the run completed\n */\n completedAt: string | null;\n /**\n * Format: date-time\n * @description When the run was created\n */\n createdAt: string;\n /**\n * Format: date-time\n * @description When the run failed\n */\n failedAt: string | null;\n /** @description The reason the run failed */\n failedReason: string | null;\n /** @description The unique identifier for the Monitor Run */\n id: string;\n /** @description The monitor that the run is associated with */\n monitorId: string;\n /**\n * @description The type of object\n * @enum {string}\n */\n object: MonitorRunObject;\n /**\n * @description The status of the Monitor Run\n * @enum {string}\n */\n status: MonitorRunStatus;\n /**\n * @description The type of the Monitor Run\n * @enum {string}\n */\n type: MonitorRunType;\n /**\n * Format: date-time\n * @description When the run was last updated\n */\n updatedAt: string;\n };\n /** Person */\n PersonEntity: {\n /**\n * @default person\n * @constant\n */\n type: \"person\";\n };\n PreviewWebsetParameters: {\n search: {\n /**\n * @description When query parameter search=true, the number of preview items to return.\n * @default 10\n */\n count: number;\n /** @description Entity used to inform the decomposition.\n *\n * 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. */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description Natural language search query describing what you are looking for.\n *\n * Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results. */\n query: string;\n };\n };\n PreviewWebsetResponse: {\n /** @description Detected enrichments from the query. */\n enrichments: {\n /** @description Description of the enrichment. */\n description: string;\n /**\n * @description Format of the enrichment.\n * @enum {string}\n */\n format: WebsetEnrichmentFormat;\n /** @description When format is options, the options detected from the query. */\n options?: {\n /** @description Label of the option. */\n label: string;\n }[];\n }[];\n /** @description Preview items matching the search criteria. */\n items: components[\"schemas\"][\"WebsetItemPreview\"][];\n search: {\n /** @description Detected criteria from the query. */\n criteria: {\n description: string;\n }[];\n /** @description Detected entity from the query. */\n entity:\n | components[\"schemas\"][\"CompanyEntity\"]\n | components[\"schemas\"][\"PersonEntity\"]\n | components[\"schemas\"][\"ArticleEntity\"]\n | components[\"schemas\"][\"ResearchPaperEntity\"]\n | components[\"schemas\"][\"CustomEntity\"];\n };\n };\n /** Research Paper */\n ResearchPaperEntity: {\n /**\n * @default research_paper\n * @constant\n */\n type: \"research_paper\";\n };\n UpdateEnrichmentParameters: {\n /** @description Provide a description of the enrichment task you want to perform to each Webset Item. */\n description?: string;\n /**\n * @description Format of the enrichment response.\n *\n * We automatically select the best format based on the description. If you want to explicitly specify the format, you can do so here.\n * @enum {string}\n */\n format?: WebsetEnrichmentFormat;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n } | null;\n /** @description When the format is options, the different options for the enrichment agent to choose from. */\n options?: {\n /** @description The label of the option */\n label: string;\n }[];\n };\n UpdateImport: {\n metadata?: {\n [key: string]: string;\n };\n title?: string;\n };\n UpdateMonitor: {\n behavior?: components[\"schemas\"][\"MonitorBehavior\"];\n cadence?: components[\"schemas\"][\"MonitorCadence\"];\n metadata?: {\n [key: string]: string;\n };\n /**\n * @description The status of the monitor.\n * @enum {string}\n */\n status?: UpdateMonitorStatus;\n };\n UpdateWebhookParameters: {\n /** @description The events to trigger the webhook */\n events?: EventType[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /**\n * Format: uri\n * @description The URL to send the webhook to\n */\n url?: string;\n };\n UpdateWebsetRequest: {\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n } | null;\n };\n Webhook: {\n /**\n * Format: date-time\n * @description The date and time the webhook was created\n */\n createdAt: string;\n /** @description The events to trigger the webhook */\n events: EventType[];\n /** @description The unique identifier for the webhook */\n id: string;\n /**\n * @description The metadata of the webhook\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /**\n * @default webhook\n * @constant\n */\n object: \"webhook\";\n /** @description The secret to verify the webhook signature. Only returned on Webhook creation. */\n secret: string | null;\n /**\n * WebhookStatus\n * @description The status of the webhook\n * @enum {string}\n */\n status: WebhookStatus;\n /**\n * Format: date-time\n * @description The date and time the webhook was last updated\n */\n updatedAt: string;\n /**\n * Format: uri\n * @description The URL to send the webhook to\n */\n url: string;\n };\n WebhookAttempt: {\n /** @description The attempt number of the webhook */\n attempt: number;\n /**\n * Format: date-time\n * @description The date and time the webhook attempt was made\n */\n attemptedAt: string;\n /** @description The unique identifier for the event */\n eventId: string;\n /**\n * @description The type of event\n * @enum {string}\n */\n eventType: EventType;\n /** @description The unique identifier for the webhook attempt */\n id: string;\n /**\n * @default webhook_attempt\n * @constant\n */\n object: \"webhook_attempt\";\n /** @description The body of the response */\n responseBody: string | null;\n /** @description The headers of the response */\n responseHeaders: {\n [key: string]: string;\n };\n /** @description The status code of the response */\n responseStatusCode: number;\n /** @description Whether the attempt was successful */\n successful: boolean;\n /** @description The URL that was used during the attempt */\n url: string;\n /** @description The unique identifier for the webhook */\n webhookId: string;\n };\n Webset: {\n /**\n * Format: date-time\n * @description The date and time the webset was created\n */\n createdAt: string;\n /** @description The URL to view the webset in the Exa dashboard */\n dashboardUrl: string;\n /** @description The Enrichments to apply to the Webset Items. */\n enrichments: components[\"schemas\"][\"WebsetEnrichment\"][];\n /** @description The Excludes sources (existing imports or websets) that apply to all operations within this Webset. Any results found within these sources will be omitted across all search and import operations. */\n excludes?: {\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description The external identifier for the webset */\n externalId: string | null;\n /** @description The unique identifier for the webset */\n id: string;\n /** @description Imports that have been performed on the webset. */\n imports: components[\"schemas\"][\"Import\"][];\n /**\n * @description Set of key-value pairs you want to associate with this object.\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /** @description The Monitors for the Webset. */\n monitors: components[\"schemas\"][\"Monitor\"][];\n /**\n * @default webset\n * @constant\n */\n object: \"webset\";\n /** @description The searches that have been performed on the webset. */\n searches: components[\"schemas\"][\"WebsetSearch\"][];\n /**\n * WebsetStatus\n * @description The status of the webset\n * @enum {string}\n */\n status: WebsetStatus;\n /** @description The title of the webset */\n title: string | null;\n /**\n * Format: date-time\n * @description The date and time the webset was updated\n */\n updatedAt: string;\n };\n WebsetEnrichment: {\n /**\n * Format: date-time\n * @description The date and time the enrichment was created\n */\n createdAt: string;\n /** @description The description of the enrichment task provided during the creation of the enrichment. */\n description: string;\n /** @description The format of the enrichment response. */\n format: components[\"schemas\"][\"WebsetEnrichmentFormat\"];\n /** @description The unique identifier for the enrichment */\n id: string;\n /** @description The instructions for the enrichment Agent.\n *\n * This will be automatically generated based on the description and format. */\n instructions: string | null;\n /**\n * @description The metadata of the enrichment\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /**\n * @default webset_enrichment\n * @constant\n */\n object: \"webset_enrichment\";\n /**\n * WebsetEnrichmentOptions\n * @description When the format is options, the different options for the enrichment agent to choose from.\n */\n options:\n | {\n /** @description The label of the option */\n label: string;\n }[]\n | null;\n /**\n * WebsetEnrichmentStatus\n * @description The status of the enrichment\n * @enum {string}\n */\n status: WebsetEnrichmentStatus;\n /** @description The title of the enrichment.\n *\n * This will be automatically generated based on the description and format. */\n title: string | null;\n /**\n * Format: date-time\n * @description The date and time the enrichment was updated\n */\n updatedAt: string;\n /** @description The unique identifier for the Webset this enrichment belongs to. */\n websetId: string;\n };\n /** @enum {string} */\n WebsetEnrichmentFormat: WebsetEnrichmentFormat;\n WebsetItem: {\n /**\n * Format: date-time\n * @description The date and time the item was created\n */\n createdAt: string;\n /** @description The enrichments results of the Webset item */\n enrichments: components[\"schemas\"][\"EnrichmentResult\"][] | null;\n /** @description The criteria evaluations of the item */\n evaluations: components[\"schemas\"][\"WebsetItemEvaluation\"][];\n /** @description The unique identifier for the Webset Item */\n id: string;\n /**\n * @default webset_item\n * @constant\n */\n object: \"webset_item\";\n /** @description The properties of the Item */\n properties:\n | components[\"schemas\"][\"WebsetItemPersonProperties\"]\n | components[\"schemas\"][\"WebsetItemCompanyProperties\"]\n | components[\"schemas\"][\"WebsetItemArticleProperties\"]\n | components[\"schemas\"][\"WebsetItemResearchPaperProperties\"]\n | components[\"schemas\"][\"WebsetItemCustomProperties\"];\n /**\n * @description The source of the Item\n * @enum {string}\n */\n source: WebsetItemSource;\n /** @description The unique identifier for the source */\n sourceId: string;\n /**\n * Format: date-time\n * @description The date and time the item was last updated\n */\n updatedAt: string;\n /** @description The unique identifier for the Webset this Item belongs to. */\n websetId: string;\n };\n WebsetItemArticleProperties: {\n /** WebsetItemArticlePropertiesFields */\n article: {\n /** @description The author(s) of the article */\n author: string | null;\n /** @description The date and time the article was published */\n publishedAt: string | null;\n /** @description The title of the article */\n title: string | null;\n };\n /** @description The text content for the article */\n content: string | null;\n /** @description Short description of the relevance of the article */\n description: string;\n /**\n * @default article\n * @constant\n */\n type: \"article\";\n /**\n * Format: uri\n * @description The URL of the article\n */\n url: string;\n };\n WebsetItemCompanyProperties: {\n /** WebsetItemCompanyPropertiesFields */\n company: {\n /** @description A short description of the company */\n about: string | null;\n /** @description The number of employees of the company */\n employees: number | null;\n /** @description The industry of the company */\n industry: string | null;\n /** @description The main location of the company */\n location: string | null;\n /**\n * Format: uri\n * @description The logo URL of the company\n */\n logoUrl: string | null;\n /** @description The name of the company */\n name: string;\n };\n /** @description The text content of the company website */\n content: string | null;\n /** @description Short description of the relevance of the company */\n description: string;\n /**\n * @default company\n * @constant\n */\n type: \"company\";\n /**\n * Format: uri\n * @description The URL of the company website\n */\n url: string;\n };\n WebsetItemCustomProperties: {\n /** @description The text content of the Item */\n content: string | null;\n /** WebsetItemCustomPropertiesFields */\n custom: {\n /** @description The author(s) of the website */\n author: string | null;\n /** @description The date and time the website was published */\n publishedAt: string | null;\n /** @description The title of the website */\n title: string | null;\n };\n /** @description Short description of the Item */\n description: string;\n /**\n * @default custom\n * @constant\n */\n type: \"custom\";\n /**\n * Format: uri\n * @description The URL of the Item\n */\n url: string;\n };\n WebsetItemEvaluation: {\n /** @description The description of the criterion */\n criterion: string;\n /** @description The reasoning for the result of the evaluation */\n reasoning: string;\n /**\n * @description The references used to generate the result.\n * @default []\n */\n references: {\n /** @description The relevant snippet of the reference content */\n snippet: string | null;\n /** @description The title of the reference */\n title: string | null;\n /**\n * Format: uri\n * @description The URL of the reference\n */\n url: string;\n }[];\n /**\n * @description The satisfaction of the criterion\n * @enum {string}\n */\n satisfied: WebsetItemEvaluationSatisfied;\n };\n WebsetItemPersonProperties: {\n /** @description Short description of the relevance of the person */\n description: string;\n /** WebsetItemPersonPropertiesFields */\n person: {\n /** WebsetItemPersonCompanyPropertiesFields */\n company: {\n /** @description The location the person is working at the company */\n location: string | null;\n /** @description The name of the company */\n name: string;\n } | null;\n /** @description The location of the person */\n location: string | null;\n /** @description The name of the person */\n name: string;\n /**\n * Format: uri\n * @description The image URL of the person\n */\n pictureUrl: string | null;\n /** @description The current work position of the person */\n position: string | null;\n };\n /**\n * @default person\n * @constant\n */\n type: \"person\";\n /**\n * Format: uri\n * @description The URL of the person profile\n */\n url: string;\n };\n WebsetItemPreview: {\n /**\n * Format: date-time\n * @description The date and time the preview was created\n */\n createdAt: string;\n /** @description The unique identifier for the preview item */\n id: string;\n /** @description The properties of the preview item */\n properties:\n | components[\"schemas\"][\"WebsetItemPersonProperties\"]\n | components[\"schemas\"][\"WebsetItemCompanyProperties\"]\n | components[\"schemas\"][\"WebsetItemArticleProperties\"]\n | components[\"schemas\"][\"WebsetItemResearchPaperProperties\"]\n | components[\"schemas\"][\"WebsetItemCustomProperties\"];\n };\n WebsetItemResearchPaperProperties: {\n /** @description The text content of the research paper */\n content: string | null;\n /** @description Short description of the relevance of the research paper */\n description: string;\n /** WebsetItemResearchPaperPropertiesFields */\n researchPaper: {\n /** @description The author(s) of the research paper */\n author: string | null;\n /** @description The date and time the research paper was published */\n publishedAt: string | null;\n /** @description The title of the research paper */\n title: string | null;\n };\n /**\n * @default research_paper\n * @constant\n */\n type: \"research_paper\";\n /**\n * Format: uri\n * @description The URL of the research paper\n */\n url: string;\n };\n WebsetSearch: {\n /**\n * @description The behavior of the search when it is added to a Webset.\n *\n * - `override`: the search will replace the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.\n * - `append`: the search will add the new Items found to the existing Webset. Any Items that don't match the new criteria will be discarded.\n * @default override\n */\n behavior: WebsetSearchBehavior;\n /**\n * Format: date-time\n * @description The date and time the search was canceled\n */\n canceledAt: string | null;\n /** @description The reason the search was canceled */\n canceledReason: WebsetSearchCanceledReason;\n /** @description The number of results the search will attempt to find. The actual number of results may be less than this number depending on the search complexity. */\n count: number;\n /**\n * Format: date-time\n * @description The date and time the search was created\n */\n createdAt: string;\n /** @description The criteria the search will use to evaluate the results. If not provided, we will automatically generate them for you. */\n criteria: {\n /** @description The description of the criterion */\n description: string;\n /** @description Value between 0 and 100 representing the percentage of results that meet the criterion. */\n successRate: number;\n }[];\n /** @description The entity the search will return results for.\n *\n * When no entity is provided during creation, we will automatically select the best entity based on the query. */\n entity: components[\"schemas\"][\"Entity\"];\n /** @description Sources (existing imports or websets) used to omit certain results to be found during the search. */\n exclude: {\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description The unique identifier for the search */\n id: string;\n /** @description The soft cap requested for matching people from the same current employer company, or null when no cap was requested. */\n maxPeoplePerCompany: number | null;\n /**\n * @description Set of key-value pairs you want to associate with this object.\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /**\n * @default webset_search\n * @constant\n */\n object: \"webset_search\";\n /** @description The progress of the search */\n progress: {\n /** @description The number of results analyzed so far */\n analyzed: number;\n /** @description The completion percentage of the search */\n completion: number;\n /** @description The number of results found so far */\n found: number;\n /** @description The estimated time remaining in seconds, null if unknown */\n timeLeft: number | null;\n };\n /** @description The query used to create the search. */\n query: string;\n /** @description Recall metrics for the search, null if not yet computed or requested. */\n recall: {\n expected: {\n bounds: {\n /** @description The maximum estimated total number of potential matches */\n max: number;\n /** @description The minimum estimated total number of potential matches */\n min: number;\n };\n /**\n * @description The confidence in the estimate\n * @enum {string}\n */\n confidence: WebsetSearchRecallExpectedConfidence;\n /** @description The estimated total number of potential matches */\n total: number;\n };\n /** @description The reasoning for the estimate */\n reasoning: string;\n } | null;\n /** @description The scope of the search. By default, there is no scope - thus searching the web.\n *\n * If provided during creation, the search will only be performed on the sources provided. */\n scope: {\n id: string;\n relationship?: {\n /** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. */\n definition: string;\n limit: number;\n };\n /** @enum {string} */\n source: WebsetSearchScopeSource;\n }[];\n /**\n * WebsetSearchStatus\n * @description The status of the search\n * @enum {string}\n */\n status: WebsetSearchStatus;\n /**\n * Format: date-time\n * @description The date and time the search was updated\n */\n updatedAt: string;\n /** @description The unique identifier for the Webset this search belongs to */\n websetId: string;\n };\n };\n responses: never;\n parameters: never;\n requestBodies: never;\n headers: never;\n pathItems: never;\n}\nexport type ArticleEntity = components[\"schemas\"][\"ArticleEntity\"];\nexport type CompanyEntity = components[\"schemas\"][\"CompanyEntity\"];\nexport type CreateCriterionParameters =\n components[\"schemas\"][\"CreateCriterionParameters\"];\nexport type CreateEnrichmentParameters =\n components[\"schemas\"][\"CreateEnrichmentParameters\"];\nexport type CreateImportParameters =\n components[\"schemas\"][\"CreateImportParameters\"];\nexport type CreateImportResponse =\n components[\"schemas\"][\"CreateImportResponse\"];\nexport type CreateMonitorParameters =\n components[\"schemas\"][\"CreateMonitorParameters\"];\nexport type CreateWebhookParameters =\n components[\"schemas\"][\"CreateWebhookParameters\"];\nexport type CreateWebsetParameters =\n components[\"schemas\"][\"CreateWebsetParameters\"];\nexport type CreateWebsetSearchParameters =\n components[\"schemas\"][\"CreateWebsetSearchParameters\"];\nexport type CustomEntity = components[\"schemas\"][\"CustomEntity\"];\nexport type EnrichmentResult = components[\"schemas\"][\"EnrichmentResult\"];\nexport type Entity = components[\"schemas\"][\"Entity\"];\nexport type Event = components[\"schemas\"][\"Event\"];\nexport type GetWebsetResponse = components[\"schemas\"][\"GetWebsetResponse\"];\nexport type Import = components[\"schemas\"][\"Import\"];\nexport type ListEventsResponse = components[\"schemas\"][\"ListEventsResponse\"];\nexport type ListImportsResponse = components[\"schemas\"][\"ListImportsResponse\"];\nexport type ListMonitorRunsResponse =\n components[\"schemas\"][\"ListMonitorRunsResponse\"];\nexport type ListMonitorsResponse =\n components[\"schemas\"][\"ListMonitorsResponse\"];\nexport type ListWebhookAttemptsResponse =\n components[\"schemas\"][\"ListWebhookAttemptsResponse\"];\nexport type ListWebhooksResponse =\n components[\"schemas\"][\"ListWebhooksResponse\"];\nexport type ListWebsetItemResponse =\n components[\"schemas\"][\"ListWebsetItemResponse\"];\nexport type ListWebsetsResponse = components[\"schemas\"][\"ListWebsetsResponse\"];\nexport type Monitor = components[\"schemas\"][\"Monitor\"];\nexport type MonitorBehavior = components[\"schemas\"][\"MonitorBehavior\"];\nexport type MonitorCadence = components[\"schemas\"][\"MonitorCadence\"];\nexport type MonitorRun = components[\"schemas\"][\"MonitorRun\"];\nexport type PersonEntity = components[\"schemas\"][\"PersonEntity\"];\nexport type PreviewWebsetParameters =\n components[\"schemas\"][\"PreviewWebsetParameters\"];\nexport type PreviewWebsetResponse =\n components[\"schemas\"][\"PreviewWebsetResponse\"];\nexport type ResearchPaperEntity = components[\"schemas\"][\"ResearchPaperEntity\"];\nexport type UpdateEnrichmentParameters =\n components[\"schemas\"][\"UpdateEnrichmentParameters\"];\nexport type UpdateImport = components[\"schemas\"][\"UpdateImport\"];\nexport type UpdateMonitor = components[\"schemas\"][\"UpdateMonitor\"];\nexport type UpdateWebhookParameters =\n components[\"schemas\"][\"UpdateWebhookParameters\"];\nexport type UpdateWebsetRequest = components[\"schemas\"][\"UpdateWebsetRequest\"];\nexport type Webhook = components[\"schemas\"][\"Webhook\"];\nexport type WebhookAttempt = components[\"schemas\"][\"WebhookAttempt\"];\nexport type Webset = components[\"schemas\"][\"Webset\"];\nexport type WebsetEnrichment = components[\"schemas\"][\"WebsetEnrichment\"];\nexport type WebsetItem = components[\"schemas\"][\"WebsetItem\"];\nexport type WebsetItemArticleProperties =\n components[\"schemas\"][\"WebsetItemArticleProperties\"];\nexport type WebsetItemCompanyProperties =\n components[\"schemas\"][\"WebsetItemCompanyProperties\"];\nexport type WebsetItemCustomProperties =\n components[\"schemas\"][\"WebsetItemCustomProperties\"];\nexport type WebsetItemEvaluation =\n components[\"schemas\"][\"WebsetItemEvaluation\"];\nexport type WebsetItemPersonProperties =\n components[\"schemas\"][\"WebsetItemPersonProperties\"];\nexport type WebsetItemPreview = components[\"schemas\"][\"WebsetItemPreview\"];\nexport type WebsetItemResearchPaperProperties =\n components[\"schemas\"][\"WebsetItemResearchPaperProperties\"];\nexport type WebsetSearch = components[\"schemas\"][\"WebsetSearch\"];\nexport type $defs = Record<string, never>;\nexport interface operations {\n \"events-list\": {\n parameters: {\n query?: {\n /** @description Filter events created after or at this timestamp (inclusive). Must be a valid ISO 8601 datetime string. All times are in UTC. */\n createdAfter?: string;\n /** @description Filter events created before or at this timestamp (inclusive). Must be a valid ISO 8601 datetime string. All times are in UTC. */\n createdBefore?: string;\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n /** @description The types of events to filter by */\n types?: EventType[];\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of events */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListEventsResponse\"];\n };\n };\n };\n };\n \"events-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the event */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Event\"];\n };\n };\n /** @description Event not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"imports-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of imports */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListImportsResponse\"];\n };\n };\n };\n };\n \"imports-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateImportParameters\"];\n };\n };\n responses: {\n /** @description Import created successfully */\n 201: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"CreateImportResponse\"];\n };\n };\n };\n };\n \"imports-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Import */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Import details */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Import\"];\n };\n };\n };\n };\n \"imports-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Import */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Import deleted successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Import\"];\n };\n };\n };\n };\n \"imports-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Import */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateImport\"];\n };\n };\n responses: {\n /** @description Import updated successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Import\"];\n };\n };\n };\n };\n \"monitors-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n /** @description The id of the Webset to list monitors for */\n websetId?: string;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of monitors */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListMonitorsResponse\"];\n };\n };\n };\n };\n \"monitors-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateMonitorParameters\"];\n };\n };\n responses: {\n /** @description Monitor created successfully */\n 201: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Monitor details */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Monitor deleted successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateMonitor\"];\n };\n };\n responses: {\n /** @description Monitor updated successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-runs-list\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor to list runs for */\n monitor: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of monitor runs */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListMonitorRunsResponse\"];\n };\n };\n };\n };\n \"monitors-runs-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n id: string;\n /** @description The id of the Monitor to get the run for */\n monitor: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Monitor run details */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"MonitorRun\"];\n };\n };\n };\n };\n \"webhooks-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of webhooks */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebhooksResponse\"];\n };\n };\n };\n };\n \"webhooks-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateWebhookParameters\"];\n };\n };\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n };\n };\n \"webhooks-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n /** @description Webhook not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"webhooks-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n /** @description Webhook not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"webhooks-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateWebhookParameters\"];\n };\n };\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n /** @description Webhook not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"webhooks-attempts-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The type of event to filter by */\n eventType?: EventType;\n /** @description The number of results to return */\n limit?: number;\n /** @description Filter attempts by their success status */\n successful?: boolean;\n };\n header?: never;\n path: {\n /** @description The ID of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of webhook attempts */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebhookAttemptsResponse\"];\n };\n };\n };\n };\n \"websets-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of Websets to return */\n limit?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of Websets */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebsetsResponse\"];\n };\n };\n };\n };\n \"websets-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateWebsetParameters\"];\n };\n };\n responses: {\n /** @description Webset created */\n 201: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n /** @description Webset with this externalId already exists */\n 409: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-get\": {\n parameters: {\n query?: {\n /** @description Expand the response with the specified resources */\n expand?: PathsV0WebsetsIdGetParametersQueryExpand[];\n };\n header?: never;\n path: {\n /** @description The id or externalId of the Webset. */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"GetWebsetResponse\"];\n };\n };\n /** @description Webset not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateWebsetRequest\"];\n };\n };\n responses: {\n /** @description Webset updated */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n /** @description Webset not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset deleted */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n /** @description Webset not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset canceled */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n };\n };\n \"websets-enrichments-create\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateEnrichmentParameters\"];\n };\n };\n responses: {\n /** @description Enrichment created */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-enrichments-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Enrichment */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Enrichment */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-enrichments-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Enrichment */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Enrichment deleted */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-enrichments-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n id: string;\n webset: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateEnrichmentParameters\"];\n };\n };\n responses: {\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-enrichments-cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Enrichment */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Enrichment cancelled */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-items-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n /** @description The id of the source */\n sourceId?: string;\n };\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset Items */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebsetItemResponse\"];\n };\n };\n };\n };\n \"websets-items-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Webset item */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset Item */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetItem\"];\n };\n };\n };\n };\n \"websets-items-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Webset item */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset Item deleted */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetItem\"];\n };\n };\n };\n };\n \"websets-searches-create\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateWebsetSearchParameters\"];\n };\n };\n responses: {\n /** @description Webset Search created */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetSearch\"];\n };\n };\n };\n };\n \"websets-searches-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Search */\n id: string;\n /** @description The id of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Search retrieved */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetSearch\"];\n };\n };\n };\n };\n \"websets-searches-cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Search */\n id: string;\n /** @description The id of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Search canceled */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetSearch\"];\n };\n };\n };\n };\n \"websets-preview\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description Weather you want to search for a preview list of items or not */\n search: boolean;\n };\n cookie?: never;\n };\n /** @description Search parameters */\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"PreviewWebsetParameters\"];\n };\n };\n responses: {\n /** @description Preview of the webset */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"PreviewWebsetResponse\"];\n };\n };\n /** @description Unable to detect entity or criteria from query */\n 422: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n}\nexport enum PathsV0WebsetsIdGetParametersQueryExpand {\n items = \"items\",\n}\nexport enum CreateEnrichmentParametersFormat {\n text = \"text\",\n date = \"date\",\n number = \"number\",\n options = \"options\",\n email = \"email\",\n phone = \"phone\",\n url = \"url\",\n}\nexport enum CreateImportParametersFormat {\n csv = \"csv\",\n}\nexport enum CreateImportResponseFailedReason {\n invalid_format = \"invalid_format\",\n invalid_file_content = \"invalid_file_content\",\n missing_identifier = \"missing_identifier\",\n}\nexport enum CreateImportResponseFormat {\n csv = \"csv\",\n webset = \"webset\",\n}\nexport enum CreateImportResponseObject {\n import = \"import\",\n}\nexport enum CreateImportResponseStatus {\n pending = \"pending\",\n processing = \"processing\",\n completed = \"completed\",\n failed = \"failed\",\n canceled = \"canceled\",\n}\nexport enum WebsetImportSource {\n import = \"import\",\n webset = \"webset\",\n}\n\nexport enum EnrichmentResultStatus {\n pending = \"pending\",\n completed = \"completed\",\n canceled = \"canceled\",\n}\nexport enum EventType {\n webset_created = \"webset.created\",\n webset_deleted = \"webset.deleted\",\n webset_paused = \"webset.paused\",\n webset_idle = \"webset.idle\",\n webset_search_created = \"webset.search.created\",\n webset_search_canceled = \"webset.search.canceled\",\n webset_search_completed = \"webset.search.completed\",\n webset_search_updated = \"webset.search.updated\",\n import_created = \"import.created\",\n import_completed = \"import.completed\",\n webset_item_created = \"webset.item.created\",\n webset_item_enriched = \"webset.item.enriched\",\n monitor_created = \"monitor.created\",\n monitor_updated = \"monitor.updated\",\n monitor_deleted = \"monitor.deleted\",\n monitor_run_created = \"monitor.run.created\",\n monitor_run_completed = \"monitor.run.completed\",\n webset_export_created = \"webset.export.created\",\n webset_export_completed = \"webset.export.completed\",\n}\nexport enum ImportFailedReason {\n invalid_format = \"invalid_format\",\n invalid_file_content = \"invalid_file_content\",\n missing_identifier = \"missing_identifier\",\n}\nexport enum ImportFormat {\n csv = \"csv\",\n webset = \"webset\",\n}\nexport enum ImportObject {\n import = \"import\",\n}\nexport enum ImportStatus {\n pending = \"pending\",\n processing = \"processing\",\n completed = \"completed\",\n failed = \"failed\",\n canceled = \"canceled\",\n}\nexport enum MonitorObject {\n monitor = \"monitor\",\n}\nexport enum MonitorStatus {\n enabled = \"enabled\",\n disabled = \"disabled\",\n}\nexport enum MonitorRunObject {\n monitor_run = \"monitor_run\",\n}\nexport enum MonitorRunStatus {\n created = \"created\",\n running = \"running\",\n completed = \"completed\",\n canceled = \"canceled\",\n failed = \"failed\",\n}\nexport enum MonitorRunType {\n search = \"search\",\n refresh = \"refresh\",\n}\nexport enum UpdateMonitorStatus {\n enabled = \"enabled\",\n disabled = \"disabled\",\n}\nexport enum WebhookStatus {\n active = \"active\",\n inactive = \"inactive\",\n}\nexport enum WebsetStatus {\n idle = \"idle\",\n pending = \"pending\",\n running = \"running\",\n paused = \"paused\",\n}\nexport enum WebsetEnrichmentStatus {\n pending = \"pending\",\n canceled = \"canceled\",\n completed = \"completed\",\n}\nexport enum WebsetEnrichmentFormat {\n text = \"text\",\n date = \"date\",\n number = \"number\",\n options = \"options\",\n email = \"email\",\n phone = \"phone\",\n url = \"url\",\n}\nexport enum WebsetItemSource {\n search = \"search\",\n import = \"import\",\n}\nexport enum WebsetItemEvaluationSatisfied {\n yes = \"yes\",\n no = \"no\",\n unclear = \"unclear\",\n}\nexport enum WebsetExcludeSource {\n import = \"import\",\n webset = \"webset\",\n}\nexport enum WebsetSearchRecallExpectedConfidence {\n high = \"high\",\n medium = \"medium\",\n low = \"low\",\n}\nexport enum WebsetSearchScopeSource {\n import = \"import\",\n webset = \"webset\",\n}\nexport enum WebsetSearchStatus {\n created = \"created\",\n pending = \"pending\",\n running = \"running\",\n completed = \"completed\",\n canceled = \"canceled\",\n}\nexport enum WebsetSearchBehavior {\n override = \"override\",\n append = \"append\",\n}\nexport enum WebsetSearchCanceledReason {\n webset_deleted = \"webset_deleted\",\n webset_canceled = \"webset_canceled\",\n out_of_credits = \"out_of_credits\",\n}\n","/**\n * Client for managing Imports\n */\nimport { ExaError, HttpStatusCode } from \"../errors\";\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport {\n CreateImportParameters,\n CreateImportParametersFormat,\n CreateImportResponse,\n Import,\n ImportStatus,\n ListImportsResponse,\n UpdateImport,\n} from \"./openapi\";\n\n/**\n * Options for waiting until import completion\n */\nexport interface WaitUntilCompletedOptions {\n /**\n * Maximum time to wait in milliseconds (default: 5 minutes)\n */\n timeout?: number;\n /**\n * How often to poll for status in milliseconds (default: 2 seconds)\n */\n pollInterval?: number;\n /**\n * Callback function called on each poll with the current status\n */\n onPoll?: (status: ImportStatus) => void;\n}\n\n/**\n * Parameters for creating an import with CSV data\n */\nexport interface CreateImportWithCsvParameters {\n /**\n * Title of the import\n */\n title: string;\n /**\n * Entity type and configuration\n */\n entity: CreateImportParameters[\"entity\"];\n /**\n * Optional metadata\n */\n metadata?: CreateImportParameters[\"metadata\"];\n /**\n * Optional CSV-specific parameters\n */\n csv?: CreateImportParameters[\"csv\"];\n}\n\n/**\n * CSV data input - can be raw data or buffer\n */\nexport type CsvDataInput = string | Buffer;\n\n/**\n * Client for managing Imports\n */\nexport class ImportsClient extends WebsetsBaseClient {\n /**\n * Create a new Import (basic version - returns upload URL)\n * @param params The import creation parameters\n * @returns The created Import response with upload URL\n */\n async create(params: CreateImportParameters): Promise<CreateImportResponse>;\n\n /**\n * Create a new Import with CSV data (handles upload)\n * @param params The import creation parameters (without size/count - calculated automatically)\n * @param csv CSV data as string or Buffer\n * @returns The Import after upload (not waited for completion)\n */\n async create(\n params: CreateImportWithCsvParameters,\n csv: CsvDataInput\n ): Promise<Import>;\n\n async create(\n params: CreateImportParameters | CreateImportWithCsvParameters,\n csv?: CsvDataInput\n ): Promise<CreateImportResponse | Import> {\n if (csv === undefined) {\n return this.request<CreateImportResponse>(\n \"/v0/imports\",\n \"POST\",\n params as CreateImportParameters\n );\n }\n\n let csvBuffer: Buffer;\n if (typeof csv === \"string\") {\n csvBuffer = Buffer.from(csv, \"utf8\");\n } else if (Buffer.isBuffer(csv)) {\n csvBuffer = csv;\n } else {\n throw new ExaError(\n \"Invalid CSV data input. Must be string or Buffer\",\n HttpStatusCode.BadRequest\n );\n }\n\n const sizeInBytes = csvBuffer.length;\n const sizeInMB = Math.max(1, Math.ceil(sizeInBytes / (1024 * 1024)));\n\n const csvText = csvBuffer.toString(\"utf8\");\n const lines = csvText.split(\"\\n\").filter((line) => line.trim().length > 0);\n const recordCount = Math.max(0, lines.length - 1); // Subtract 1 for header\n\n if (sizeInMB > 50) {\n throw new ExaError(\n `CSV file too large: ${sizeInMB}MB. Maximum size is 50MB.`,\n HttpStatusCode.BadRequest\n );\n }\n\n if (recordCount === 0) {\n throw new ExaError(\n \"CSV file appears to have no data records (only header or empty)\",\n HttpStatusCode.BadRequest\n );\n }\n\n const createParams: CreateImportParameters = {\n title: params.title,\n format: CreateImportParametersFormat.csv,\n entity: params.entity,\n size: sizeInBytes,\n count: recordCount,\n metadata: params.metadata,\n csv: (params as CreateImportWithCsvParameters).csv,\n };\n\n const importResponse = await this.request<CreateImportResponse>(\n \"/v0/imports\",\n \"POST\",\n createParams\n );\n\n try {\n const uploadResponse = await fetch(importResponse.uploadUrl, {\n method: \"PUT\",\n body: csvBuffer as BodyInit,\n });\n\n if (!uploadResponse.ok) {\n const errorText = await uploadResponse.text();\n throw new ExaError(\n `Upload failed: ${uploadResponse.status} ${uploadResponse.statusText}. ${errorText}`,\n HttpStatusCode.BadRequest\n );\n }\n } catch (error) {\n if (error instanceof ExaError) {\n throw error;\n }\n throw new ExaError(\n `Failed to upload CSV data: ${(error as Error).message}`,\n HttpStatusCode.BadRequest\n );\n }\n\n return importResponse;\n }\n\n /**\n * Get an Import by ID\n * @param id The ID of the Import\n * @returns The Import\n */\n async get(id: string): Promise<Import> {\n return this.request<Import>(`/v0/imports/${id}`, \"GET\");\n }\n\n /**\n * List all Imports\n * @param options Pagination options\n * @returns The list of Imports\n */\n async list(options?: PaginationParams): Promise<ListImportsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListImportsResponse>(\n \"/v0/imports\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Update an Import\n * @param id The ID of the Import\n * @param params The import update parameters\n * @returns The updated Import\n */\n async update(id: string, params: UpdateImport): Promise<Import> {\n return this.request<Import>(`/v0/imports/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete an Import\n * @param id The ID of the Import\n * @returns The deleted Import\n */\n async delete(id: string): Promise<Import> {\n return this.request<Import>(`/v0/imports/${id}`, \"DELETE\");\n }\n\n /**\n * Wait until an Import is completed or failed\n * @param id The ID of the Import\n * @param options Configuration options for timeout and polling\n * @returns The Import once it reaches a final state (completed or failed)\n * @throws Error if the Import does not complete within the timeout or fails\n */\n async waitUntilCompleted(\n id: string,\n options?: WaitUntilCompletedOptions\n ): Promise<Import> {\n const timeout = options?.timeout ?? 30 * 60 * 1000;\n const pollInterval = options?.pollInterval ?? 2_000;\n const onPoll = options?.onPoll;\n\n const startTime = Date.now();\n\n while (true) {\n const importItem = await this.get(id);\n\n if (onPoll) {\n onPoll(importItem.status);\n }\n\n if (importItem.status === ImportStatus.completed) {\n return importItem;\n }\n\n if (importItem.status === ImportStatus.failed) {\n throw new ExaError(\n `Import ${id} failed: ${importItem.failedMessage || \"Unknown error\"}`,\n HttpStatusCode.BadRequest\n );\n }\n\n if (Date.now() - startTime > timeout) {\n throw new ExaError(\n `Import ${id} did not complete within ${timeout}ms. Current status: ${importItem.status}`,\n HttpStatusCode.RequestTimeout\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n\n /**\n * Iterate through all Imports, handling pagination automatically\n * @param options Pagination options\n * @returns Async generator of Imports\n */\n async *listAll(options?: PaginationParams): AsyncGenerator<Import> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const importItem of response.data) {\n yield importItem;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Imports into an array\n * @param options Pagination options\n * @returns Promise resolving to an array of all Imports\n */\n async getAll(options?: PaginationParams): Promise<Import[]> {\n const imports: Import[] = [];\n for await (const importItem of this.listAll(options)) {\n imports.push(importItem);\n }\n return imports;\n }\n}\n","/**\n * Client for managing Webset Items\n */\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport { ListWebsetItemResponse, WebsetItem } from \"./openapi\";\n\n/**\n * Options for listing webset items\n */\nexport interface ListWebsetItemsOptions extends PaginationParams {\n /**\n * The id of the source to filter items by\n */\n sourceId?: string;\n}\n\n/**\n * Client for managing Webset Items\n */\nexport class WebsetItemsClient extends WebsetsBaseClient {\n /**\n * List all Items for a Webset\n * @param websetId The ID of the Webset\n * @param params - Optional pagination and filtering parameters\n * @returns A promise that resolves with the list of Items\n */\n list(\n websetId: string,\n params?: ListWebsetItemsOptions\n ): Promise<ListWebsetItemResponse> {\n const queryParams = {\n ...this.buildPaginationParams(params),\n sourceId: params?.sourceId,\n };\n return this.request<ListWebsetItemResponse>(\n `/v0/websets/${websetId}/items`,\n \"GET\",\n undefined,\n queryParams\n );\n }\n\n /**\n * Iterate through all Items in a Webset, handling pagination automatically\n * @param websetId The ID of the Webset\n * @param options Pagination options\n * @returns Async generator of Webset Items\n */\n async *listAll(\n websetId: string,\n options?: ListWebsetItemsOptions\n ): AsyncGenerator<WebsetItem> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(websetId, pageOptions);\n\n for (const item of response.data) {\n yield item;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all items from a Webset into an array\n * @param websetId The ID of the Webset\n * @param options Pagination options\n * @returns Promise resolving to an array of all Webset Items\n */\n async getAll(\n websetId: string,\n options?: ListWebsetItemsOptions\n ): Promise<WebsetItem[]> {\n const items: WebsetItem[] = [];\n for await (const item of this.listAll(websetId, options)) {\n items.push(item);\n }\n return items;\n }\n\n /**\n * Get an Item by ID\n * @param websetId The ID of the Webset\n * @param id The ID of the Item\n * @returns The Webset Item\n */\n async get(websetId: string, id: string): Promise<WebsetItem> {\n return this.request<WebsetItem>(\n `/v0/websets/${websetId}/items/${id}`,\n \"GET\"\n );\n }\n\n /**\n * Delete an Item\n * @param websetId The ID of the Webset\n * @param id The ID of the Item\n * @returns The deleted Webset Item\n */\n async delete(websetId: string, id: string): Promise<WebsetItem> {\n return this.request<WebsetItem>(\n `/v0/websets/${websetId}/items/${id}`,\n \"DELETE\"\n );\n }\n}\n","/**\n * Client for managing Webset Monitors\n */\nimport { Exa } from \"..\";\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport {\n CreateMonitorParameters,\n ListMonitorRunsResponse,\n ListMonitorsResponse,\n Monitor,\n MonitorRun,\n UpdateMonitor,\n} from \"./openapi\";\n\n/**\n * Options for listing monitors\n */\nexport interface ListMonitorsOptions extends PaginationParams {\n /**\n * The id of the Webset to list monitors for\n */\n websetId?: string;\n}\n\n/**\n * Client for managing Monitor Runs\n */\nexport class WebsetMonitorRunsClient extends WebsetsBaseClient {\n /**\n * List all runs for a Monitor\n * @param monitorId The ID of the Monitor\n * @param options Pagination options\n * @returns The list of Monitor runs\n */\n async list(\n monitorId: string,\n options?: PaginationParams\n ): Promise<ListMonitorRunsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListMonitorRunsResponse>(\n `/v0/monitors/${monitorId}/runs`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Get a specific Monitor run\n * @param monitorId The ID of the Monitor\n * @param runId The ID of the Monitor run\n * @returns The Monitor run\n */\n async get(monitorId: string, runId: string): Promise<MonitorRun> {\n return this.request<MonitorRun>(\n `/v0/monitors/${monitorId}/runs/${runId}`,\n \"GET\"\n );\n }\n}\n\n/**\n * Client for managing Webset Monitors\n */\nexport class WebsetMonitorsClient extends WebsetsBaseClient {\n /**\n * Client for managing Monitor Runs\n */\n runs: WebsetMonitorRunsClient;\n\n constructor(client: Exa) {\n super(client);\n this.runs = new WebsetMonitorRunsClient(client);\n }\n\n /**\n * Create a Monitor\n * @param params The monitor parameters\n * @returns The created Monitor\n */\n async create(params: CreateMonitorParameters): Promise<Monitor> {\n return this.request<Monitor>(\"/v0/monitors\", \"POST\", params);\n }\n\n /**\n * Get a Monitor by ID\n * @param id The ID of the Monitor\n * @returns The Monitor\n */\n async get(id: string): Promise<Monitor> {\n return this.request<Monitor>(`/v0/monitors/${id}`, \"GET\");\n }\n\n /**\n * List all Monitors\n * @param options Pagination and filtering options\n * @returns The list of Monitors\n */\n async list(options?: ListMonitorsOptions): Promise<ListMonitorsResponse> {\n const params = {\n cursor: options?.cursor,\n limit: options?.limit,\n websetId: options?.websetId,\n };\n return this.request<ListMonitorsResponse>(\n \"/v0/monitors\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Update a Monitor\n * @param id The ID of the Monitor\n * @param params The monitor update parameters (status, metadata)\n * @returns The updated Monitor\n */\n async update(id: string, params: UpdateMonitor): Promise<Monitor> {\n return this.request<Monitor>(`/v0/monitors/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete a Monitor\n * @param id The ID of the Monitor\n * @returns The deleted Monitor\n */\n async delete(id: string): Promise<Monitor> {\n return this.request<Monitor>(`/v0/monitors/${id}`, \"DELETE\");\n }\n\n /**\n * Iterate through all Monitors, handling pagination automatically\n * @param options Pagination and filtering options\n * @returns Async generator of Monitors\n */\n async *listAll(options?: ListMonitorsOptions): AsyncGenerator<Monitor> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const monitor of response.data) {\n yield monitor;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Monitors into an array\n * @param options Pagination and filtering options\n * @returns Promise resolving to an array of all Monitors\n */\n async getAll(options?: ListMonitorsOptions): Promise<Monitor[]> {\n const monitors: Monitor[] = [];\n for await (const monitor of this.listAll(options)) {\n monitors.push(monitor);\n }\n return monitors;\n }\n}\n","/**\n * Client for managing Webset Searches\n */\nimport { WebsetHeadersLike } from \".\";\nimport { WebsetsBaseClient } from \"./base\";\nimport { CreateWebsetSearchParameters, WebsetSearch } from \"./openapi\";\n\n/**\n * Client for managing Webset Searches\n */\nexport class WebsetSearchesClient extends WebsetsBaseClient {\n /**\n * Create a new Search for the Webset\n * @param websetId The ID of the Webset\n * @param params The search parameters\n * @returns The created Webset Search\n */\n async create(\n websetId: string,\n params: CreateWebsetSearchParameters,\n options?: { headers?: WebsetHeadersLike }\n ): Promise<WebsetSearch> {\n return this.request<WebsetSearch>(\n `/v0/websets/${websetId}/searches`,\n \"POST\",\n params,\n undefined,\n options?.headers\n );\n }\n\n /**\n * Get a Search by ID\n * @param websetId The ID of the Webset\n * @param id The ID of the Search\n * @returns The Webset Search\n */\n async get(websetId: string, id: string): Promise<WebsetSearch> {\n return this.request<WebsetSearch>(\n `/v0/websets/${websetId}/searches/${id}`,\n \"GET\"\n );\n }\n\n /**\n * Cancel a running Search\n * @param websetId The ID of the Webset\n * @param id The ID of the Search\n * @returns The canceled Webset Search\n */\n async cancel(websetId: string, id: string): Promise<WebsetSearch> {\n return this.request<WebsetSearch>(\n `/v0/websets/${websetId}/searches/${id}/cancel`,\n \"POST\"\n );\n }\n}\n","/**\n * Client for managing Webset Webhooks\n */\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport {\n CreateWebhookParameters,\n EventType,\n ListWebhookAttemptsResponse,\n ListWebhooksResponse,\n UpdateWebhookParameters,\n Webhook,\n WebhookAttempt,\n} from \"./openapi\";\n\n/**\n * Options for listing webhooks (only pagination is supported by API)\n */\nexport interface ListWebhooksOptions extends PaginationParams {}\n\n/**\n * Options for listing webhook attempts\n */\nexport interface ListWebhookAttemptsOptions extends PaginationParams {\n /**\n * The type of event to filter by\n */\n eventType?: EventType;\n /**\n * Filter attempts by their success status\n */\n successful?: boolean;\n}\n\n/**\n * Client for managing Webset Webhooks\n */\nexport class WebsetWebhooksClient extends WebsetsBaseClient {\n /**\n * Create a Webhook\n * @param params The webhook parameters\n * @returns The created Webhook\n */\n async create(params: CreateWebhookParameters): Promise<Webhook> {\n return this.request<Webhook>(\"/v0/webhooks\", \"POST\", params);\n }\n\n /**\n * Get a Webhook by ID\n * @param id The ID of the Webhook\n * @returns The Webhook\n */\n async get(id: string): Promise<Webhook> {\n return this.request<Webhook>(`/v0/webhooks/${id}`, \"GET\");\n }\n\n /**\n * List all Webhooks\n * @param options Pagination options\n * @returns The list of Webhooks\n */\n async list(options?: ListWebhooksOptions): Promise<ListWebhooksResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListWebhooksResponse>(\n \"/v0/webhooks\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all Webhooks, handling pagination automatically\n * @param options Pagination options\n * @returns Async generator of Webhooks\n */\n async *listAll(options?: ListWebhooksOptions): AsyncGenerator<Webhook> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const webhook of response.data) {\n yield webhook;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Webhooks into an array\n * @param options Pagination options\n * @returns Promise resolving to an array of all Webhooks\n */\n async getAll(options?: ListWebhooksOptions): Promise<Webhook[]> {\n const webhooks: Webhook[] = [];\n for await (const webhook of this.listAll(options)) {\n webhooks.push(webhook);\n }\n return webhooks;\n }\n\n /**\n * Update a Webhook\n * @param id The ID of the Webhook\n * @param params The webhook update parameters (events, metadata, url)\n * @returns The updated Webhook\n */\n async update(id: string, params: UpdateWebhookParameters): Promise<Webhook> {\n return this.request<Webhook>(`/v0/webhooks/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete a Webhook\n * @param id The ID of the Webhook\n * @returns The deleted Webhook\n */\n async delete(id: string): Promise<Webhook> {\n return this.request<Webhook>(`/v0/webhooks/${id}`, \"DELETE\");\n }\n\n /**\n * List all attempts for a Webhook\n * @param id The ID of the Webhook\n * @param options Pagination and filtering options\n * @returns The list of Webhook attempts\n */\n async listAttempts(\n id: string,\n options?: ListWebhookAttemptsOptions\n ): Promise<ListWebhookAttemptsResponse> {\n const params = {\n cursor: options?.cursor,\n limit: options?.limit,\n eventType: options?.eventType,\n successful: options?.successful,\n };\n\n return this.request<ListWebhookAttemptsResponse>(\n `/v0/webhooks/${id}/attempts`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all attempts for a Webhook, handling pagination automatically\n * @param id The ID of the Webhook\n * @param options Pagination and filtering options\n * @returns Async generator of Webhook attempts\n */\n async *listAllAttempts(\n id: string,\n options?: ListWebhookAttemptsOptions\n ): AsyncGenerator<WebhookAttempt> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.listAttempts(id, pageOptions);\n\n for (const attempt of response.data) {\n yield attempt;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all attempts for a Webhook into an array\n * @param id The ID of the Webhook\n * @param options Pagination and filtering options\n * @returns Promise resolving to an array of all Webhook attempts\n */\n async getAllAttempts(\n id: string,\n options?: ListWebhookAttemptsOptions\n ): Promise<WebhookAttempt[]> {\n const attempts: WebhookAttempt[] = [];\n for await (const attempt of this.listAllAttempts(id, options)) {\n attempts.push(attempt);\n }\n return attempts;\n }\n}\n","/**\n * Main client for Websets API\n */\nimport { Exa, ExaError, HttpStatusCode, WebsetHeadersLike } from \"../index\";\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport { WebsetEnrichmentsClient } from \"./enrichments\";\nimport { EventsClient } from \"./events\";\nimport { ImportsClient } from \"./imports\";\nimport { WebsetItemsClient } from \"./items\";\nimport { WebsetMonitorsClient } from \"./monitors\";\nimport {\n CreateWebsetParameters,\n GetWebsetResponse,\n ListWebsetsResponse,\n PreviewWebsetParameters,\n PreviewWebsetResponse,\n UpdateWebsetRequest,\n Webset,\n WebsetStatus,\n} from \"./openapi\";\nimport { WebsetSearchesClient } from \"./searches\";\nimport { WebsetWebhooksClient } from \"./webhooks\";\n\n/**\n * Options for listing Websets (API only supports pagination)\n */\nexport interface ListWebsetsOptions extends PaginationParams {}\n\n/**\n * Client for managing Websets\n */\nexport class WebsetsClient extends WebsetsBaseClient {\n /**\n * Client for managing Events\n */\n events: EventsClient;\n\n /**\n * Client for managing Imports\n */\n imports: ImportsClient;\n\n /**\n * Client for managing Webset Items\n */\n items: WebsetItemsClient;\n\n /**\n * Client for managing Webset Searches\n */\n searches: WebsetSearchesClient;\n\n /**\n * Client for managing Webset Enrichments\n */\n enrichments: WebsetEnrichmentsClient;\n\n /**\n * Client for managing Webset Monitors\n */\n monitors: WebsetMonitorsClient;\n\n /**\n * Client for managing Webset Webhooks\n */\n webhooks: WebsetWebhooksClient;\n\n /**\n * Initialize a new Websets client\n * @param client The Exa client instance\n */\n constructor(client: Exa) {\n super(client);\n this.events = new EventsClient(client);\n this.imports = new ImportsClient(client);\n this.items = new WebsetItemsClient(client);\n this.searches = new WebsetSearchesClient(client);\n this.enrichments = new WebsetEnrichmentsClient(client);\n this.monitors = new WebsetMonitorsClient(client);\n this.webhooks = new WebsetWebhooksClient(client);\n }\n\n /**\n * Create a new Webset\n * @param params The Webset creation parameters\n * @returns The created Webset\n */\n async create(\n params: CreateWebsetParameters,\n options?: { headers?: WebsetHeadersLike }\n ): Promise<Webset> {\n return this.request<Webset>(\n \"/v0/websets\",\n \"POST\",\n params,\n undefined,\n options?.headers\n );\n }\n\n /**\n * Preview a webset\n * @param params The preview parameters\n * @param options Optional parameters. Search = true allows you to retrieve a preview set of items that could be returned by the webset.\n * @returns The preview response showing how the query will be decomposed\n */\n async preview(\n params: PreviewWebsetParameters,\n options?: { search?: boolean }\n ): Promise<PreviewWebsetResponse> {\n const queryParams: { search?: boolean } = {};\n if (options?.search !== undefined) {\n queryParams.search = options.search;\n }\n\n return this.request<PreviewWebsetResponse>(\n \"/v0/websets/preview\",\n \"POST\",\n params,\n queryParams\n );\n }\n\n /**\n * Get a Webset by ID\n * @param id The ID of the Webset\n * @param expand Optional array of relations to expand\n * @returns The Webset\n */\n async get(id: string, expand?: Array<\"items\">): Promise<GetWebsetResponse> {\n const params: { expand?: Array<\"items\"> } = {};\n if (expand) {\n params.expand = expand;\n }\n\n return this.request<GetWebsetResponse>(\n `/v0/websets/${id}`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * List all Websets\n * @param options Pagination options (filtering by status is not supported by API)\n * @returns The list of Websets\n */\n async list(options?: ListWebsetsOptions): Promise<ListWebsetsResponse> {\n const params = this.buildPaginationParams(options);\n return this.request<ListWebsetsResponse>(\n \"/v0/websets\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all Websets, handling pagination automatically\n * @param options Pagination options\n * @returns Async generator of Websets\n */\n async *listAll(options?: ListWebsetsOptions): AsyncGenerator<Webset> {\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await this.list(pageOptions);\n\n for (const webset of response.data) {\n yield webset;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n }\n }\n\n /**\n * Collect all Websets into an array\n * @param options Pagination options\n * @returns Promise resolving to an array of all Websets\n */\n async getAll(options?: ListWebsetsOptions): Promise<Webset[]> {\n const websets: Webset[] = [];\n for await (const webset of this.listAll(options)) {\n websets.push(webset);\n }\n return websets;\n }\n\n /**\n * Update a Webset\n * @param id The ID of the Webset\n * @param params The Webset update parameters\n * @returns The updated Webset\n */\n async update(id: string, params: UpdateWebsetRequest): Promise<Webset> {\n return this.request<Webset>(`/v0/websets/${id}`, \"POST\", params);\n }\n\n /**\n * Delete a Webset\n * @param id The ID of the Webset\n * @returns The deleted Webset\n */\n async delete(id: string): Promise<Webset> {\n return this.request<Webset>(`/v0/websets/${id}`, \"DELETE\");\n }\n\n /**\n * Cancel a running Webset\n * @param id The ID or external ID of the Webset\n * @returns The canceled Webset (as returned by the API)\n */\n async cancel(id: string): Promise<Webset> {\n return this.request<Webset>(`/v0/websets/${id}/cancel`, \"POST\");\n }\n\n /**\n * Wait until a Webset is idle\n * @param id The ID of the Webset\n * @param options Configuration options for timeout and polling\n * @returns The Webset once it becomes idle\n * @throws Error if the Webset does not become idle within the timeout\n */\n async waitUntilIdle(\n id: string,\n options?:\n | {\n timeout?: number;\n pollInterval?: number;\n onPoll?: (status: WebsetStatus) => void;\n }\n | number // Legacy: timeout only\n ): Promise<Webset> {\n let timeout: number | undefined;\n let pollInterval = 1000;\n let onPoll: ((status: WebsetStatus) => void) | undefined;\n\n // Handle legacy timeout argument or new options object\n if (typeof options === \"number\") {\n timeout = options;\n } else if (options) {\n timeout = options.timeout;\n pollInterval = options.pollInterval || 1000;\n onPoll = options.onPoll;\n }\n\n const startTime = Date.now();\n\n while (true) {\n const webset = await this.get(id);\n\n if (onPoll) {\n onPoll(webset.status);\n }\n\n if (webset.status === WebsetStatus.idle) {\n return webset;\n }\n\n if (timeout && Date.now() - startTime > timeout) {\n throw new ExaError(\n `Webset ${id} did not reach idle state within ${timeout}ms. Current status: ${webset.status}`,\n HttpStatusCode.RequestTimeout\n );\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollInterval));\n }\n }\n}\n","import { z } from \"zod\";\nimport type {\n ContentsOptions,\n RegularSearchOptions,\n SearchResponse,\n} from \"../index\";\nimport type { Exa } from \"../index\";\nimport { zodToJsonSchema } from \"../zod-utils\";\n\nexport type ToolJsonSchema = {\n type: \"object\";\n properties?: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n [key: string]: unknown;\n};\n\nexport type ToolDefinition = {\n name: string;\n description: string;\n parameters?: ToolJsonSchema;\n input_schema?: ToolJsonSchema;\n strict?: boolean;\n};\n\nexport type ExaToolSpec<Args = unknown, Result = unknown> = {\n name: string;\n description: string;\n inputSchema: z.ZodType<Args>;\n jsonSchema: ToolJsonSchema;\n execute(args: Args): Promise<Result>;\n format(result: Result): string;\n definition: ToolDefinition;\n run(args: unknown): Promise<string>;\n};\n\nexport type WebSearchToolConfig = RegularSearchOptions & {\n /**\n * Tool name shown to the model. Defaults to `\"web_search\"`. Set a custom\n * name to avoid collisions, e.g. with Anthropic's built-in `web_search`\n * server tool, or to register multiple differently-configured search tools.\n */\n name?: string;\n /** Tool description shown to the model. */\n description?: string;\n};\n\nexport type GetContentsToolConfig = ContentsOptions & {\n /**\n * Tool name shown to the model. Defaults to `\"get_contents\"`. Set a custom\n * name to avoid collisions, or to register multiple differently-configured\n * contents tools.\n */\n name?: string;\n /** Tool description shown to the model. */\n description?: string;\n};\n\nexport type ToolNamespace = {\n webSearch(config?: WebSearchToolConfig): WebSearchTool;\n getContents(config?: GetContentsToolConfig): GetContentsTool;\n};\n\ntype SearchArgs = { query: string; objective?: string };\ntype GetContentsArgs = { urls: string[] };\ntype FormattableResult = {\n title?: string | null;\n url?: string;\n publishedDate?: string;\n author?: string;\n highlights?: string[];\n text?: string;\n summary?: string;\n};\n\nexport type WebSearchTool = ExaToolSpec<\n SearchArgs,\n SearchResponse<ContentsOptions>\n>;\n\nexport type GetContentsTool = ExaToolSpec<\n GetContentsArgs,\n SearchResponse<ContentsOptions>\n>;\n\nexport const DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION =\n \"Search the web for up-to-date, relevant information. Describe the ideal page rather than listing keywords.\";\n\nexport const DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION =\n \"Read the full contents of web pages you already have URLs for, such as pages returned by a search or mentioned by the user.\";\n\n/** Model-facing description of the `objective` search tool parameter. */\nexport const SEARCH_OBJECTIVE_TOOL_DESCRIPTION =\n \"Goal for this search turn; say which documents should rank first, which should be excluded, and what specific facts or figures to pull from them.\";\n\nconst MAX_OBJECTIVE_LENGTH = 4096;\n\nfunction formatResults(\n response: SearchResponse<ContentsOptions>,\n emptyMessage: string\n): string {\n const formatted = (response.results as FormattableResult[])\n .map((result) => {\n const lines = [\n `Title: ${result.title || \"N/A\"}`,\n `URL: ${result.url || \"N/A\"}`,\n `Published: ${result.publishedDate || \"N/A\"}`,\n `Author: ${result.author || \"N/A\"}`,\n ];\n if (result.summary) {\n lines.push(`Summary: ${result.summary}`);\n }\n if (result.highlights && result.highlights.length > 0) {\n lines.push(`Highlights:\\n${result.highlights.join(\"\\n\")}`);\n } else if (result.text) {\n lines.push(`Text: ${result.text}`);\n }\n return lines.join(\"\\n\");\n })\n .join(\"\\n\\n---\\n\\n\");\n return formatted || emptyMessage;\n}\n\nfunction formatSearchResponse(\n response: SearchResponse<ContentsOptions>\n): string {\n return formatResults(response, \"No search results found.\");\n}\n\nfunction formatContentsResponse(\n response: SearchResponse<ContentsOptions>\n): string {\n return formatResults(response, \"No contents found.\");\n}\n\nfunction registerTool<T extends ExaToolSpec>(\n registry: ToolRegistry,\n tool: T\n): T {\n registry.register(tool);\n return tool;\n}\n\nfunction createTool<TArgs, TResult>(\n registry: ToolRegistry,\n params: {\n name: string;\n description: string;\n inputSchema: z.ZodType<TArgs>;\n jsonSchema: ToolJsonSchema;\n execute(args: TArgs): Promise<TResult>;\n format(result: TResult): string;\n definition: ToolDefinition;\n }\n): ExaToolSpec<TArgs, TResult> {\n const tool: ExaToolSpec<TArgs, TResult> = {\n name: params.name,\n description: params.description,\n inputSchema: params.inputSchema,\n jsonSchema: params.jsonSchema,\n execute: params.execute,\n format: params.format,\n definition: params.definition,\n async run(args: unknown): Promise<string> {\n try {\n const parsed = params.inputSchema.parse(args);\n const result = await params.execute(parsed);\n return params.format(result);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return `Error: ${message}`;\n }\n },\n };\n return registerTool(registry, tool);\n}\n\n/**\n * Optional when parsing, but listed in the JSON schema's `required` so models\n * fill it in on every call. `zod-to-json-schema` decides `required` from\n * `isOptional()`.\n */\nclass AdvertisedRequiredOptional<\n T extends z.ZodTypeAny,\n> extends z.ZodOptional<T> {\n isOptional(): boolean {\n return false;\n }\n}\n\nfunction advertisedRequired<T extends z.ZodTypeAny>(\n inner: T\n): AdvertisedRequiredOptional<T> {\n return new AdvertisedRequiredOptional({\n innerType: inner,\n typeName: z.ZodFirstPartyTypeKind.ZodOptional,\n });\n}\n\n/** Create a `web_search` tool. Defaults to `type: \"auto\"` and highlights. */\nexport function createWebSearchTool(\n exa: Exa,\n registry: ToolRegistry,\n config: WebSearchToolConfig = {}\n): WebSearchTool {\n const {\n name = \"web_search\",\n description = DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION,\n ...searchOptions\n } = config;\n const inputSchema = z.object({\n query: z\n .string()\n .describe(\n \"Natural language search query. Should be a semantically rich description of the ideal page, not just keywords.\"\n ),\n // Length limits are validated but not advertised: strict tool use on some\n // providers rejects `minLength`/`maxLength` in the schema.\n objective: advertisedRequired(\n z\n .string()\n .trim()\n .refine((value) => value.length > 0, \"objective must not be empty\")\n .refine(\n (value) => value.length <= MAX_OBJECTIVE_LENGTH,\n `objective must be at most ${MAX_OBJECTIVE_LENGTH} characters`\n )\n ).describe(SEARCH_OBJECTIVE_TOOL_DESCRIPTION),\n });\n const jsonSchema = zodToJsonSchema(inputSchema) as ToolJsonSchema;\n delete jsonSchema.$schema;\n\n return createTool(registry, {\n name,\n description,\n inputSchema,\n jsonSchema,\n definition: {\n name,\n description,\n parameters: jsonSchema,\n },\n execute: ({ query, objective }) => {\n const options = {\n type: \"auto\",\n numResults: 10,\n contents: { highlights: true },\n ...searchOptions,\n ...(objective !== undefined && { objective }),\n } as RegularSearchOptions;\n return exa.search(query, options) as Promise<\n SearchResponse<ContentsOptions>\n >;\n },\n format: formatSearchResponse,\n }) as WebSearchTool;\n}\n\n/**\n * Create a `get_contents` tool that reads pages the model already has URLs for.\n * Inherits `exa.getContents` defaults, which return page text when no content\n * option is configured.\n */\nexport function createGetContentsTool(\n exa: Exa,\n registry: ToolRegistry,\n config: GetContentsToolConfig = {}\n): GetContentsTool {\n const {\n name = \"get_contents\",\n description = DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION,\n ...contentsOptions\n } = config;\n const inputSchema = z.object({\n urls: z\n .array(z.string())\n .describe(\n \"Absolute URLs of the pages to read, including the scheme. Pass several URLs to read them in a single call.\"\n ),\n });\n const jsonSchema = zodToJsonSchema(inputSchema) as ToolJsonSchema;\n delete jsonSchema.$schema;\n\n return createTool(registry, {\n name,\n description,\n inputSchema,\n jsonSchema,\n definition: {\n name,\n description,\n parameters: jsonSchema,\n },\n execute: ({ urls }) =>\n exa.getContents(urls, contentsOptions) as Promise<\n SearchResponse<ContentsOptions>\n >,\n format: formatContentsResponse,\n }) as GetContentsTool;\n}\n\nexport class ToolRegistry {\n private readonly registry = new Map<string, ExaToolSpec>();\n\n register(tool: ExaToolSpec): void {\n this.registry.set(tool.name, tool);\n }\n\n resolve(tools?: readonly ExaToolSpec[]): Map<string, ExaToolSpec> {\n return tools\n ? new Map(tools.map((tool) => [tool.name, tool]))\n : new Map(this.registry);\n }\n}\n\nexport function getTool(\n tools: Map<string, ExaToolSpec>,\n name: string\n): ExaToolSpec | undefined {\n return tools.get(name);\n}\n\nexport function unknownToolError(name: string): string {\n return `Error: unknown tool \"${name}\"`;\n}\n","import type { Exa } from \"../index\";\nimport {\n createGetContentsTool,\n createWebSearchTool,\n type ExaToolSpec,\n type GetContentsToolConfig,\n type WebSearchToolConfig,\n ToolRegistry,\n getTool,\n unknownToolError,\n} from \"./core\";\nimport type { ToolDefinition } from \"./core\";\n\ntype AnthropicToolUse = {\n type: \"tool_use\";\n id: string;\n name: string;\n input: unknown;\n};\n\ntype AnthropicMessage = {\n content?: readonly unknown[] | null;\n};\n\nexport type AnthropicToolResult = {\n type: \"tool_result\";\n tool_use_id: string;\n content: string;\n};\n\ntype AnthropicRunnable = ExaToolSpec & {\n type: \"custom\";\n name: string;\n description: string;\n input_schema: ExaToolSpec[\"jsonSchema\"];\n parse: (input: unknown) => unknown;\n run: (args: unknown) => Promise<string>;\n definition: ToolDefinition & {\n input_schema: ExaToolSpec[\"jsonSchema\"];\n };\n};\n\nexport class AnthropicTools {\n constructor(\n private readonly exa: Exa,\n private readonly registry: ToolRegistry\n ) {}\n\n /** Anthropic `web_search` tool. Defaults to `auto` + highlights. */\n webSearch(config?: WebSearchToolConfig) {\n return runnable(createWebSearchTool(this.exa, this.registry, config));\n }\n\n /** Anthropic `get_contents` tool for reading pages by URL. */\n getContents(config?: GetContentsToolConfig) {\n return runnable(createGetContentsTool(this.exa, this.registry, config));\n }\n\n /**\n * Run the `tool_use` blocks in an assistant message and return the matching\n * `tool_result` blocks. Every `tool_use` block is answered so the follow-up\n * request never omits a required result: a block whose name doesn't match a\n * known tool gets an `Error: unknown tool \"<name>\"` result. When handling\n * some tools yourself, replace those error results with your own before\n * sending the next request.\n */\n async handleToolUse(\n message: AnthropicMessage,\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<AnthropicToolResult[]> {\n const tools = this.registry.resolve(options?.tools);\n const blocks = (message.content ?? []).filter(isAnthropicToolUse);\n return Promise.all(\n blocks.map(async (block) => {\n const tool = getTool(tools, block.name);\n return {\n type: \"tool_result\" as const,\n tool_use_id: block.id,\n content: tool\n ? await tool.run(block.input)\n : unknownToolError(block.name),\n };\n })\n );\n }\n}\n\nfunction isAnthropicToolUse(value: unknown): value is AnthropicToolUse {\n if (!value || typeof value !== \"object\") return false;\n const block = value as Partial<AnthropicToolUse>;\n return (\n block.type === \"tool_use\" &&\n typeof block.id === \"string\" &&\n typeof block.name === \"string\"\n );\n}\n\nfunction runnable(tool: ExaToolSpec): AnthropicRunnable {\n const definition = {\n type: \"custom\" as const,\n name: tool.name,\n description: tool.description,\n input_schema: tool.jsonSchema,\n parse: (input: unknown) => tool.inputSchema.parse(input),\n run: (args: unknown) => tool.run(args),\n };\n Object.defineProperties(definition, {\n parse: { enumerable: false },\n run: { enumerable: false },\n });\n Object.defineProperties(\n definition,\n Object.fromEntries(\n Object.entries(tool)\n .filter(([key]) => ![\"name\", \"description\"].includes(key))\n .map(([key, value]) => [\n key,\n { value, enumerable: false, configurable: true },\n ])\n )\n );\n Object.defineProperty(definition, \"type\", {\n value: \"custom\",\n enumerable: false,\n configurable: true,\n });\n Object.defineProperty(definition, \"definition\", {\n value: {\n name: tool.name,\n description: tool.description,\n input_schema: tool.jsonSchema,\n },\n enumerable: false,\n });\n return definition as AnthropicRunnable;\n}\n","import type { Exa } from \"../index\";\nimport {\n createGetContentsTool,\n createWebSearchTool,\n type ExaToolSpec,\n type GetContentsToolConfig,\n type WebSearchToolConfig,\n type ToolDefinition,\n type ToolJsonSchema,\n ToolRegistry,\n getTool,\n unknownToolError,\n} from \"./core\";\n\ntype OpenAIToolCall = {\n id: string;\n function: { name: string; arguments: string };\n};\n\ntype OpenAIAssistantMessage = {\n tool_calls?: readonly unknown[] | null;\n};\n\nexport type OpenAIToolMessage = {\n role: \"tool\";\n tool_call_id: string;\n content: string;\n};\n\ntype ResponsesFunctionCall = {\n type: \"function_call\";\n call_id: string;\n name: string;\n arguments: string;\n};\n\ntype ResponsesOutput = {\n output?: readonly unknown[];\n};\n\nexport type ResponsesFunctionCallOutput = {\n type: \"function_call_output\";\n call_id: string;\n output: string;\n};\n\ntype OpenAIChatDefinition = {\n type: \"function\";\n function: {\n name: string;\n description: string;\n parameters: any;\n };\n};\n\ntype OpenAIRunnable = ExaToolSpec & {\n type: \"function\";\n function: {\n name: string;\n description: string;\n parameters: any;\n parse: (input: string) => any;\n function: (args: any, runner?: unknown) => Promise<string>;\n };\n definition: OpenAIChatDefinition;\n};\n\ntype OpenAIResponsesRunnable = ExaToolSpec & {\n type: \"function\";\n name: string;\n description: string;\n parameters: any;\n strict: false;\n definition: ToolDefinition & {\n type: \"function\";\n parameters: ToolJsonSchema;\n strict: false;\n };\n};\n\nfunction runnable(tool: ExaToolSpec): OpenAIRunnable {\n const functionDefinition = {\n ...tool.definition,\n parse: (input: string) => JSON.parse(input),\n function: (args: any) => tool.run(args),\n };\n Object.defineProperties(functionDefinition, {\n parse: { enumerable: false },\n function: { enumerable: false },\n });\n const definition = {\n type: \"function\" as const,\n function: functionDefinition,\n };\n Object.defineProperties(\n definition,\n Object.fromEntries(\n Object.entries(tool)\n .filter(([key]) => ![\"name\", \"description\"].includes(key))\n .map(([key, value]) => [\n key,\n { value, enumerable: false, configurable: true },\n ])\n )\n );\n Object.defineProperties(definition, {\n name: {\n value: tool.name,\n enumerable: false,\n configurable: true,\n },\n description: {\n value: tool.description,\n enumerable: false,\n configurable: true,\n },\n });\n Object.defineProperty(definition, \"definition\", {\n value: {\n type: \"function\",\n function: {\n name: tool.name,\n description: tool.description,\n parameters: tool.jsonSchema,\n },\n } satisfies OpenAIChatDefinition,\n enumerable: false,\n configurable: true,\n });\n return definition as OpenAIRunnable;\n}\n\nexport class OpenAIResponsesTools {\n constructor(\n private readonly exa: Exa,\n private readonly registry: ToolRegistry,\n private readonly handleResponses: (\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ) => Promise<ResponsesFunctionCallOutput[]>\n ) {}\n\n /** Responses API `web_search` tool. Defaults to `auto` + highlights. */\n webSearch(config?: WebSearchToolConfig) {\n return responsesRunnable(\n createWebSearchTool(this.exa, this.registry, config)\n );\n }\n\n /** Responses API `get_contents` tool for reading pages by URL. */\n getContents(config?: GetContentsToolConfig) {\n return responsesRunnable(\n createGetContentsTool(this.exa, this.registry, config)\n );\n }\n\n /**\n * Run the function calls in a Responses API response (or output item array)\n * and return `function_call_output` items. Every function call is answered\n * so the follow-up request never omits a required output: a call whose name\n * doesn't match a known tool gets an `Error: unknown tool \"<name>\"` output.\n * When handling some tools yourself, replace those error outputs with your\n * own results before sending the next request.\n */\n async handleToolCalls(\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<ResponsesFunctionCallOutput[]> {\n return this.handleResponses(responseOrOutputItems, options);\n }\n}\n\nfunction responsesRunnable(tool: ExaToolSpec): OpenAIResponsesRunnable {\n const definition = {\n type: \"function\" as const,\n name: tool.name,\n description: tool.description,\n parameters: tool.jsonSchema,\n strict: false,\n };\n Object.defineProperties(\n definition,\n Object.fromEntries(\n Object.entries(tool)\n .filter(([key]) => ![\"name\", \"description\"].includes(key))\n .map(([key, value]) => [\n key,\n { value, enumerable: false, configurable: true },\n ])\n )\n );\n Object.defineProperty(definition, \"definition\", {\n value: {\n ...tool.definition,\n type: \"function\",\n parameters: tool.jsonSchema,\n strict: false,\n },\n enumerable: false,\n });\n return definition as OpenAIResponsesRunnable;\n}\n\nexport class OpenAITools {\n readonly responses: OpenAIResponsesTools;\n\n constructor(\n private readonly exa: Exa,\n private readonly registry: ToolRegistry\n ) {\n this.responses = new OpenAIResponsesTools(\n exa,\n registry,\n (responseOrOutputItems, options) =>\n this.handleResponsesToolCalls(responseOrOutputItems, options)\n );\n }\n\n /** Chat Completions `web_search` tool. Defaults to `auto` + highlights. */\n webSearch(config?: WebSearchToolConfig) {\n return runnable(createWebSearchTool(this.exa, this.registry, config));\n }\n\n /** Chat Completions `get_contents` tool for reading pages by URL. */\n getContents(config?: GetContentsToolConfig) {\n return runnable(createGetContentsTool(this.exa, this.registry, config));\n }\n\n /**\n * Run the tool calls in a Chat Completions assistant message and return the\n * matching `role: \"tool\"` messages. Every tool call is answered so the\n * follow-up request never omits a required tool response: a call whose name\n * doesn't match a known tool gets an `Error: unknown tool \"<name>\"` output.\n * When handling some tools yourself, replace those error outputs with your\n * own results before sending the next request.\n */\n handleToolCalls(\n assistantMessage: OpenAIAssistantMessage,\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<OpenAIToolMessage[]>;\n /**\n * Run the function calls in a Responses API response (or output item array)\n * and return `function_call_output` items, answering calls whose name\n * doesn't match a known tool with `Error: unknown tool \"<name>\"` outputs.\n */\n handleToolCalls(\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<ResponsesFunctionCallOutput[]>;\n async handleToolCalls(\n assistantMessage:\n | OpenAIAssistantMessage\n | ResponsesOutput\n | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<(OpenAIToolMessage | ResponsesFunctionCallOutput)[]> {\n if (isResponsesInput(assistantMessage)) {\n return this.handleResponsesToolCalls(assistantMessage, options);\n }\n return this.handleChatToolCalls(assistantMessage, options);\n }\n\n private async handleChatToolCalls(\n assistantMessage: OpenAIAssistantMessage,\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<OpenAIToolMessage[]> {\n const tools = this.registry.resolve(options?.tools);\n const calls = (assistantMessage.tool_calls ?? []).filter(isOpenAIToolCall);\n return Promise.all(\n calls.map(async (call) => {\n const tool = getTool(tools, call.function.name);\n return {\n role: \"tool\" as const,\n tool_call_id: call.id,\n content: tool\n ? await tool.run(parseArguments(call.function.arguments))\n : unknownToolError(call.function.name),\n };\n })\n );\n }\n\n private async handleResponsesToolCalls(\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<ResponsesFunctionCallOutput[]> {\n const tools = this.registry.resolve(options?.tools);\n const rawItems: readonly unknown[] =\n !Array.isArray(responseOrOutputItems) && \"output\" in responseOrOutputItems\n ? (responseOrOutputItems.output ?? [])\n : (responseOrOutputItems as readonly unknown[]);\n const items = rawItems.filter(isResponsesFunctionCall);\n return Promise.all(\n items.map(async (call) => {\n const tool = getTool(tools, call.name);\n return {\n type: \"function_call_output\" as const,\n call_id: call.call_id,\n output: tool\n ? await tool.run(parseArguments(call.arguments))\n : unknownToolError(call.name),\n };\n })\n );\n }\n}\n\nfunction parseArguments(argumentsText: string): unknown {\n try {\n return JSON.parse(argumentsText);\n } catch {\n return argumentsText;\n }\n}\n\nfunction isOpenAIToolCall(value: unknown): value is OpenAIToolCall {\n if (!value || typeof value !== \"object\") return false;\n const call = value as Partial<OpenAIToolCall>;\n return (\n typeof call.id === \"string\" &&\n !!call.function &&\n typeof call.function.name === \"string\" &&\n typeof call.function.arguments === \"string\"\n );\n}\n\nfunction isResponsesFunctionCall(\n value: unknown\n): value is ResponsesFunctionCall {\n if (!value || typeof value !== \"object\") return false;\n const call = value as Partial<ResponsesFunctionCall>;\n return (\n call.type === \"function_call\" &&\n typeof call.call_id === \"string\" &&\n typeof call.name === \"string\" &&\n typeof call.arguments === \"string\"\n );\n}\n\nfunction isResponsesInput(\n value: OpenAIAssistantMessage | ResponsesOutput | readonly unknown[]\n): value is ResponsesOutput | readonly unknown[] {\n if (Array.isArray(value)) return value.some(isResponsesFunctionCall);\n return \"output\" in value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA+B;;;ACA/B;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,OAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,SAAW;AAAA,MACX,QAAU;AAAA,MACV,QAAU;AAAA,IACZ;AAAA,IACA,kBAAkB;AAAA,EACpB;AAAA,EACA,OAAS;AAAA,EACT,SAAW;AAAA,IACT,cAAc;AAAA,IACd,OAAS;AAAA,IACT,MAAQ;AAAA,IACR,aAAa;AAAA,IACb,oBAAoB;AAAA,IACpB,WAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,0BAA0B;AAAA,IAC1B,QAAU;AAAA,IACV,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB,cAAc;AA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KAAK;AACnD,gBAAI,CAAC,WAAW,YAAY,UAAU;AACpC;AAAA,YACF;AAEA,gBAAI;AACJ,gBAAI;AACF,sBAAQ,KAAK,MAAM,OAAO;AAAA,YAC5B,QAAQ;AACN;AAAA,YACF;AAEA,oBAAQ,MAAM,KAAK;AAAA,cACjB,KAAK;AACH,uBAAO,YAAY;AACnB,wBAAQ,MAAM,IAAS;AACvB;AAAA,cACF,KAAK,SAAS;AACZ,sBAAM,UAAU,MAAM,OAAO,WAAW;AACxC,uBAAO,YAAY;AACnB;AAAA,kBACE,IAAI;AAAA,oBACF;AAAA;AAAA,qBAEA,oBAAI,KAAK,GAAE,YAAY;AAAA,kBACzB;AAAA,gBACF;AACA;AAAA,cACF;AAAA;AAAA,cAEA;AACE;AAAA,YACJ;AAAA,UACF;AAAA,QACF;AAGA;AAAA,UACE,IAAI;AAAA,YACF;AAAA;AAAA,aAEA,oBAAI,KAAK,GAAE,YAAY;AAAA,UACzB;AAAA,QACF;AAAA,MACF,SAAS,KAAK;AACZ,eAAO,GAAY;AAAA,MACrB,UAAE;AACA,YAAI;AACF,iBAAO,YAAY;AAAA,QACrB,QAAQ;AAAA,QAER;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAaA,IAAO,gBAAQD;","names":["Exa","HttpStatusCode","convertZodToJsonSchema","CreateEnrichmentParametersFormat","CreateImportParametersFormat","WebsetImportSource","EventType","ImportFailedReason","ImportFormat","ImportObject","ImportStatus","MonitorObject","MonitorStatus","MonitorRunObject","MonitorRunStatus","MonitorRunType","UpdateMonitorStatus","WebhookStatus","WebsetStatus","WebsetEnrichmentStatus","WebsetEnrichmentFormat","WebsetItemSource","WebsetItemEvaluationSatisfied","WebsetExcludeSource","WebsetSearchScopeSource","WebsetSearchStatus","WebsetSearchBehavior","WebsetSearchCanceledReason","import_zod","runnable","fetch","Exa","json","text","message"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../package.json","../src/errors.ts","../src/error-response.ts","../src/zod-utils.ts","../src/request-options.ts","../src/agent/base.ts","../src/agent/betas.ts","../src/agent/monitors/types.ts","../src/agent/monitors/base.ts","../src/agent/monitors/client.ts","../src/agent/types.ts","../src/agent/client.ts","../src/monitors/base.ts","../src/monitors/client.ts","../src/research/base.ts","../src/research/client.ts","../src/websets/base.ts","../src/websets/enrichments.ts","../src/websets/events.ts","../src/websets/openapi.ts","../src/websets/imports.ts","../src/websets/items.ts","../src/websets/monitors.ts","../src/websets/searches.ts","../src/websets/webhooks.ts","../src/websets/client.ts","../src/tools/core.ts","../src/tools/anthropic.ts","../src/tools/openai.ts"],"sourcesContent":["import fetch, { Headers } from \"cross-fetch\";\nimport { ZodSchema } from \"zod\";\nimport packageJson from \"../package.json\";\nimport { AgentClient, BetaClient } from \"./agent/client\";\nimport { headersForBetas } from \"./agent/betas\";\nimport {\n exaErrorFromResponse,\n readResponseBody,\n truncateResponseBody,\n} from \"./error-response\";\nimport { ExaError, HttpStatusCode } from \"./errors\";\nimport { SearchMonitorsClient } from \"./monitors/client\";\nimport {\n isStreamRequestOptions,\n mergeRequestBody,\n mergeRequestHeaders,\n mergeRequestOptions,\n mergeRequestQuery,\n omitRequestOptions,\n pickRequestOptions,\n resolveRequestSignal,\n setClientDefaults,\n streamRequestOptions,\n validateTimeout,\n withClientDefaults,\n withDisposeOnBodySettled,\n type RequestOptions,\n type TransportRequestOptions,\n} from \"./request-options\";\nimport { ResearchClient } from \"./research/client\";\nimport { WebsetsClient } from \"./websets/client\";\nimport { isZodSchema, zodToJsonSchema } from \"./zod-utils\";\n\nimport { AnthropicTools } from \"./tools/anthropic\";\nimport { OpenAITools } from \"./tools/openai\";\nimport {\n createGetContentsTool,\n createWebSearchTool,\n ToolRegistry,\n type ToolNamespace,\n} from \"./tools/core\";\n\n// Use native fetch in Node.js environments\nconst fetchImpl =\n typeof global !== \"undefined\" && global.fetch ? global.fetch : fetch;\nconst HeadersImpl =\n typeof global !== \"undefined\" && global.Headers ? global.Headers : Headers;\n\nconst DEFAULT_MAX_CHARACTERS = 10_000;\n\n/** Exa-Beta token required for Dynamic Highlights (research preview). */\nexport const DYNAMIC_HIGHLIGHTS_BETA = \"dynamic-highlights-2026-08-28\";\n\n/**\n * Options for retrieving page contents\n * @typedef {Object} ContentsOptions\n * @property {TextContentsOptions | boolean} [text] - Options for retrieving text contents.\n * @property {HighlightsContentsOptions | boolean} [highlights] - Recommended: `true`. Exa dynamically chooses the number of characters based on each document's relevance to your query.\n * @property {SummaryContentsOptions | boolean} [summary] - Options for retrieving summary.\n * @property {ContextOptions | boolean} [context] - Deprecated. Use `text` or `highlights`.\n * @property {number} [maxAgeHours] - Maximum age of cached content in hours. If content is older, it will be fetched fresh. Special values: 0 = always fetch fresh content, -1 = never fetch fresh (use cached content only). Example: 168 = fetch fresh for pages older than 7 days.\n * @property {string} [snapshotAsOf] - ISO 8601 datetime. Return the newest stored version at or before this instant instead of live content.\n * @property {boolean} [filterEmptyResults] - If true, filters out results with no contents. Default is true.\n * @property {number} [subpages] - The number of subpages to return for each result, where each subpage is derived from an internal link for the result. Deprecated on `search()`; use `getContents()` to crawl subpages.\n * @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. Deprecated on `search()`; use `getContents()` to crawl subpages.\n * @property {ExtrasOptions} [extras] - Miscelleneous data derived from results\n */\nexport type ContentsOptions = {\n text?: TextContentsOptions | true;\n /**\n * Recommended default: `true`. Exa dynamically chooses the number of\n * characters based on each document's relevance to your query.\n * Use this for concise AI context, RAG, and search previews without\n * choosing a character budget yourself. Read `result.highlights`.\n * Set `maxCharacters` only when your application has an explicit\n * character-limit requirement; it overrides the recommended default.\n */\n highlights?: HighlightsContentsOptions | true;\n summary?: SummaryContentsOptions | true;\n livecrawl?: LivecrawlOptions;\n /**\n * @deprecated Use `text` or `highlights` instead.\n */\n context?: ContextOptions | true;\n livecrawlTimeout?: number;\n maxAgeHours?: number;\n snapshotAsOf?: string;\n filterEmptyResults?: boolean;\n subpages?: number;\n subpageTarget?: string | string[];\n extras?: ExtrasOptions;\n};\n\n/**\n * Contents options for search requests: `ContentsOptions`, with subpage\n * crawling deprecated. To crawl subpages, pass the result URLs to\n * `getContents()` with `subpages`.\n */\ntype SearchContentsOptions = Omit<\n ContentsOptions,\n \"subpages\" | \"subpageTarget\"\n> & {\n /**\n * DEPRECATED: Subpage crawling on search is deprecated. Use `getContents()` with `subpages` instead.\n * @deprecated Use `getContents()` with `subpages` instead.\n */\n subpages?: number;\n /**\n * DEPRECATED: Subpage crawling on search is deprecated. Use `getContents()` with `subpageTarget` instead.\n * @deprecated Use `getContents()` with `subpageTarget` instead.\n */\n subpageTarget?: string | string[];\n};\n\nexport type { RequestOptions, TransportRequestOptions };\n\n/**\n * The end user's location, as a two-letter ISO 3166-1 country code (e.g.\n * `\"US\"`) or an object with `country`, a `latitude` and `longitude` pair, or\n * both. `latitude` (-90 to 90) and `longitude` (-180 to 180) are in decimal\n * degrees.\n *\n * The country localizes results. Coordinates are used only for queries that\n * name no place but depend on where the user is, such as \"coffee near me\".\n * They do not set a country, so send `country` with them to localize results.\n * Send only the precision your use case needs.\n */\nexport type UserLocation =\n | string\n | { country: string; latitude?: never; longitude?: never }\n | { country?: string; latitude: number; longitude: number };\n\n/**\n * Options that attribute a request to one end user of your application.\n * @typedef {Object} UserIdentifierOptions\n * @property {string} [userIdentifier] - An opaque ID you assign to the end user the request is made for. See {@link UserIdentifierOptions}.\n */\nexport type UserIdentifierOptions = {\n /**\n * An opaque ID you assign to the end user this request is made for, such\n * as a UUID, used to attribute usage to that end user. Must not contain\n * personal information such as an email address, phone number, username or\n * name. Hash such values before sending them. 1 to 64 characters: letters,\n * digits, `_` and `-`. Retained even when your team has Zero Data\n * Retention enabled. Does not affect results.\n */\n userIdentifier?: string;\n};\n\n/**\n * The request a warning is about, passed to a `warnings` handler with each\n * warning.\n */\nexport type ApiWarningContext = {\n /** API path the request was sent to, such as `/search`. */\n endpoint: string;\n /** HTTP method of the request, in upper case, such as `POST`. */\n method: string;\n /** The request's id, when the response carried one. */\n requestId?: string;\n};\n\n/**\n * What an `Exa` client does with the warnings the API returns about a request,\n * such as a field it ignores.\n * - `\"log\"` (default): print each warning with `console.warn`, once per process\n * for each endpoint, code and path, as\n * `[exa] POST /search IGNORED_FIELD at /startCrawlDate: ...`.\n * - `\"silent\"`: print nothing.\n * - A function: called with every warning of every response, and the request\n * it is about, instead of printing. For example, to route warnings to your\n * own logger.\n *\n * The client reports the warnings of every endpoint that returns them. Today\n * that is `/search`, including `streamSearch`. A response keeps its own\n * `warnings` in every mode.\n */\nexport type WarningsOption =\n | \"log\"\n | \"silent\"\n | ((warning: ApiWarning, context: ApiWarningContext) => void);\n\n/**\n * Client-wide settings, given as the third argument of the `Exa` constructor.\n */\nexport type ExaClientOptions = {\n /**\n * Default timeout in milliseconds for every request this client makes. A\n * per-call `timeout` overrides it. Unset by default, in which case the SDK\n * imposes no timeout of its own.\n */\n timeout?: number | undefined;\n /**\n * What the client does with the warnings the API returns about a request.\n * Defaults to `\"log\"`: each warning is printed once per process for each\n * endpoint, code and path. See {@link WarningsOption}.\n */\n warnings?: WarningsOption | undefined;\n};\n\n/** Receives each warning with the request it is about. */\ntype WarningHandler = (warning: ApiWarning, context: ApiWarningContext) => void;\n\n/** `METHOD endpoint code path` of each warning the `\"log\"` mode printed in this process. */\nconst loggedWarnings = new Set<string>();\n\n/** Prints a warning with `console.warn`, once per process for each endpoint, code and path. */\nfunction logWarningOnce(warning: ApiWarning, context: ApiWarningContext): void {\n const request = `${context.method} ${context.endpoint}`;\n const key = `${request} ${warning.code} ${warning.path}`;\n if (loggedWarnings.has(key)) {\n return;\n }\n loggedWarnings.add(key);\n console.warn(\n `[exa] ${request} ${warning.code} at ${warning.path}: ${warning.message}`\n );\n}\n\n/**\n * The handler a client gives each warning for its `warnings` option, or\n * undefined for `\"silent\"`.\n * @throws {TypeError} When the option is not `\"log\"`, `\"silent\"` or a function.\n */\nfunction warningHandlerFor(\n option: WarningsOption | undefined\n): WarningHandler | undefined {\n if (option === undefined || option === \"log\") {\n return logWarningOnce;\n }\n if (option === \"silent\") {\n return undefined;\n }\n if (typeof option === \"function\") {\n return option;\n }\n throw new TypeError(\n `options.warnings must be \"log\", \"silent\" or a function, got ${JSON.stringify(option)}`\n );\n}\n\n/**\n * Endpoints whose responses carry a top-level `warnings` array of\n * {@link ApiWarning}s. The client reads `warnings` from these alone, because\n * other endpoints use the name for other shapes: agent monitor refresh events\n * carry `warnings` as strings.\n */\nconst BODY_WARNING_ENDPOINTS: ReadonlySet<string> = new Set([\"/search\"]);\n\n/** Whether a value has the string `code`, `path` and `message` of an {@link ApiWarning}. */\nfunction isApiWarning(value: unknown): value is ApiWarning {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const { code, path, message } = value as Record<string, unknown>;\n return (\n typeof code === \"string\" &&\n typeof path === \"string\" &&\n typeof message === \"string\"\n );\n}\n\n/** The well-formed warnings in a response body or stream payload from `endpoint`. */\nfunction bodyWarnings(endpoint: string, body: unknown): ApiWarning[] {\n if (\n !BODY_WARNING_ENDPOINTS.has(endpoint) ||\n typeof body !== \"object\" ||\n body === null\n ) {\n return [];\n }\n const { warnings } = body as { warnings?: unknown };\n return Array.isArray(warnings) ? warnings.filter(isApiWarning) : [];\n}\n\n/**\n * Options for performing a search query\n * @typedef {Object} SearchOptions\n * @property {ContentsOptions | boolean} [contents] - Options for retrieving page contents for each result returned. Default is { text: { maxCharacters: 10_000 } }.\n * @property {number} [numResults] - Number of search results to return. Default 10.\n * @property {string[]} [includeDomains] - List of domains to include in the search.\n * @property {string[]} [excludeDomains] - List of domains to exclude in the search.\n * @property {string} [startCrawlDate] - Deprecated and will be removed in a future release. Start date for results based on crawl date.\n * @property {string} [endCrawlDate] - Deprecated and will be removed in a future release. End date for results based on crawl date.\n * @property {string} [startPublishedDate] - Start date for results based on published date.\n * @property {string} [endPublishedDate] - End date for results based on published date.\n * @property {string} [category] - A data category to focus on, with higher comprehensivity and data cleanliness.\n * @property {string[]} [includeText] - List of strings that must be present in webpage text of results. Currently only supports 1 string of up to 5 words.\n * @property {string[]} [excludeText] - List of strings that must not be present in webpage text of results. Currently only supports 1 string of up to 5 words.\n * @property {string[]} [flags] - Experimental flags\n * @property {UserLocation} [userLocation] - The end user's location, as a two-letter ISO 3166-1 country code or an object. See {@link UserLocation}.\n * @property {boolean} [stream] - Whether to stream back OpenAI-style chat completion chunks. Use `streamSearch()` instead of `search({ stream: true })`.\n * @property {AbortSignal} [signal] - AbortSignal to cancel the underlying HTTP request.\n * @property {number} [timeout] - Request timeout in milliseconds.\n */\nexport type BaseSearchOptions = TransportRequestOptions & {\n contents?: SearchContentsOptions;\n numResults?: number;\n includeDomains?: string[];\n excludeDomains?: string[];\n /** @deprecated Will be removed in a future release. Do not use in new code. */\n startCrawlDate?: string;\n /** @deprecated Will be removed in a future release. Do not use in new code. */\n endCrawlDate?: string;\n startPublishedDate?: string;\n endPublishedDate?: string;\n category?:\n | \"company\"\n | \"publication\"\n | \"news\"\n | \"personal site\"\n | \"financial report\"\n | \"people\";\n includeText?: string[];\n excludeText?: string[];\n flags?: string[];\n userLocation?: UserLocation;\n stream?: boolean;\n};\n\n/**\n * Base search options shared across all search types\n */\ntype BaseRegularSearchOptions = BaseSearchOptions & {\n /**\n * The broader goal this search serves: the task the caller is working on,\n * beyond the query itself. When an agent picks the query as one step of a\n * larger task, pass the goal of that step — which documents should rank\n * first, which should be excluded, and what to pull from them. Up to 4096\n * characters.\n */\n objective?: string;\n /**\n * An opaque ID you assign to the end user this request is made for, such\n * as a UUID, used to attribute usage to that end user. Must not contain\n * personal information such as an email address, phone number, username or\n * name. Hash such values before sending them. 1 to 64 characters: letters,\n * digits, `_` and `-`. Retained even when your team has Zero Data\n * Retention enabled. Does not affect results.\n */\n userIdentifier?: string;\n /**\n * If true, the search results are moderated for safety.\n */\n moderation?: boolean;\n /**\n * @deprecated No longer supported and ignored by the API. Remove it from\n * the request.\n */\n useAutoprompt?: boolean;\n /**\n * Additional instructions that guide both the search process and the final returned synthesis.\n * Use this to prefer certain sources, emphasize novelty, avoid duplicates, or constrain output style.\n */\n systemPrompt?: string;\n /**\n * Output schema for search responses. When provided, the API returns synthesized output in `output`.\n * - `type: \"text\"` for plain text output (optionally guided by `description`)\n * - `type: \"object\"` for structured JSON output\n *\n * Note: For object schemas, the API enforces max depth 2 and max 10 total properties.\n */\n outputSchema?: DeepOutputSchema;\n};\n\n/**\n * Deep search types. We recommend `\"deep\"`. `\"deep-reasoning\"` is a legacy\n * search type that is still accepted. Instead of `\"deep-reasoning\"`, use\n * `\"deep\"`, or Exa Agent for long-running research, list building and\n * multi-hop enrichment. Start an Exa Agent run with `exa.agent.runs.create`.\n */\nexport type DeepSearchType = \"deep-lite\" | \"deep\" | \"deep-reasoning\";\n\n/**\n * Deep search output schema mode for plain text responses.\n */\nexport type DeepTextOutputSchema = {\n type: \"text\";\n /**\n * Optional formatting guidance for text output.\n */\n description?: string;\n};\n\n/**\n * Deep search output schema mode for structured JSON object responses.\n */\nexport type DeepObjectOutputSchema = {\n type: \"object\";\n /**\n * JSON-schema-style properties for the result object.\n */\n properties?: Record<string, unknown>;\n /**\n * Required property names.\n */\n required?: string[];\n};\n\n/**\n * Search output schema.\n * - `type: \"text\"` returns plain text in `output.content` (with optional description guidance).\n * - `type: \"object\"` returns structured JSON in `output.content`.\n *\n * Note: For object schemas, the API enforces a maximum nesting depth of 2 and a maximum of 10 total properties.\n */\nexport type DeepOutputSchema = DeepTextOutputSchema | DeepObjectOutputSchema;\n\n/**\n * Contents options for deep search.\n */\ntype DeepContentsOptions = Omit<SearchContentsOptions, \"context\"> & {\n /**\n * @deprecated Use `text` or `highlights` instead.\n */\n context?: ContextOptions | true;\n};\n\n/**\n * Search options for deep search types, which additionally support additional queries.\n */\ntype DeepSearchOptions = Omit<BaseRegularSearchOptions, \"contents\"> & {\n /**\n * The deep search type. We recommend `\"deep\"`. `\"deep-reasoning\"` is a\n * legacy search type that is still accepted. Instead of `\"deep-reasoning\"`,\n * use `\"deep\"`, or Exa Agent for long-running research, list building and\n * multi-hop enrichment. Start an Exa Agent run with `exa.agent.runs.create`.\n */\n type: DeepSearchType;\n /**\n * Alternative query formulations for deep search variants to skip automatic LLM-based query expansion.\n * Max 5 queries.\n * @example [\"machine learning\", \"ML algorithms\", \"neural networks\"]\n */\n additionalQueries?: string[];\n /**\n * Options for retrieving page contents.\n */\n contents?: DeepContentsOptions;\n};\n\n/**\n * Non-deep search types.\n */\ntype NonDeepSearchType =\n | \"keyword\"\n | \"neural\"\n | \"auto\"\n | \"hybrid\"\n | \"fast\"\n | \"instant\"\n | \"lite\";\n\n/**\n * Search options for non-deep search types (keyword, neural, auto, hybrid,\n * fast, instant, lite) and for any other search type string.\n */\ntype NonDeepSearchOptions = BaseRegularSearchOptions & {\n /**\n * The search type. We recommend `\"lite\"`, `\"auto\"` (the default) and, for\n * deep search, `\"deep\"`. `\"lite\"` (beta) is a low-cost search that supports\n * a reduced set of parameters.\n *\n * `\"fast\"` and `\"instant\"` are legacy search types. They are still accepted;\n * for new code, use `\"lite\"` instead of `\"instant\"`, and `\"lite\"` instead of\n * `\"fast\"`, or `\"auto\"` when the request needs parameters `\"lite\"` rejects.\n *\n * Any other string is passed through to the API as given.\n */\n type?: NonDeepSearchType | (string & {});\n};\n\n/**\n * Search options for performing a search query.\n * Uses a discriminated union to ensure additionalQueries is only allowed when type is a deep search variant.\n */\nexport type RegularSearchOptions = DeepSearchOptions | NonDeepSearchOptions;\n\n/**\n * Search options accepted by `streamSearch`: every search type except `lite`, which does not support streaming.\n *\n * `Type` is inferred from the `type` a caller passes, which lets any search\n * type string through except `\"lite\"`.\n */\ntype StreamSearchOptions<Type extends string = never> =\n | DeepSearchOptions\n | (Omit<NonDeepSearchOptions, \"type\"> & {\n type?:\n | Exclude<NonDeepSearchType, \"lite\">\n | (Type extends \"lite\" ? never : Type);\n });\n\n/**\n * Options for opting into Exa-Beta features.\n * @typedef {Object} BetaOptions\n * @property {string[]} [betas] - Exa-Beta tokens to send with the request (e.g. `[DYNAMIC_HIGHLIGHTS_BETA]` for Dynamic Highlights).\n */\nexport type BetaOptions = {\n betas?: string[];\n};\n\n/**\n * Options for `findSimilar()`.\n * @deprecated Use `search()` instead. There is no direct replacement for URL-based similarity.\n * @typedef {Object} FindSimilarOptions\n * @property {boolean} [excludeSourceDomain] - If true, excludes links from the base domain of the input.\n */\nexport type FindSimilarOptions = BaseSearchOptions & {\n excludeSourceDomain?: boolean;\n};\n\nexport type ExtrasOptions = { links?: number; imageLinks?: number };\n\n/**\n * Options for livecrawling contents\n * @typedef {string} LivecrawlOptions\n */\nexport type LivecrawlOptions =\n | \"never\"\n | \"fallback\"\n | \"always\"\n | \"auto\"\n | \"preferred\";\n\n/**\n * Verbosity levels for content filtering.\n * - compact: Most concise output, main content only (default)\n * - standard: Balanced content with more detail\n * - full: Complete content including all sections\n */\nexport type VerbosityOptions = \"compact\" | \"standard\" | \"full\";\n\n/**\n * Section tags for semantic content filtering.\n */\nexport type SectionTag =\n | \"unspecified\"\n | \"header\"\n | \"navigation\"\n | \"banner\"\n | \"body\"\n | \"sidebar\"\n | \"footer\"\n | \"metadata\";\n\n/**\n * Options for retrieving text from page.\n * @typedef {Object} TextContentsOptions\n * @property {number} [maxCharacters] - The maximum number of characters to return.\n * @property {boolean} [includeHtmlTags] - If true, includes HTML tags in the returned text. Default: false\n * @property {VerbosityOptions} [verbosity] - Controls verbosity level of returned content. Default: \"compact\". Requires maxAgeHours: 0.\n * @property {SectionTag[]} [includeSections] - Only include content from these semantic sections. Requires maxAgeHours: 0.\n * @property {SectionTag[]} [excludeSections] - Exclude content from these semantic sections. Requires maxAgeHours: 0.\n */\nexport type TextContentsOptions = {\n maxCharacters?: number;\n includeHtmlTags?: boolean;\n verbosity?: VerbosityOptions;\n includeSections?: SectionTag[];\n excludeSections?: SectionTag[];\n};\n\n/**\n * Overrides for highlights. Prefer `highlights: true`: Exa dynamically\n * chooses the number of characters based on each document's relevance\n * to your query. A request for concise context does not require setting\n * a fixed character budget.\n * Deep search variants also support these options for returned highlights.\n * @typedef {Object} HighlightsContentsOptions\n * @property {string} [query] - The query string to use for highlights search.\n * @property {number} [maxCharacters] - Explicit character-limit override. Prefer `highlights: true` unless your application requires a specific limit. Not compatible with `dynamic`.\n * @property {boolean} [dynamic] - Enable Dynamic Highlights (research preview): allocates one shared context budget across all results instead of a per-document budget; the model sizes the output itself. Not compatible with `maxCharacters`. Beta: requires passing `betas: [DYNAMIC_HIGHLIGHTS_BETA]` to the request.\n * @property {number} [numSentences] - DEPRECATED: Use maxCharacters instead.\n * @property {number} [highlightsPerUrl] - DEPRECATED: Use maxCharacters instead.\n */\nexport type HighlightsContentsOptions = {\n query?: string;\n /**\n * Override for an explicit application character limit. Prefer\n * `highlights: true` to let Exa choose the length based on relevance.\n * A general need for concise context does not require a fixed limit.\n */\n maxCharacters?: number;\n dynamic?: boolean;\n /**\n * @deprecated Use `maxCharacters` instead.\n */\n numSentences?: number;\n /**\n * @deprecated Use `maxCharacters` instead.\n */\n highlightsPerUrl?: number;\n};\n/**\n * Options for retrieving summary from page.\n * @typedef {Object} SummaryContentsOptions\n * @property {string} [query] - The query string to use for summary generation.\n * @property {Record<string, unknown> | ZodSchema} [schema] - JSON schema for structured output from summary.\n */\nexport type SummaryContentsOptions = {\n query?: string;\n schema?: Record<string, unknown> | ZodSchema;\n};\n\n/**\n * @deprecated Use `Record<string, unknown>` instead.\n */\nexport type JSONSchema = Record<string, unknown>;\n\n/**\n * @deprecated Use `text` or `highlights` instead.\n *\n * Options for retrieving the context from a list of search results. The context is a string\n * representation of all the search results.\n * @typedef {Object} ContextOptions\n * @property {number} [maxCharacters] - The maximum number of characters.\n */\nexport type ContextOptions = {\n maxCharacters?: number;\n};\n\n/**\n * @typedef {Object} TextResponse\n * @property {string} text - Text from page\n */\nexport type TextResponse = { text: string };\n\n/**\n * @typedef {Object} HighlightsResponse\n * @property {string[]} highlights - The highlights as an array of strings.\n * @property {number[]} [highlightScores] - The corresponding scores as an array of floats, 0 to 1\n */\nexport type HighlightsResponse = {\n highlights: string[];\n highlightScores?: number[];\n};\n\n/**\n * @typedef {Object} SummaryResponse\n * @property {string} summary - The generated summary of the page content.\n */\nexport type SummaryResponse = { summary: string };\n\n/**\n * @typedef {Object} ExtrasResponse\n * @property {string[]} links - The links on the page of a result\n * @property {string[]} imageLinks - The image links on the page of a result\n */\nexport type ExtrasResponse = {\n extras: { links?: string[]; imageLinks?: string[] };\n};\n\n/**\n * @typedef {Object} SubpagesResponse\n * @property {ContentsResultComponent<T extends ContentsOptions>} subpages - The subpages for a result\n */\nexport type SubpagesResponse<T extends ContentsOptions> = {\n subpages: ContentsResultComponent<T>[];\n};\n\nexport type Default<T extends {}, U> = [keyof T] extends [never] ? U : T;\n\n/**\n * @typedef {Object} ContentsResultComponent\n * Depending on 'ContentsOptions', this yields a combination of 'TextResponse', 'HighlightsResponse', 'SummaryResponse', or an empty object.\n *\n * @template T - A type extending from 'ContentsOptions'.\n */\nexport type ContentsResultComponent<T extends ContentsOptions> =\n (T[\"text\"] extends object | true ? TextResponse : {}) &\n (T[\"highlights\"] extends object | true ? HighlightsResponse : {}) &\n (T[\"summary\"] extends object | true ? SummaryResponse : {}) &\n (T[\"subpages\"] extends number ? SubpagesResponse<T> : {}) &\n (T[\"extras\"] extends object ? ExtrasResponse : {});\n\n/**\n * Represents the cost breakdown related to contents retrieval. Fields are optional because\n * only non-zero costs are included.\n * @typedef {Object} CostDollarsContents\n * @property {number} [text] - The cost in dollars for retrieving text.\n * @property {number} [highlights] - The cost in dollars for retrieving highlights.\n * @property {number} [summary] - The cost in dollars for retrieving summary.\n */\nexport type CostDollarsContents = {\n text?: number;\n highlights?: number;\n summary?: number;\n};\n\n/**\n * Represents the cost breakdown related to search. Fields are optional because\n * only non-zero costs are included.\n * @typedef {Object} CostDollarsSeearch\n * @property {number} [neural] - The cost in dollars for neural search.\n * @property {number} [keyword] - The cost in dollars for keyword search.\n */\nexport type CostDollarsSeearch = {\n neural?: number;\n keyword?: number;\n};\n\n/**\n * Represents the total cost breakdown. Only non-zero costs are included.\n * @typedef {Object} CostDollars\n * @property {number} total - The total cost in dollars.\n * @property {CostDollarsSeearch} [search] - The cost breakdown for search.\n * @property {CostDollarsContents} [contents] - The cost breakdown for contents.\n */\nexport type CostDollars = {\n total: number;\n search?: CostDollarsSeearch;\n contents?: CostDollarsContents;\n};\n\n/**\n * Entity types for company/people search results.\n * Only returned when using category=company or category=people searches.\n */\n\n/** Company workforce information. */\nexport type EntityCompanyPropertiesWorkforce = {\n total?: number | null;\n};\n\n/** Company headquarters information. */\nexport type EntityCompanyPropertiesHeadquarters = {\n address?: string | null;\n city?: string | null;\n postalCode?: string | null;\n country?: string | null;\n};\n\n/** Funding round information. */\nexport type EntityCompanyPropertiesFundingRound = {\n name?: string | null;\n date?: string | null;\n amount?: number | null;\n};\n\n/** Company financial information. */\nexport type EntityCompanyPropertiesFinancials = {\n revenueAnnual?: number | null;\n fundingTotal?: number | null;\n fundingLatestRound?: EntityCompanyPropertiesFundingRound | null;\n};\n\n/** Company web traffic information. */\nexport type EntityCompanyPropertiesWebTraffic = {\n visitsMonthly?: number | null;\n};\n\n/** Structured properties for a company entity. */\nexport type EntityCompanyProperties = {\n name?: string | null;\n foundedYear?: number | null;\n description?: string | null;\n workforce?: EntityCompanyPropertiesWorkforce | null;\n headquarters?: EntityCompanyPropertiesHeadquarters | null;\n financials?: EntityCompanyPropertiesFinancials | null;\n webTraffic?: EntityCompanyPropertiesWebTraffic | null;\n};\n\n/** Date range for work history entries. */\nexport type EntityDateRange = {\n from?: string | null;\n to?: string | null;\n};\n\n/** Reference to a company in work history. */\nexport type EntityPersonPropertiesCompanyRef = {\n id?: string | null;\n name?: string | null;\n};\n\n/** A single work history entry for a person. */\nexport type EntityPersonPropertiesWorkHistoryEntry = {\n title?: string | null;\n location?: string | null;\n dates?: EntityDateRange | null;\n company?: EntityPersonPropertiesCompanyRef | null;\n};\n\n/** Reference to an institution in education history. */\nexport type EntityPersonPropertiesInstitutionRef = {\n id?: string | null;\n name?: string | null;\n};\n\n/** A single education history entry for a person. */\nexport type EntityPersonPropertiesEducationHistoryEntry = {\n degree?: string | null;\n dates?: EntityDateRange | null;\n institution?: EntityPersonPropertiesInstitutionRef | null;\n};\n\n/** A notable publication by a person. */\nexport type EntityPersonPropertiesNotableWork = {\n title?: string | null;\n year?: number | null;\n venue?: string | null;\n citationCount?: number | null;\n doi?: string | null;\n id?: string | null;\n type?: string | null;\n};\n\n/** Research information for a person. */\nexport type EntityPersonPropertiesResearch = {\n worksCount?: number | null;\n citationCount?: number | null;\n hIndex?: number | null;\n firstPublicationYear?: number | null;\n latestPublicationYear?: number | null;\n areas?: string[];\n notableWorks?: EntityPersonPropertiesNotableWork[];\n};\n\n/** Structured properties for a person entity. */\nexport type EntityPersonProperties = {\n name?: string | null;\n firstName?: string | null;\n lastName?: string | null;\n location?: string | null;\n workHistory?: EntityPersonPropertiesWorkHistoryEntry[];\n educationHistory?: EntityPersonPropertiesEducationHistoryEntry[];\n research?: EntityPersonPropertiesResearch | null;\n};\n\n/** Structured entity data for a company. */\nexport type CompanyEntity = {\n id: string;\n type: \"company\";\n version: number;\n properties: EntityCompanyProperties;\n};\n\n/** Structured entity data for a person. */\nexport type PersonEntity = {\n id: string;\n type: \"person\";\n version: number;\n properties: EntityPersonProperties;\n};\n\n/** Structured entity data for company or person search results. */\nexport type Entity = CompanyEntity | PersonEntity;\n\n/**\n * Represents a search result object.\n * @typedef {Object} SearchResult\n * @property {string} title - The title of the search result.\n * @property {string} url - The URL of the search result.\n * @property {string} [publishedDate] - The estimated creation date of the content.\n * @property {string} [author] - The author of the content, if available.\n * @property {number} [score] - Similarity score between the query/url and the result.\n * @property {string} id - The temporary ID for the document.\n * @property {string} [image] - A representative image for the content, if any.\n * @property {string} [favicon] - A favicon for the site, if any.\n * @property {string} [snapshotAt] - Crawl instant of the stored version served for a snapshotAsOf request.\n * @property {Entity[]} [entities] - Structured entity data for company or person search results.\n */\nexport type SearchResult<T extends ContentsOptions> = {\n title: string | null;\n url: string;\n publishedDate?: string;\n author?: string;\n score?: number;\n id: string;\n image?: string;\n favicon?: string;\n snapshotAt?: string;\n entities?: Entity[];\n} & ContentsResultComponent<T>;\n\nexport type DeepSearchOutputGroundingCitation = {\n url: string;\n title: string;\n};\n\nexport type DeepSearchOutputGroundingConfidence = \"low\" | \"medium\" | \"high\";\n\nexport type DeepSearchOutputGrounding = {\n field: string;\n citations: DeepSearchOutputGroundingCitation[];\n confidence: DeepSearchOutputGroundingConfidence;\n};\n\nexport type DeepSearchOutput = {\n content: string | Record<string, unknown>;\n grounding: DeepSearchOutputGrounding[];\n};\n\n/**\n * Known `ApiWarning` codes. The set is open, so handle codes you do not know.\n * - `IGNORED_FIELD`: the field at `path` is accepted and has no effect on the request.\n */\nexport type ApiWarningCode = \"IGNORED_FIELD\" | (string & {});\n\n/**\n * A warning the API returns about a request, such as a field it ignores. A\n * warning never changes the status code or the result. It is for whoever owns\n * the code that builds the request: fix the request, and do not pass the\n * warning to a model.\n */\nexport type ApiWarning = {\n /** Machine-readable code in UPPER_SNAKE case, such as `IGNORED_FIELD`. */\n code: ApiWarningCode;\n /** JSON Pointer to the request field the warning is about, such as `/startCrawlDate`. */\n path: string;\n /** What to change in the request, in plain words. */\n message: string;\n};\n\n/** Known `SearchWarning` codes: the {@link ApiWarningCode}s. */\nexport type SearchWarningCode = ApiWarningCode;\n\n/** A warning about a search request: an {@link ApiWarning}. */\nexport type SearchWarning = ApiWarning;\n\n/**\n * Known `SearchNotice` codes. The set is open, so handle codes you do not know.\n * - `RESTRICTIONS_RELAXED`: no results matched a restriction in the query, such as `site:` or an exact phrase, so the results come from a search with it removed.\n */\nexport type SearchNoticeCode = \"RESTRICTIONS_RELAXED\" | (string & {});\n\n/**\n * A note about how the results of a search were produced, such as a query\n * restriction relaxed to return results. A notice is written to be shown to a\n * model. Pass its `message` to the model that reads the results.\n */\nexport type SearchNotice = {\n /** Machine-readable code in UPPER_SNAKE case, such as `RESTRICTIONS_RELAXED`. */\n code: SearchNoticeCode;\n /** JSON Pointer to the request field the notice is about, such as `/query`. */\n path: string;\n /** Complete on its own and written to be shown to a model. */\n message: string;\n /** Optional extra context. No schema is promised for its keys, and it never carries information that `message` lacks. */\n details?: Record<string, unknown>;\n};\n\n/**\n * Represents a search response object.\n * @typedef {Object} SearchResponse\n * @property {Result[]} results - The list of search results.\n * @property {string} [context] - Deprecated. Use `text` or `highlights` on individual results.\n * @property {DeepSearchOutput} [output] - Search synthesized output object returned when `outputSchema` is provided.\n * @property {string} [autoDate] - The autoprompt date, if applicable.\n * @property {string} requestId - The request ID for the search.\n * @property {CostDollars} [costDollars] - The cost breakdown for this request.\n * @property {string} [resolvedSearchType] - The resolved search type ('neural' or 'keyword') when using 'auto' search.\n * @property {number} [searchTime] - Time taken for the search in milliseconds.\n * @property {SearchWarning[]} [warnings] - Notes about the search request, such as a field the API ignores. Absent when there are none.\n * @property {SearchNotice[]} [notices] - Notes about how the results were produced, written to be shown to a model. Absent when there are none.\n */\nexport type SearchResponse<T extends ContentsOptions> = {\n results: SearchResult<T>[];\n /**\n * @deprecated Use `text` or `highlights` on individual results instead.\n */\n context?: string;\n output?: DeepSearchOutput;\n autoDate?: string;\n requestId: string;\n statuses?: Array<Status>;\n costDollars?: CostDollars;\n resolvedSearchType?: string;\n searchTime?: number;\n /**\n * Notes about the search request, such as a field the API ignores. Returned\n * by `search` only, and absent when there are none.\n */\n warnings?: SearchWarning[];\n /**\n * Notes about how the results were produced, such as a query restriction\n * relaxed to return results. Written to be shown to a model. Returned by\n * `search` only, and absent when there are none.\n */\n notices?: SearchNotice[];\n};\n\n/** Error details for a failed content retrieval. */\nexport type ContentStatusError = {\n tag?: string;\n httpStatusCode?: number | null;\n};\n\n/** Status information for a requested URL. */\nexport type Status = {\n id: string;\n status: string;\n source?: string;\n error?: ContentStatusError | null;\n};\n\n/**\n * Options for the answer endpoint\n * @typedef {Object} AnswerOptions\n * @property {boolean} [stream] - Whether to stream the response. Default false.\n * @property {boolean} [text] - Whether to include text in the source results. Default false.\n * @property {\"exa\"} [model] - The model to use for generating the answer. Default \"exa\".\n * @property {string} [systemPrompt] - A system prompt to guide the LLM's behavior when generating the answer.\n * @property {Object} [outputSchema] - A JSON Schema specification for the structure you expect the output to take\n * @property {UserLocation} [userLocation] - The end user's location, as a two-letter ISO 3166-1 country code or an object. See {@link UserLocation}.\n * @property {string} [userIdentifier] - An opaque ID you assign to the end user the request is made for. See {@link UserIdentifierOptions}.\n * @property {AbortSignal} [signal] - AbortSignal to cancel the underlying HTTP request.\n * @property {number} [timeout] - Request timeout in milliseconds.\n */\nexport type AnswerOptions = UserIdentifierOptions & TransportRequestOptions & {\n stream?: boolean;\n text?: boolean;\n model?: \"exa\";\n systemPrompt?: string;\n outputSchema?: Record<string, unknown>;\n userLocation?: UserLocation;\n};\n\n/**\n * Represents an answer response object from the /answer endpoint.\n * @typedef {Object} AnswerResponse\n * @property {string | Object} answer - The generated answer text (or an object matching `outputSchema`, if provided)\n * @property {SearchResult<{}>[]} citations - The sources used to generate the answer.\n * @property {CostDollars} [costDollars] - The cost breakdown for this request.\n * @property {string} [requestId] - Optional request ID for the answer.\n */\nexport type AnswerResponse = {\n answer: string | Record<string, unknown>;\n citations: SearchResult<{}>[];\n requestId?: string;\n costDollars?: CostDollars;\n};\n\nexport type AnswerStreamChunk = {\n /**\n * The partial text content of the answer (if present in this chunk).\n */\n content?: string;\n /**\n * Citations associated with the current chunk of text (if present).\n */\n citations?: Array<{\n id: string;\n url: string;\n title?: string;\n publishedDate?: string;\n author?: string;\n text?: string;\n }>;\n};\n\n/**\n * One chunk of a `streamSearch` response, with partial text (`content`), new\n * citations, or the request's `warnings`.\n */\nexport type SearchStreamChunk = AnswerStreamChunk & {\n /**\n * Notes about the search request, such as a field the API ignores. When the\n * API returns any, they arrive on one chunk of their own, after the streamed\n * text.\n */\n warnings?: SearchWarning[];\n};\n\n/**\n * Represents a streaming answer response chunk from the /answer endpoint.\n * @typedef {Object} AnswerStreamResponse\n * @property {string} [answer] - A chunk of the generated answer text.\n * @property {SearchResult<{}>[]]} [citations] - The sources used to generate the answer.\n */\nexport type AnswerStreamResponse = {\n answer?: string;\n citations?: SearchResult<{}>[];\n};\n\n// ==========================================\n// Zod-Enhanced Types\n// ==========================================\n\n/**\n * Enhanced answer options that accepts either JSON schema or Zod schema\n */\nexport type AnswerOptionsTyped<T> = Omit<AnswerOptions, \"outputSchema\"> & {\n outputSchema: T;\n};\n\n/**\n * Enhanced answer response with strongly typed answer when using Zod\n */\nexport type AnswerResponseTyped<T> = Omit<AnswerResponse, \"answer\"> & {\n answer: T;\n};\n\n/**\n * Enhanced summary contents options that accepts either JSON schema or Zod schema\n */\nexport type SummaryContentsOptionsTyped<T> = Omit<\n SummaryContentsOptions,\n \"schema\"\n> & {\n schema: T;\n};\n\n/**\n * Returns contents options with a Zod `summary.schema` converted to JSON Schema,\n * the form the API accepts. Any other value is returned unchanged.\n */\nfunction withJsonSummarySchema<T>(contents: T): T {\n if (typeof contents !== \"object\" || contents === null) return contents;\n const summary: unknown = (contents as { summary?: unknown }).summary;\n if (typeof summary !== \"object\" || summary === null) return contents;\n const schema: unknown = (summary as { schema?: unknown }).schema;\n if (!isZodSchema(schema)) return contents;\n return {\n ...contents,\n summary: { ...summary, schema: zodToJsonSchema(schema) },\n };\n}\n\n/**\n * The Exa class encapsulates the API's endpoints.\n */\nexport class Exa {\n private baseURL: string;\n private headers: Headers;\n /** Client-wide transport defaults; a per-call option overrides each field. */\n\n /**\n * Websets API client\n */\n websets: WebsetsClient;\n\n /**\n * Research API client\n */\n research: ResearchClient;\n\n /**\n * Search Monitors API client\n */\n monitors: SearchMonitorsClient;\n\n /**\n * Agent API client\n */\n agent: AgentClient;\n\n /**\n * Beta API clients\n */\n beta: BetaClient;\n\n /** Provider-neutral Exa tools. */\n tools: ToolNamespace;\n\n /** OpenAI Chat Completions and Responses API tools. */\n openai: OpenAITools;\n\n /** Anthropic Messages API tools. */\n anthropic: AnthropicTools;\n\n private readonly toolRegistry = new ToolRegistry();\n /** Receives each warning the API returns; undefined when `warnings` is `\"silent\"`. */\n private readonly warningHandler: WarningHandler | undefined;\n\n /**\n * Hands each warning in a response body or stream payload to the `warnings`\n * option's handler. `request` calls it for every JSON response and\n * `streamChatCompletions` for every stream payload, so every endpoint\n * reports through here.\n */\n private reportWarnings(\n endpoint: string,\n method: string,\n body: unknown,\n requestIdHeader: string | null\n ): void {\n if (!this.warningHandler) {\n return;\n }\n const warnings = bodyWarnings(endpoint, body);\n if (warnings.length === 0) {\n return;\n }\n const bodyRequestId = (body as { requestId?: unknown }).requestId;\n const requestId =\n typeof bodyRequestId === \"string\"\n ? bodyRequestId\n : (requestIdHeader ?? undefined);\n const context: ApiWarningContext = {\n endpoint,\n method: method.toUpperCase(),\n ...(requestId !== undefined && { requestId }),\n };\n for (const warning of warnings) {\n this.warningHandler(warning, context);\n }\n }\n\n /**\n * Helper method to separate out the contents-specific options from the rest.\n */\n private extractContentsOptions<T extends ContentsOptions>(\n options: T\n ): {\n contentsOptions: ContentsOptions;\n restOptions: Omit<T, keyof ContentsOptions>;\n } {\n const {\n text,\n highlights,\n summary,\n subpages,\n subpageTarget,\n extras,\n livecrawl,\n livecrawlTimeout,\n maxAgeHours,\n snapshotAsOf,\n filterEmptyResults,\n // DEPRECATED FIELD: preserve legacy `context` only for backward compatibility.\n context,\n ...rest\n } = options;\n\n const contentsOptions: ContentsOptions = {};\n\n // Default: if none of text, summary, or highlights is provided, we retrieve text\n if (\n text === undefined &&\n summary === undefined &&\n highlights === undefined &&\n extras === undefined\n ) {\n contentsOptions.text = true;\n }\n\n if (text !== undefined) contentsOptions.text = text;\n if (highlights !== undefined) contentsOptions.highlights = highlights;\n if (summary !== undefined) contentsOptions.summary = summary;\n if (subpages !== undefined) contentsOptions.subpages = subpages;\n if (subpageTarget !== undefined)\n contentsOptions.subpageTarget = subpageTarget;\n if (extras !== undefined) contentsOptions.extras = extras;\n if (livecrawl !== undefined) contentsOptions.livecrawl = livecrawl;\n if (livecrawlTimeout !== undefined)\n contentsOptions.livecrawlTimeout = livecrawlTimeout;\n if (maxAgeHours !== undefined) contentsOptions.maxAgeHours = maxAgeHours;\n if (snapshotAsOf !== undefined) contentsOptions.snapshotAsOf = snapshotAsOf;\n if (filterEmptyResults !== undefined)\n contentsOptions.filterEmptyResults = filterEmptyResults;\n // DEPRECATED FIELD: pass through only so existing callers do not break.\n if (context !== undefined) contentsOptions.context = context;\n\n return {\n contentsOptions: withJsonSummarySchema(contentsOptions),\n restOptions: rest as Omit<T, keyof ContentsOptions>,\n };\n }\n\n private buildSearchRequestBody(\n query: string,\n options?: RegularSearchOptions & {\n contents?: ContentsOptions | false | null | undefined;\n }\n ): Record<string, unknown> {\n const body = { ...omitRequestOptions(options) } as Record<string, unknown>;\n delete body.betas;\n // The method called decides whether the response streams.\n delete body.stream;\n if (options === undefined || !(\"contents\" in options)) {\n body.contents = { text: { maxCharacters: DEFAULT_MAX_CHARACTERS } };\n } else if (\n options.contents === false ||\n options.contents === null ||\n options.contents === undefined\n ) {\n delete body.contents;\n } else {\n body.contents = withJsonSummarySchema(options.contents);\n }\n return { query, ...body };\n }\n\n /**\n * Constructs the Exa API client.\n * @param {string} apiKey - The API key for authentication.\n * @param {string} [baseURL] - The base URL of the Exa API.\n * @param {ExaClientOptions} [options] - Client-wide settings (`timeout`, `warnings`).\n * @throws {RangeError} When `options.timeout` is not an integer from 1 to 2147483647.\n * @throws {TypeError} When `options.warnings` is not `\"log\"`, `\"silent\"` or a function.\n */\n constructor(\n apiKey?: string,\n baseURL: string = \"https://api.exa.ai\",\n options?: ExaClientOptions\n ) {\n this.baseURL = baseURL;\n this.warningHandler = warningHandlerFor(options?.warnings);\n setClientDefaults(\n this,\n options?.timeout === undefined\n ? undefined\n : { timeout: validateTimeout(options.timeout) }\n );\n if (!apiKey) {\n apiKey = process.env.EXA_API_KEY;\n if (!apiKey) {\n throw new ExaError(\n \"API key must be provided as an argument or as an environment variable (EXA_API_KEY)\",\n HttpStatusCode.Unauthorized\n );\n }\n }\n this.headers = new HeadersImpl({\n \"x-api-key\": apiKey,\n \"Content-Type\": \"application/json\",\n \"User-Agent\": `exa-node ${packageJson.version}`,\n });\n\n // Initialize the Websets client\n this.websets = new WebsetsClient(this);\n // Initialize the Research client\n this.research = new ResearchClient(this);\n // Initialize the Search Monitors client\n this.monitors = new SearchMonitorsClient(this);\n // Initialize the Agent client\n this.agent = new AgentClient(this);\n // Initialize beta clients\n this.beta = new BetaClient(this.agent);\n this.tools = {\n webSearch: (options) =>\n createWebSearchTool(this, this.toolRegistry, options),\n getContents: (options) =>\n createGetContentsTool(this, this.toolRegistry, options),\n };\n this.openai = new OpenAITools(this, this.toolRegistry);\n this.anthropic = new AnthropicTools(this, this.toolRegistry);\n }\n\n /**\n * Makes a request to the Exa API.\n * @param {string} endpoint - The API endpoint to call.\n * @param {string} method - The HTTP method to use.\n * @param {any} [body] - The request body for POST requests.\n * @param {Record<string, any>} [params] - The query parameters.\n * @param {Record<string, string>} [headers] - Additional request headers.\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<any>} The response from the API.\n * @throws {ExaError} When any API request fails with structured error information\n * @throws {ExaTimeoutError} When the request exceeds its `timeout`\n * @throws {ExaAbortError} When the caller's `signal` aborts the request\n */\n async request<T = unknown>(\n endpoint: string,\n method: string,\n body?: any,\n params?: Record<string, any>,\n headers?: Record<string, string>,\n requestOptions?: RequestOptions\n ): Promise<T> {\n body = mergeRequestBody(method, body, requestOptions?.body);\n params = mergeRequestQuery(params, requestOptions?.query);\n\n // Build URL with query parameters if provided\n let url = this.baseURL + endpoint;\n if (params && Object.keys(params).length > 0) {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, item);\n }\n } else if (value !== undefined) {\n searchParams.append(key, String(value));\n }\n }\n url += `?${searchParams.toString()}`;\n }\n\n let combinedHeaders: Record<string, string> = {};\n\n if (this.headers instanceof HeadersImpl) {\n this.headers.forEach((value, key) => {\n combinedHeaders[key] = value;\n });\n } else {\n combinedHeaders = { ...(this.headers as Record<string, string>) };\n }\n\n if (headers) {\n combinedHeaders = { ...combinedHeaders, ...headers };\n }\n combinedHeaders = mergeRequestHeaders(\n combinedHeaders,\n requestOptions?.headers\n );\n\n const { signal, dispose, toRequestError } = resolveRequestSignal(\n withClientDefaults(this, requestOptions)\n );\n try {\n const response = await fetchImpl(url, {\n method,\n headers: combinedHeaders,\n body: body ? JSON.stringify(body) : undefined,\n signal,\n });\n\n if (!response.ok) {\n throw await exaErrorFromResponse(response, endpoint);\n }\n\n // If the server responded with an SSE stream, parse it and return the final payload.\n const contentType = response.headers.get(\"content-type\") || \"\";\n if (contentType.includes(\"text/event-stream\")) {\n return (await this.parseSSEStream<T>(response)) as T;\n }\n\n const { json, text } = await readResponseBody(response);\n\n // A successful status with a non-JSON body usually means a proxy returned\n // an error/redirect page; surface it instead of an opaque parse error.\n if (json === undefined && text) {\n throw new ExaError(\n `Expected a JSON response but received a non-JSON body (status ${response.status}): ${truncateResponseBody(text)}`,\n response.status,\n new Date().toISOString(),\n endpoint\n );\n }\n\n this.reportWarnings(\n endpoint,\n method,\n json,\n response.headers.get(\"x-request-id\")\n );\n return json as T;\n } catch (error) {\n throw toRequestError(error, endpoint);\n } finally {\n dispose();\n }\n }\n\n /**\n * Makes a request to the Exa API and returns the raw `Response`.\n *\n * `timeout` keeps running until the response body is consumed or cancelled,\n * and a body read it or the `signal` interrupts rejects with the platform's\n * own error. The SDK's streaming methods instead stop the timeout once the\n * response headers arrive. `body`, `headers` and `query` in\n * `requestOptions` are added to the request as they are in `request`.\n *\n * @throws {ExaTimeoutError} When no response arrives within `timeout`\n * @throws {ExaAbortError} When the caller's `signal` aborts before a response arrives\n */\n async rawRequest(\n endpoint: string,\n method: string = \"POST\",\n body?: Record<string, unknown>,\n queryParams?: Record<\n string,\n string | number | boolean | string[] | undefined\n >,\n headers?: Record<string, string>,\n requestOptions?: RequestOptions\n ): Promise<Response> {\n body = mergeRequestBody(method, body, requestOptions?.body) as\n | Record<string, unknown>\n | undefined;\n queryParams = mergeRequestQuery(queryParams, requestOptions?.query);\n\n let url = this.baseURL + endpoint;\n\n if (queryParams) {\n const searchParams = new URLSearchParams();\n for (const [key, value] of Object.entries(queryParams)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, String(item));\n }\n } else if (value !== undefined) {\n searchParams.append(key, String(value));\n }\n }\n url += `?${searchParams.toString()}`;\n }\n\n let combinedHeaders: Record<string, string> = {};\n\n if (this.headers instanceof HeadersImpl) {\n this.headers.forEach((value, key) => {\n combinedHeaders[key] = value;\n });\n } else {\n combinedHeaders = { ...(this.headers as Record<string, string>) };\n }\n\n if (headers) {\n combinedHeaders = { ...combinedHeaders, ...headers };\n }\n combinedHeaders = mergeRequestHeaders(\n combinedHeaders,\n requestOptions?.headers\n );\n\n const { signal, dispose, needsDispose, stopTimeout, toRequestError } =\n resolveRequestSignal(withClientDefaults(this, requestOptions));\n try {\n const response = await fetchImpl(url, {\n method,\n headers: combinedHeaders,\n body: body ? JSON.stringify(body) : undefined,\n signal,\n });\n if (isStreamRequestOptions(requestOptions)) {\n const mapError = (error: unknown) => toRequestError(error, endpoint);\n if (!response.ok) {\n // An error response is read whole, not streamed: the timeout stays.\n return withDisposeOnBodySettled(response, dispose, mapError);\n }\n // The stream has started: only the caller's signal may end it now.\n stopTimeout();\n if (!requestOptions?.signal) {\n dispose();\n return response;\n }\n return withDisposeOnBodySettled(response, dispose, mapError);\n }\n if (!needsDispose) {\n return response;\n }\n // Hold signal listeners and the timeout until the body is consumed/cancelled.\n return withDisposeOnBodySettled(response, dispose);\n } catch (error) {\n dispose();\n throw toRequestError(error, endpoint);\n }\n }\n\n private requestWithOptions<T>(\n endpoint: string,\n method: string,\n body?: any,\n requestOptions?: RequestOptions\n ): Promise<T> {\n const transport = mergeRequestOptions(requestOptions);\n if (transport) {\n return this.request(\n endpoint,\n method,\n body,\n undefined,\n undefined,\n transport\n );\n }\n return this.request(endpoint, method, body);\n }\n\n private streamRequestWithOptions(\n endpoint: string,\n method: string,\n body?: Record<string, unknown>,\n requestOptions?: RequestOptions\n ): Promise<Response> {\n const transport = streamRequestOptions(this, requestOptions);\n if (transport) {\n return this.rawRequest(\n endpoint,\n method,\n body,\n undefined,\n undefined,\n transport\n );\n }\n return this.rawRequest(endpoint, method, body);\n }\n\n /**\n * For optimal token efficiency, use\n * `contents: { highlights: true }` and read each result's `highlights` array.\n * Exa dynamically chooses excerpt length based on each document's relevance\n * to your query. Set `maxCharacters` only for an explicit application limit.\n *\n * Supply `objective` to improve search quality and token efficiency.\n * Describe the larger task you're working on and the goal for this search turn.\n * Say which documents should rank first, which should be excluded, and what\n * specific facts or figures to pull from them.\n *\n * Request `text` when you need the full page; use `contents: false` for\n * titles and URLs only. Omitting contents still returns text by default.\n *\n * @param {string} query - The query string.\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of relevant search results with text contents.\n */\n async search(\n query: string,\n options?: undefined,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>;\n /**\n * Performs a search without contents.\n *\n * @param {string} query - The query string.\n * @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.\n */\n async search(\n query: string,\n options: RegularSearchOptions &\n BetaOptions & { contents: false | null | undefined },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{}>>;\n /**\n * Performs a search with specific contents.\n *\n * @example\n * const response = await exa.search(\"recent advances in battery recycling\", {\n * contents: { highlights: true },\n * objective:\n * \"I'm preparing a technical report on battery recycling methods. \" +\n * \"For this search turn, gather evidence to compare their economics. \" +\n * \"Rank peer-reviewed studies first, exclude marketing pages, and pull \" +\n * \"material recovery rates and processing costs.\",\n * });\n * for (const result of response.results) {\n * console.log(result.url, result.highlights);\n * }\n *\n * @param {string} query - The query string.\n * @param {RegularSearchOptions & { contents: T }} options - Search options with specific contents\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.\n */\n async search<T extends ContentsOptions>(\n query: string,\n options: RegularSearchOptions & BetaOptions & { contents: T },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>>;\n /**\n * When no contents option is specified, returns text contents by default.\n *\n * @param {string} query - The query string.\n * @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.\n */\n async search(\n query: string,\n options: (\n | Omit<DeepSearchOptions, \"contents\">\n | Omit<NonDeepSearchOptions, \"contents\">\n ) &\n BetaOptions,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{ text: true }>>;\n async search<T extends ContentsOptions>(\n query: string,\n options?: RegularSearchOptions &\n BetaOptions & { contents?: T | false | null | undefined },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T | { text: true } | {}>> {\n if (options?.stream) {\n throw new ExaError(\n \"For streaming responses, please use streamSearch() instead:\\n\\n\" +\n \"for await (const chunk of exa.streamSearch(query)) {\\n\" +\n \" // Handle chunks\\n\" +\n \"}\",\n HttpStatusCode.BadRequest\n );\n }\n\n const body = this.buildSearchRequestBody(query, options);\n const betaHeaders = headersForBetas(options?.betas);\n const transport = mergeRequestOptions(\n pickRequestOptions(options),\n requestOptions\n );\n if (transport) {\n return await this.request(\n \"/search\",\n \"POST\",\n body,\n undefined,\n betaHeaders,\n transport\n );\n }\n return betaHeaders\n ? await this.request(\"/search\", \"POST\", body, undefined, betaHeaders)\n : await this.request(\"/search\", \"POST\", body);\n }\n\n /**\n * Stream a search response as an async generator of OpenAI-style chat completion chunks.\n *\n * Each iteration yields a chunk with partial text (`content`) or new citations.\n * When the API returns `warnings` about the request, one chunk after the text\n * carries them.\n * Use this if you'd like to read synthesized search output incrementally.\n * The `lite` search type does not support streaming.\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n */\n streamSearch<Type extends string = never>(\n query: string,\n options?: StreamSearchOptions<Type> & {\n contents?: ContentsOptions | false | null | undefined;\n },\n requestOptions?: RequestOptions\n ): AsyncGenerator<SearchStreamChunk> {\n return this.streamChatCompletions(\n \"/search\",\n { ...this.buildSearchRequestBody(query, options), stream: true },\n mergeRequestOptions(pickRequestOptions(options), requestOptions)\n );\n }\n\n /**\n * @deprecated Use `search()`, which returns text contents by default. Pass\n * content options inside `contents`.\n *\n * Migration examples:\n * - `searchAndContents(query)` → `search(query)`\n * - `searchAndContents(query, { text: true })` → `search(query, { contents: { text: true } })`\n * - `searchAndContents(query, { summary: true })` → `search(query, { contents: { summary: true } })`\n *\n * Compatibility wrapper for the legacy top-level contents options shape.\n *\n * @param {string} query - The query string.\n * @param {RegularSearchOptions & T} [options] - Additional search + contents options\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.\n */\n async searchAndContents<T extends ContentsOptions>(\n query: string,\n options?: RegularSearchOptions & T,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>> {\n const { contentsOptions, restOptions } =\n options === undefined\n ? {\n contentsOptions: {\n text: { maxCharacters: DEFAULT_MAX_CHARACTERS },\n },\n restOptions: {},\n }\n : this.extractContentsOptions(options);\n\n const body: Record<string, unknown> = {\n query,\n contents: contentsOptions,\n ...omitRequestOptions(restOptions),\n };\n // The method called decides whether the response streams.\n delete body.stream;\n return await this.requestWithOptions(\n \"/search\",\n \"POST\",\n body,\n mergeRequestOptions(pickRequestOptions(options), requestOptions)\n );\n }\n\n /**\n * @deprecated Use `search()` instead. There is no direct replacement for URL-based similarity.\n *\n * Finds similar links to the provided URL.\n * By default, returns text contents. Use contents: false to opt-out.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of similar search results with text contents.\n */\n async findSimilar(\n url: string,\n options?: undefined,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>;\n /**\n * @deprecated Use `search()` instead. There is no direct replacement for URL-based similarity.\n *\n * Finds similar links to the provided URL without contents.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {FindSimilarOptions & { contents: false }} options - Options with contents explicitly disabled\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<{}>>} A list of similar search results without contents.\n */\n async findSimilar(\n url: string,\n options: FindSimilarOptions & { contents: false | null | undefined },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{}>>;\n /**\n * @deprecated Use `search()` instead. There is no direct replacement for URL-based similarity.\n *\n * Finds similar links to the provided URL with specific contents.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {FindSimilarOptions & { contents: T }} options - Options with specific contents\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<T>>} A list of similar search results with requested contents.\n */\n async findSimilar<T extends ContentsOptions>(\n url: string,\n options: FindSimilarOptions & { contents: T },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>>;\n /**\n * @deprecated Use `search()` instead. There is no direct replacement for URL-based similarity.\n *\n * Finds similar links to the provided URL.\n * When no contents option is specified, returns text contents by default.\n *\n * @param {string} url - The URL for which to find similar links.\n * @param {Omit<FindSimilarOptions, 'contents'>} options - Options without contents\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<{ text: true }>>} A list of similar search results with text contents.\n */\n async findSimilar(\n url: string,\n options: Omit<FindSimilarOptions, \"contents\">,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<{ text: true }>>;\n async findSimilar<T extends ContentsOptions>(\n url: string,\n options?: FindSimilarOptions & { contents?: T | false | null | undefined },\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T | { text: { maxCharacters: 10_000 } } | {}>> {\n const transport = mergeRequestOptions(\n pickRequestOptions(options),\n requestOptions\n );\n const bodyOptions = omitRequestOptions(options);\n\n // DEPRECATED METHOD: preserve legacy URL-similarity endpoint for compatibility.\n if (options === undefined || !(\"contents\" in options)) {\n // No options or no contents property → default to text contents\n return await this.requestWithOptions(\n \"/findSimilar\",\n \"POST\",\n {\n url,\n ...bodyOptions,\n contents: { text: { maxCharacters: DEFAULT_MAX_CHARACTERS } },\n },\n transport\n );\n }\n\n // If contents is false, null, or undefined, don't send it to the API\n if (\n options.contents === false ||\n options.contents === null ||\n options.contents === undefined\n ) {\n const { contents: _contents, ...restOptions } = bodyOptions ?? {};\n return await this.requestWithOptions(\n \"/findSimilar\",\n \"POST\",\n {\n url,\n ...restOptions,\n },\n transport\n );\n }\n\n // Contents property exists with value - pass it through\n return await this.requestWithOptions(\n \"/findSimilar\",\n \"POST\",\n {\n url,\n ...bodyOptions,\n contents: withJsonSummarySchema(options.contents),\n },\n transport\n );\n }\n\n /**\n * @deprecated Use `search()` instead. There is no direct replacement for URL-based similarity.\n *\n * Migration examples:\n * - `findSimilarAndContents(url)` → `search(query)`\n * - `findSimilarAndContents(url, { text: true })` → `search(query, { contents: { text: true } })`\n * - `findSimilarAndContents(url, { summary: true })` → `search(query, { contents: { summary: true } })`\n *\n * Compatibility wrapper for the legacy top-level contents options shape.\n * @param {string} url - The URL for which to find similar links.\n * @param {FindSimilarOptions & T} [options] - Additional options for finding similar links + contents.\n * @returns {Promise<SearchResponse<T>>} A list of similar search results, including requested contents.\n */\n async findSimilarAndContents<T extends ContentsOptions>(\n url: string,\n options?: FindSimilarOptions & T,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>> {\n const { contentsOptions, restOptions } =\n options === undefined\n ? {\n contentsOptions: {\n text: { maxCharacters: DEFAULT_MAX_CHARACTERS },\n },\n restOptions: {},\n }\n : this.extractContentsOptions(options);\n\n return await this.requestWithOptions(\n \"/findSimilar\",\n \"POST\",\n { url, contents: contentsOptions, ...omitRequestOptions(restOptions) },\n mergeRequestOptions(pickRequestOptions(options), requestOptions)\n );\n }\n\n /**\n * Retrieves contents of documents based on URLs.\n * @param {string | string[] | SearchResult[]} urls - A URL or array of URLs, or an array of SearchResult objects.\n * @param {ContentsOptions & BetaOptions & UserIdentifierOptions & TransportRequestOptions} [options] - Additional options for retrieving document contents.\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<SearchResponse<T>>} A list of document contents for the requested URLs.\n */\n async getContents<T extends ContentsOptions>(\n urls: string | string[] | SearchResult<T>[],\n options?: T & BetaOptions & UserIdentifierOptions & TransportRequestOptions,\n requestOptions?: RequestOptions\n ): Promise<SearchResponse<T>> {\n if (!urls || (Array.isArray(urls) && urls.length === 0)) {\n throw new ExaError(\n \"Must provide at least one URL\",\n HttpStatusCode.BadRequest\n );\n }\n\n let requestUrls: string[];\n\n if (typeof urls === \"string\") {\n requestUrls = [urls];\n } else if (typeof urls[0] === \"string\") {\n requestUrls = urls as string[];\n } else {\n requestUrls = (urls as SearchResult<T>[]).map((result) => result.url);\n }\n\n const { betas, ...contentsOptions } = options ?? {};\n\n const payload = {\n urls: requestUrls,\n ...withJsonSummarySchema(omitRequestOptions(contentsOptions)),\n };\n\n const betaHeaders = headersForBetas(betas);\n const transport = mergeRequestOptions(\n pickRequestOptions(options),\n requestOptions\n );\n if (transport) {\n return await this.request(\n \"/contents\",\n \"POST\",\n payload,\n undefined,\n betaHeaders,\n transport\n );\n }\n return betaHeaders\n ? await this.request(\"/contents\", \"POST\", payload, undefined, betaHeaders)\n : await this.request(\"/contents\", \"POST\", payload);\n }\n\n /**\n * Generate an answer with Zod schema for strongly typed output\n */\n async answer<T>(\n query: string,\n options: AnswerOptionsTyped<ZodSchema<T>>,\n requestOptions?: RequestOptions\n ): Promise<AnswerResponseTyped<T>>;\n\n /**\n * Generate an answer to a query.\n * @param {string} query - The question or query to answer.\n * @param {AnswerOptions} [options] - Additional options for answer generation.\n * @param {RequestOptions} [requestOptions] - Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`).\n * @returns {Promise<AnswerResponse>} The generated answer and source references.\n *\n * Example with systemPrompt:\n * ```ts\n * const answer = await exa.answer(\"What is quantum computing?\", {\n * text: true,\n * model: \"exa\",\n * systemPrompt: \"Answer in a technical manner suitable for experts.\"\n * });\n * ```\n *\n * Note: For streaming responses, use the `streamAnswer` method:\n * ```ts\n * for await (const chunk of exa.streamAnswer(query)) {\n * // Handle chunks\n * }\n * ```\n */\n async answer(\n query: string,\n options?: AnswerOptions,\n requestOptions?: RequestOptions\n ): Promise<AnswerResponse>;\n\n async answer<T>(\n query: string,\n options?: AnswerOptions | AnswerOptionsTyped<ZodSchema<T>>,\n requestOptions?: RequestOptions\n ): Promise<AnswerResponse | AnswerResponseTyped<T>> {\n if (options?.stream) {\n throw new ExaError(\n \"For streaming responses, please use streamAnswer() instead:\\n\\n\" +\n \"for await (const chunk of exa.streamAnswer(query)) {\\n\" +\n \" // Handle chunks\\n\" +\n \"}\",\n HttpStatusCode.BadRequest\n );\n }\n\n // For non-streaming requests, make a regular API call\n let outputSchema = options?.outputSchema;\n\n // Convert Zod schema to JSON schema if needed\n if (outputSchema && isZodSchema(outputSchema)) {\n outputSchema = zodToJsonSchema(outputSchema);\n }\n\n const requestBody = {\n query,\n stream: false,\n text: options?.text ?? false,\n model: options?.model ?? \"exa\",\n systemPrompt: options?.systemPrompt,\n outputSchema,\n userLocation: options?.userLocation,\n userIdentifier: options?.userIdentifier,\n };\n\n return await this.requestWithOptions(\n \"/answer\",\n \"POST\",\n requestBody,\n mergeRequestOptions(pickRequestOptions(options), requestOptions)\n );\n }\n\n /**\n * Stream an answer with Zod schema for structured output (non-streaming content)\n * Note: Structured output works only with non-streaming content, not with streaming chunks\n */\n streamAnswer<T>(\n query: string,\n options: {\n text?: boolean;\n model?: \"exa\" | \"exa-pro\";\n systemPrompt?: string;\n outputSchema: ZodSchema<T>;\n userLocation?: UserLocation;\n } & UserIdentifierOptions & TransportRequestOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AnswerStreamChunk>;\n\n /**\n * Stream an answer as an async generator\n *\n * Each iteration yields a chunk with partial text (`content`) or new citations.\n * Use this if you'd like to read the answer incrementally, e.g. in a chat UI.\n *\n * Example usage:\n * ```ts\n * for await (const chunk of exa.streamAnswer(\"What is quantum computing?\", {\n * text: false,\n * systemPrompt: \"Answer in a concise manner suitable for beginners.\"\n * })) {\n * if (chunk.content) process.stdout.write(chunk.content);\n * if (chunk.citations) {\n * console.log(\"\\nCitations: \", chunk.citations);\n * }\n * }\n * ```\n */\n streamAnswer(\n query: string,\n options?: {\n text?: boolean;\n model?: \"exa\" | \"exa-pro\";\n systemPrompt?: string;\n outputSchema?: Record<string, unknown>;\n userLocation?: UserLocation;\n } & UserIdentifierOptions & TransportRequestOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AnswerStreamChunk>;\n\n async *streamAnswer<T>(\n query: string,\n options?: {\n text?: boolean;\n model?: \"exa\" | \"exa-pro\";\n systemPrompt?: string;\n outputSchema?: Record<string, unknown> | ZodSchema<T>;\n userLocation?: UserLocation;\n } & UserIdentifierOptions & TransportRequestOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AnswerStreamChunk> {\n // Convert Zod schema to JSON schema if needed\n let outputSchema = options?.outputSchema;\n if (outputSchema && isZodSchema(outputSchema)) {\n outputSchema = zodToJsonSchema(outputSchema);\n }\n\n // Build the POST body and fetch the streaming response.\n const body = {\n query,\n text: options?.text ?? false,\n stream: true,\n model: options?.model ?? \"exa\",\n systemPrompt: options?.systemPrompt,\n outputSchema,\n userLocation: options?.userLocation,\n userIdentifier: options?.userIdentifier,\n };\n\n yield* this.streamChatCompletions(\n \"/answer\",\n body,\n mergeRequestOptions(pickRequestOptions(options), requestOptions)\n );\n }\n\n private async *streamChatCompletions(\n endpoint: string,\n body: Record<string, unknown>,\n requestOptions?: RequestOptions\n ): AsyncGenerator<SearchStreamChunk> {\n const response = await this.streamRequestWithOptions(\n endpoint,\n \"POST\",\n body,\n requestOptions\n );\n\n if (!response.ok) {\n throw await exaErrorFromResponse(response, endpoint);\n }\n const requestIdHeader = response.headers.get(\"x-request-id\");\n\n const reader = response.body?.getReader();\n if (!reader) {\n throw new ExaError(\n \"No response body available for streaming.\",\n 500,\n new Date().toISOString()\n );\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n\n const jsonStr = line.replace(/^data:\\s*/, \"\").trim();\n if (!jsonStr || jsonStr === \"[DONE]\") {\n continue;\n }\n\n let chunkData: any;\n try {\n chunkData = JSON.parse(jsonStr);\n } catch (err) {\n continue;\n }\n\n const chunk = this.processChunk(chunkData);\n this.reportWarnings(endpoint, \"POST\", chunkData, requestIdHeader);\n if (chunk.content || chunk.citations || chunk.warnings) {\n yield chunk;\n }\n }\n }\n\n if (buffer.startsWith(\"data: \")) {\n const leftover = buffer.replace(/^data:\\s*/, \"\").trim();\n if (leftover && leftover !== \"[DONE]\") {\n try {\n const chunkData = JSON.parse(leftover);\n const chunk = this.processChunk(chunkData);\n this.reportWarnings(endpoint, \"POST\", chunkData, requestIdHeader);\n if (chunk.content || chunk.citations || chunk.warnings) {\n yield chunk;\n }\n } catch (e) {}\n }\n }\n } finally {\n // Cancel so rawRequest can release signal listeners and timers even if\n // the consumer stops early (break / throw out of the generator).\n try {\n await reader.cancel();\n } catch {\n // ignore\n }\n }\n }\n\n /**\n * Parses one stream payload into a chunk. `warnings` is set only when the\n * payload carries a non-empty `warnings` array, which `/search` sends on its\n * `results` event.\n */\n private processChunk(chunkData: any): SearchStreamChunk {\n let content: string | undefined;\n let citations:\n | Array<{\n id: string;\n url: string;\n title?: string;\n publishedDate?: string;\n author?: string;\n text?: string;\n }>\n | undefined;\n\n if (\n chunkData.choices &&\n chunkData.choices[0] &&\n chunkData.choices[0].delta\n ) {\n content = chunkData.choices[0].delta.content;\n }\n\n if (chunkData.citations && chunkData.citations !== \"null\") {\n citations = chunkData.citations.map((c: any) => ({\n id: c.id,\n url: c.url,\n title: c.title,\n publishedDate: c.publishedDate,\n author: c.author,\n text: c.text,\n }));\n }\n\n if (Array.isArray(chunkData.warnings) && chunkData.warnings.length > 0) {\n const warnings: SearchWarning[] = chunkData.warnings;\n return { content, citations, warnings };\n }\n\n return { content, citations };\n }\n\n private async parseSSEStream<T>(response: Response): Promise<T> {\n const reader = response.body?.getReader();\n if (!reader) {\n throw new ExaError(\n \"No response body available for streaming.\",\n 500,\n new Date().toISOString()\n );\n }\n\n const decoder = new TextDecoder();\n let buffer = \"\";\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() || \"\";\n\n for (const line of lines) {\n if (!line.startsWith(\"data: \")) continue;\n const jsonStr = line.replace(/^data:\\s*/, \"\").trim();\n if (!jsonStr || jsonStr === \"[DONE]\") continue;\n\n let chunk: any;\n try {\n chunk = JSON.parse(jsonStr);\n } catch {\n continue;\n }\n\n if (chunk.tag === \"complete\") return chunk.data as T;\n if (chunk.tag === \"error\") {\n throw new ExaError(\n chunk.error?.message || \"Unknown error\",\n HttpStatusCode.InternalServerError,\n new Date().toISOString()\n );\n }\n }\n }\n\n throw new ExaError(\n \"Stream ended without a completion event.\",\n HttpStatusCode.InternalServerError,\n new Date().toISOString()\n );\n } finally {\n // The server may keep the SSE connection open after a terminal event.\n try {\n await reader.cancel();\n } catch {\n // Preserve the completion payload or original read error.\n }\n reader.releaseLock();\n }\n }\n}\n\n// Re-export Websets related types and enums\nexport * from \"./websets\";\n// Re-export Research related types and client\nexport * from \"./research\";\n// Re-export Search Monitors related types and client\nexport * from \"./monitors\";\n// Re-export Agent related types and client\nexport * from \"./agent\";\nexport * from \"./tools\";\n\n// Export the main class\nexport default Exa;\n\n// Re-export errors\nexport * from \"./errors\";\n","{\n \"name\": \"exa-js\",\n \"version\": \"2.26.0\",\n \"description\": \"Exa SDK for Node.js and the browser\",\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"files\": [\n \"dist\"\n ],\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"require\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"import\": \"./dist/index.mjs\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"build-fast\": \"tsup src/index.ts --format cjs,esm\",\n \"build\": \"tsup\",\n \"test\": \"vitest run\",\n \"test:unit\": \"vitest run --config vitest.unit.config.ts\",\n \"test:integration\": \"vitest run --config vitest.integration.config.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"typecheck:examples\": \"tsc -p examples/tsconfig.json --noEmit\",\n \"generate:types:websets\": \"openapi-typescript https://raw.githubusercontent.com/exa-labs/openapi-spec/refs/heads/master/exa-websets-spec.yaml --enum --root-types --alphabetize --root-types-no-schema-prefix --output ./src/websets/openapi.ts && npm run format:websets\",\n \"format\": \"prettier --write \\\"src/**/*.ts\\\" \\\"examples/**/*.ts\\\"\",\n \"format:websets\": \"prettier --write src/websets/openapi.ts\",\n \"generate-docs\": \"npx tsx scripts/generate-docs.ts\",\n \"build:beta\": \"cross-env NPM_CONFIG_TAG=beta npm run build\",\n \"version:beta\": \"npm version prerelease --preid=beta\",\n \"version:stable\": \"npm version patch\",\n \"publish:beta\": \"npm run version:beta && npm run build:beta && npm publish --tag beta\",\n \"publish:stable\": \"npm run version:stable && npm run build && npm publish\",\n \"prepublishOnly\": \"npm run build\"\n },\n \"license\": \"MIT\",\n \"devDependencies\": {\n \"@anthropic-ai/sdk\": \"^0.115.0\",\n \"@types/node\": \"~22.14.0\",\n \"cross-env\": \"~7.0.3\",\n \"openapi-typescript\": \"~7.6.1\",\n \"prettier\": \"~3.5.3\",\n \"ts-morph\": \"^27.0.2\",\n \"ts-node\": \"~10.9.2\",\n \"tsup\": \"~8.4.0\",\n \"tsx\": \"^4.21.0\",\n \"typescript\": \"~5.8.3\",\n \"vitest\": \"~3.1.1\"\n },\n \"dependencies\": {\n \"cross-fetch\": \"~4.1.0\",\n \"dotenv\": \"~16.4.7\",\n \"openai\": \"^5.0.1\",\n \"zod\": \"^3.22.0\",\n \"zod-to-json-schema\": \"^3.20.0\"\n },\n \"directories\": {\n \"test\": \"test\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/exa-labs/exa-js.git\"\n },\n \"keywords\": [\n \"exa\",\n \"metaphor\",\n \"search\",\n \"AI\",\n \"LLMs\",\n \"RAG\",\n \"retrieval\",\n \"augmented\",\n \"generation\"\n ],\n \"author\": \"jeffzwang\",\n \"bugs\": {\n \"url\": \"https://github.com/exa-labs/exa-js/issues\"\n },\n \"homepage\": \"https://github.com/exa-labs/exa-js#readme\"\n}\n","/**\n * HTTP status codes\n */\nexport enum HttpStatusCode {\n BadRequest = 400,\n NotFound = 404,\n Unauthorized = 401,\n Forbidden = 403,\n TooManyRequests = 429,\n RequestTimeout = 408,\n InternalServerError = 500,\n ServiceUnavailable = 503,\n}\n\n/**\n * Structured fields from the API's error envelope\n * (e.g. `{ \"error\": { \"type\", \"code\", \"message\", \"detail\" }, \"requestId\" }`).\n */\nexport interface ExaErrorEnvelope {\n /**\n * Error category, e.g. \"NOT_FOUND\", \"INVALID_REQUEST\", \"CONFLICT\"\n */\n type?: string;\n\n /**\n * Specific error code, e.g. \"MONITOR_NOT_FOUND\"\n */\n code?: string;\n\n /**\n * Additional context, e.g. which validation rule failed\n */\n detail?: unknown;\n\n /**\n * Server-side request id for support/debugging\n */\n requestId?: string;\n}\n\n/**\n * Base error class for all Exa API errors\n */\nexport class ExaError extends Error {\n /**\n * HTTP status code\n */\n statusCode: number;\n\n /**\n * ISO timestamp from API\n */\n timestamp?: string;\n\n /**\n * Path that caused the error (may be undefined for client-side errors)\n */\n path?: string;\n\n /**\n * Error category from the API's error envelope, e.g. \"NOT_FOUND\"\n */\n type?: string;\n\n /**\n * Specific error code from the API's error envelope, e.g. \"MONITOR_NOT_FOUND\"\n */\n code?: string;\n\n /**\n * Additional context from the API's error envelope\n */\n detail?: unknown;\n\n /**\n * Server-side request id for support/debugging\n */\n requestId?: string;\n\n /**\n * Create a new ExaError\n * @param message Error message\n * @param statusCode HTTP status code\n * @param timestamp ISO timestamp from API\n * @param path Path that caused the error\n * @param envelope Structured fields from the API's error envelope\n */\n constructor(\n message: string,\n statusCode: number,\n timestamp?: string,\n path?: string,\n envelope?: ExaErrorEnvelope\n ) {\n super(message);\n this.name = \"ExaError\";\n this.statusCode = statusCode;\n this.timestamp = timestamp ?? new Date().toISOString();\n this.path = path;\n if (envelope) {\n this.type = envelope.type;\n this.code = envelope.code;\n this.detail = envelope.detail;\n this.requestId = envelope.requestId;\n }\n }\n}\n\n/**\n * Thrown when a request is cancelled through the caller's `AbortSignal`.\n * `name` is `\"AbortError\"`. Not an `ExaError`, so it has no `statusCode`.\n */\nexport class ExaAbortError extends Error {\n /**\n * The error `fetch` rejected with, or the signal's abort reason\n */\n cause?: unknown;\n\n /**\n * Create a new ExaAbortError\n * @param cause The underlying fetch rejection or abort reason\n */\n constructor(cause?: unknown) {\n super(\"Request was aborted.\");\n this.name = \"AbortError\";\n this.cause = cause;\n }\n}\n\n/**\n * Thrown when a request exceeds its `timeout`. `name` is `\"TimeoutError\"`\n * and `statusCode` is 408.\n */\nexport class ExaTimeoutError extends ExaError {\n /**\n * The timeout that elapsed, in milliseconds\n */\n timeout: number;\n\n /**\n * The error `fetch` rejected with\n */\n cause?: unknown;\n\n /**\n * Create a new ExaTimeoutError\n * @param timeout The timeout that elapsed, in milliseconds\n * @param path Path of the request that timed out\n * @param cause The underlying fetch rejection\n */\n constructor(timeout: number, path?: string, cause?: unknown) {\n super(\n `Request timed out after ${timeout}ms.`,\n HttpStatusCode.RequestTimeout,\n undefined,\n path\n );\n this.name = \"TimeoutError\";\n this.timeout = timeout;\n this.cause = cause;\n }\n}\n","/**\n * Reading Exa API response bodies, and turning an error response into an\n * `ExaError`.\n *\n * `Exa.request` and every streaming method build their errors through\n * `exaErrorFromResponse`, so an error response yields the same message,\n * `requestId`, `path` and envelope fields whether the method streams or not.\n */\nimport { ExaError } from \"./errors\";\n\n/** Longest snippet of a non-JSON response body to include in error messages. */\nconst NON_JSON_BODY_SNIPPET_LENGTH = 500;\n\n/**\n * Reads a fetch Response body once and attempts to parse it as JSON.\n *\n * API gateways and proxies (Cloudflare, load balancers, nginx) sometimes\n * return HTML or plain-text error pages even when the SDK expects JSON.\n * Calling `response.json()` on those bodies throws an opaque\n * `SyntaxError: Unexpected token '<', \"<!DOCTYPE \"... is not valid JSON`\n * that hides the real HTTP status. Reading the body as text first lets the\n * caller surface the actual status and a snippet of the response instead.\n *\n * @returns The parsed JSON value (or `undefined` when the body is empty or not\n * valid JSON) alongside the raw response text.\n */\nexport async function readResponseBody(\n response: Response\n): Promise<{ json: any; text: string }> {\n const text = await response.text();\n if (!text) {\n return { json: undefined, text };\n }\n try {\n return { json: JSON.parse(text), text };\n } catch {\n return { json: undefined, text };\n }\n}\n\n/**\n * Collapses whitespace and truncates a non-JSON response body so it stays\n * readable when embedded in an error message.\n */\nexport function truncateResponseBody(text: string): string {\n const collapsed = text.replace(/\\s+/g, \" \").trim();\n return collapsed.length > NON_JSON_BODY_SNIPPET_LENGTH\n ? `${collapsed.slice(0, NON_JSON_BODY_SNIPPET_LENGTH)}…`\n : collapsed;\n}\n\n/**\n * Reads an error response whole and returns the `ExaError` it describes.\n *\n * - A structured envelope (`{ error: { type, code, message, detail },\n * requestId }`) gives the message and the envelope fields.\n * - A legacy body (`{ error: \"...\", message?, requestId? }`) gives\n * `error` and `message` joined, and `requestId`.\n * - A body that is not a JSON object (an HTML page from a proxy, plain text,\n * nothing) gives the status and a snippet of the body.\n *\n * `statusCode`, `timestamp` and `path` come from the body when it has them,\n * else from the response, the current time and `path`.\n *\n * @param response - A response whose status is not 2xx; its body is consumed.\n * @param path - The API path the request went to, e.g. `/answer`.\n */\nexport async function exaErrorFromResponse(\n response: Response,\n path: string\n): Promise<ExaError> {\n const { json, text } = await readResponseBody(response);\n\n // Gateways/proxies can return non-JSON (e.g. HTML) error pages. Surface\n // the real status and a snippet of the body rather than throwing an\n // opaque JSON parse error that hides the underlying failure.\n if (!json || typeof json !== \"object\") {\n const snippet = truncateResponseBody(text);\n const message = snippet\n ? `Request failed with status ${response.status}. Response body was not valid JSON: ${snippet}`\n : `Request failed with status ${response.status}.`;\n return new ExaError(\n message,\n response.status,\n new Date().toISOString(),\n path\n );\n }\n\n const errorData = json;\n if (!errorData.statusCode) {\n errorData.statusCode = response.status;\n }\n if (!errorData.timestamp) {\n errorData.timestamp = new Date().toISOString();\n }\n if (!errorData.path) {\n errorData.path = path;\n }\n\n // Structured envelope (`error` is an object): message and metadata live\n // inside it — e.g. { error: { type, code, message, detail }, requestId }.\n const envelope =\n typeof errorData.error === \"object\" && errorData.error !== null\n ? (errorData.error as {\n type?: string;\n code?: string;\n message?: string;\n detail?: unknown;\n requestId?: string;\n })\n : undefined;\n let message: string;\n if (envelope) {\n message = envelope.message || errorData.message || \"Unknown error\";\n } else {\n message = errorData.error || \"Unknown error\";\n if (errorData.message) {\n message += (message.length > 0 ? \". \" : \"\") + errorData.message;\n }\n }\n return new ExaError(\n message,\n response.status,\n errorData.timestamp,\n errorData.path,\n envelope\n ? {\n type: envelope.type,\n code: envelope.code,\n detail: envelope.detail,\n requestId: errorData.requestId ?? envelope.requestId,\n }\n : errorData.requestId\n ? { requestId: errorData.requestId }\n : undefined\n );\n}\n","import { ZodType, ZodSchema } from \"zod\";\nimport { zodToJsonSchema as convertZodToJsonSchema } from \"zod-to-json-schema\";\n\nexport function isZodSchema(obj: any): obj is ZodSchema<any> {\n return obj instanceof ZodType;\n}\n\nexport function zodToJsonSchema(\n schema: ZodSchema<any>\n): Record<string, unknown> {\n return convertZodToJsonSchema(schema, {\n $refStrategy: \"none\",\n }) as Record<string, unknown>;\n}\n","/**\n * Per-call options for Exa API requests, and the machinery that applies them\n * to a `fetch` call.\n *\n * - `RequestOptions`: what every API method takes as its trailing argument.\n * `TransportRequestOptions` is its `signal` / `timeout` part, which the\n * search, contents and answer methods also accept inside their options bag.\n * - `omitRequestOptions` / `pickRequestOptions` / `mergeRequestOptions`: keep\n * those fields out of JSON bodies and combine the places they can be given.\n * - `mergeRequestBody` / `mergeRequestHeaders`: add a call's extra `body` and\n * `headers` to the request a method built.\n * - `resolveRequestSignal`: one fetch-ready signal per request, plus the\n * mapping from a fetch rejection to `ExaAbortError` / `ExaTimeoutError`.\n * - `withDisposeOnBodySettled`: holds request-owned listeners and timers until\n * the response body settles.\n * - `RequestScopedClient`: lets an API sub-client run a method's requests\n * with the caller's transport options.\n * - `sleep`: an abortable delay for polling helpers.\n */\nimport { ExaAbortError, ExaError, ExaTimeoutError } from \"./errors\";\n\n/**\n * Transport-level options for a single request.\n *\n * These are never serialized into JSON request bodies. They only control the\n * underlying `fetch` call (cancellation and timeouts).\n */\nexport type TransportRequestOptions = {\n /**\n * AbortSignal used to cancel the in-flight HTTP request, for stale UI\n * requests or navigation changes. Aborting it rejects the call with\n * `ExaAbortError` whatever the reason, `AbortSignal.timeout()` included.\n * Use `timeout` to get `ExaTimeoutError`.\n */\n signal?: AbortSignal | undefined;\n\n /**\n * Request timeout in milliseconds. When it expires, the call rejects with\n * `ExaTimeoutError`. It is a deadline for the whole response, body\n * included, counted from when the request is sent. A streaming method\n * applies it to the wait for a successful response to start, never to a\n * stream that is flowing. An error response is read whole within it.\n * Left unset (`undefined`, or `null` from JavaScript), the client's default\n * timeout applies.\n *\n * If both `timeout` and `signal` are provided, the request aborts when either\n * fires first.\n */\n timeout?: number | undefined;\n};\n\n/** Query parameter values the SDK can serialize into a URL. */\nexport type QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\n/**\n * Per-call options every API method accepts as its trailing argument.\n *\n * `signal` and `timeout` control the `fetch` call. `body`, `headers` and\n * `query` add to the request the method builds, for fields the SDK does not\n * type yet. On a name the method also sets, the value given here wins.\n */\nexport type RequestOptions = TransportRequestOptions & {\n /**\n * Extra fields merged over the JSON request body, except `stream`, because\n * the method called decides whether the response streams. Sent with `POST`,\n * `PUT` and `PATCH` requests. Other requests take `query` instead.\n */\n body?: Record<string, unknown> | undefined;\n\n /**\n * Extra headers. A header the SDK also sets is replaced, whatever its case.\n * `null` removes it and `undefined` leaves it as it is. The Agent run\n * streams send `Accept: text/event-stream` and keep it, ignoring an extra\n * `Accept`. Every other method, the other streaming methods included, sends\n * an extra `Accept` as given.\n */\n headers?: Record<string, string | null | undefined> | undefined;\n\n /**\n * Extra query parameters merged over the request's query string, except\n * `stream`. A parameter set to `undefined` is skipped. A `cursor` given to\n * a helper that pages through a listing selects its first page only.\n */\n query?: QueryParams | undefined;\n};\n\n/**\n * Result of resolving transport options into a fetch-ready AbortSignal.\n *\n * Call `dispose()` once the request settles (success, failure, or stream end)\n * so signal listeners and timeout timers are released.\n */\nexport type ResolvedRequestSignal = {\n signal: AbortSignal | undefined;\n dispose: () => void;\n /**\n * True when `dispose()` releases listeners or timers. False when no\n * request-owned resources need body-lifetime bookkeeping.\n */\n needsDispose: boolean;\n /**\n * Stops the timeout and leaves the caller's signal attached. Streaming\n * calls use it once response headers arrive, so `timeout` bounds the wait\n * for a stream to start and never cuts one that is already flowing.\n */\n stopTimeout: () => void;\n /**\n * Maps an error thrown by `fetch` or a body read to `ExaTimeoutError` or\n * `ExaAbortError` when this request's timeout or signal caused it. Any\n * other error, and any `ExaError`, is returned unchanged.\n */\n toRequestError: (error: unknown, path?: string) => unknown;\n};\n\n/** Largest delay a timer accepts: Node timers overflow above 2^31-1 ms. */\nconst MAX_TIMEOUT_MS = 2_147_483_647;\n\n/**\n * Checks that a timeout is a whole number of milliseconds a timer can hold.\n * @throws {RangeError} When it is not an integer from 1 to 2147483647.\n */\nexport function validateTimeout(timeout: number): number {\n if (\n !Number.isSafeInteger(timeout) ||\n timeout <= 0 ||\n timeout > MAX_TIMEOUT_MS\n ) {\n throw new RangeError(\n `Request timeout must be an integer from 1 to ${MAX_TIMEOUT_MS} milliseconds (received ${timeout})`\n );\n }\n return timeout;\n}\n\nconst REQUEST_OPTION_KEYS = [\"signal\", \"timeout\"] as const;\n\n/**\n * Removes transport-only fields so they are never serialized into API payloads.\n */\nexport function omitRequestOptions<T extends object>(\n options?: T\n): Omit<T, keyof TransportRequestOptions> | undefined {\n if (options == null) {\n return undefined;\n }\n\n const rest = { ...options } as Record<string, unknown>;\n for (const key of REQUEST_OPTION_KEYS) {\n delete rest[key];\n }\n return rest as Omit<T, keyof TransportRequestOptions>;\n}\n\n/**\n * Extracts the transport options (`signal`, `timeout`) from a mixed options\n * bag. A bag's other keys belong to the API payload, so a key that happens to\n * be named `body`, `headers` or `query` is never read as a request option.\n */\nexport function pickRequestOptions(\n options?: TransportRequestOptions | null\n): TransportRequestOptions | undefined {\n if (options == null) {\n return undefined;\n }\n\n const picked: TransportRequestOptions = {};\n if (options.signal !== undefined) {\n picked.signal = options.signal;\n }\n if (options.timeout !== undefined) {\n picked.timeout = options.timeout;\n }\n\n return picked.signal !== undefined || picked.timeout !== undefined\n ? picked\n : undefined;\n}\n\n/**\n * Merges request options given in several places into one. A later source\n * wins: `signal` and `timeout` field by field, `body`, `headers` and `query`\n * entry by entry. A field a later source leaves undefined falls through to an\n * earlier one, so a trailing `requestOptions` argument overrides the same\n * field in a method's options bag, which overrides the client default. A\n * `timeout` of `null` counts as unset too, so it never switches off the\n * client default.\n * Returns undefined when no source sets anything.\n */\nexport function mergeRequestOptions(\n ...sources: Array<RequestOptions | null | undefined>\n): RequestOptions | undefined {\n const merged: RequestOptions = {};\n for (const source of sources) {\n if (source?.signal !== undefined) {\n merged.signal = source.signal;\n }\n if (source?.timeout != null) {\n merged.timeout = source.timeout;\n }\n if (source?.body !== undefined) {\n merged.body = { ...merged.body, ...source.body };\n }\n if (source?.headers !== undefined) {\n merged.headers = { ...merged.headers, ...source.headers };\n }\n if (source?.query !== undefined) {\n merged.query = { ...merged.query, ...source.query };\n }\n }\n return Object.keys(merged).length > 0 ? merged : undefined;\n}\n\n/** Methods whose requests carry a JSON body, and so take the extra `body`. */\nconst BODY_METHODS = new Set([\"POST\", \"PUT\", \"PATCH\"]);\n\n/**\n * Returns the JSON body to send: the body a method built with the call's\n * extra `body` fields merged over it. `stream` is never taken from the extra\n * fields. Only `POST`, `PUT` and `PATCH` requests take them; any other\n * request is left as it is.\n * @throws {TypeError} When the method's body is not a plain object to merge into.\n */\nexport function mergeRequestBody(\n method: string,\n body: unknown,\n extraBody?: Record<string, unknown>\n): unknown {\n if (!extraBody || !BODY_METHODS.has(method.toUpperCase())) {\n return body;\n }\n const { stream: _stream, ...extra } = extraBody;\n if (body === undefined || body === null) {\n return Object.keys(extra).length > 0 ? extra : body;\n }\n if (typeof body !== \"object\" || Array.isArray(body)) {\n throw new TypeError(\n \"Cannot merge the `body` request option into a request body that is not an object\"\n );\n }\n return { ...body, ...extra };\n}\n\n/**\n * Returns the query parameters to send: `query` with the call's extra\n * parameters merged over it. `stream` is never taken from the extra\n * parameters, and one set to `undefined` or `null` is skipped rather than\n * clearing the method's own. Returns `query` itself when there is nothing to\n * add.\n */\nexport function mergeRequestQuery(\n query: QueryParams | undefined,\n extraQuery?: QueryParams\n): QueryParams | undefined {\n const extra = Object.fromEntries(\n Object.entries(extraQuery ?? {}).filter(\n ([name, value]) =>\n name !== \"stream\" && value !== undefined && value !== null\n )\n );\n return Object.keys(extra).length > 0 ? { ...query, ...extra } : query;\n}\n\n/** True when `headers` ask for a server-sent event stream. */\nfunction acceptsEventStream(headers: Record<string, string>): boolean {\n return Object.entries(headers).some(\n ([name, value]) =>\n name.toLowerCase() === \"accept\" &&\n value.toLowerCase().includes(\"text/event-stream\")\n );\n}\n\n/**\n * Returns the headers to send: `headers` with the call's extra headers set on\n * top. Header names are case-insensitive, so an extra header replaces every\n * header already present under any casing instead of being sent beside it.\n * An extra header set to `null` removes the header; one set to `undefined`\n * is skipped. When `headers` ask for an event stream, an extra `Accept` is\n * skipped too: the method called decides whether the response streams.\n */\nexport function mergeRequestHeaders(\n headers: Record<string, string>,\n extraHeaders?: Record<string, string | null | undefined>\n): Record<string, string> {\n if (!extraHeaders) {\n return headers;\n }\n const keepsAccept = acceptsEventStream(headers);\n const merged = { ...headers };\n for (const [name, value] of Object.entries(extraHeaders)) {\n const lowerCaseName = name.toLowerCase();\n if (value === undefined || (keepsAccept && lowerCaseName === \"accept\")) {\n continue;\n }\n for (const existing of Object.keys(merged)) {\n if (existing.toLowerCase() === lowerCaseName) {\n delete merged[existing];\n }\n }\n if (value !== null) {\n merged[name] = value;\n }\n }\n return merged;\n}\n\n/** Each client's default request options (`ExaClientOptions`), by client. */\nconst CLIENT_DEFAULTS = new WeakMap<object, TransportRequestOptions>();\n\n/** Records the default request options of `client`; the `Exa` constructor calls it. */\nexport function setClientDefaults(\n client: object,\n defaults: TransportRequestOptions | undefined\n): void {\n if (defaults === undefined) {\n CLIENT_DEFAULTS.delete(client);\n } else {\n CLIENT_DEFAULTS.set(client, defaults);\n }\n}\n\n/**\n * Returns the default request options of `client` overridden by\n * `requestOptions`, or undefined when neither sets anything.\n */\nexport function withClientDefaults(\n client: object,\n requestOptions?: RequestOptions | null\n): RequestOptions | undefined {\n return mergeRequestOptions(CLIENT_DEFAULTS.get(client), requestOptions);\n}\n\n/**\n * Builds the request options for a call that streams its response: the\n * defaults of `client` overridden by `requestOptions`, marked so `rawRequest`\n * applies `timeout` to the wait for a successful response's headers only.\n * Returns undefined when neither sets anything.\n */\nexport function streamRequestOptions(\n client: object,\n requestOptions?: RequestOptions | null\n): RequestOptions | undefined {\n return asStreamRequestOptions(withClientDefaults(client, requestOptions));\n}\n\n/** Options whose `timeout` stops once a successful response starts. */\nconst STREAM_REQUEST_OPTIONS = new WeakSet<RequestOptions>();\n\n/**\n * Marks request options as belonging to a call that streams its response.\n * `rawRequest` then stops the timeout once a successful response's headers\n * arrive, so a stream that has started is never cut by it, and reports a\n * cancelled read as `ExaAbortError`. An error response keeps the timeout until\n * its body is read. Returns undefined when there is nothing to carry, so a\n * caller can keep its original argument list.\n */\nexport function asStreamRequestOptions(\n options?: RequestOptions | null\n): RequestOptions | undefined {\n const copy = mergeRequestOptions(options);\n if (copy) {\n STREAM_REQUEST_OPTIONS.add(copy);\n }\n return copy;\n}\n\n/** Whether `asStreamRequestOptions` produced these options. */\nexport function isStreamRequestOptions(\n options?: RequestOptions | null\n): boolean {\n return options != null && STREAM_REQUEST_OPTIONS.has(options);\n}\n\ntype DisposableAbortSignal = {\n signal: AbortSignal;\n dispose: () => void;\n};\n\n/** Shared sentinel so callers can detect \"nothing to release\". */\nconst NOOP_DISPOSE = () => {};\n\nfunction createTimeoutSignal(timeoutMs: number): DisposableAbortSignal {\n const controller = new AbortController();\n const timer = setTimeout(() => {\n controller.abort(\n typeof DOMException !== \"undefined\"\n ? new DOMException(\n `The operation was aborted due to timeout after ${timeoutMs}ms`,\n \"TimeoutError\"\n )\n : undefined\n );\n }, timeoutMs);\n\n // Avoid keeping the event loop alive solely for the timer in Node.\n if (typeof (timer as NodeJS.Timeout).unref === \"function\") {\n (timer as NodeJS.Timeout).unref();\n }\n\n let disposed = false;\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n clearTimeout(timer);\n };\n\n controller.signal.addEventListener(\"abort\", dispose, { once: true });\n\n return { signal: controller.signal, dispose };\n}\n\nfunction anySignal(signals: AbortSignal[]): DisposableAbortSignal {\n if (signals.length === 1) {\n return { signal: signals[0], dispose: NOOP_DISPOSE };\n }\n\n const controller = new AbortController();\n const abortHandlers: Array<{\n signal: AbortSignal;\n handler: () => void;\n }> = [];\n\n let disposed = false;\n const dispose = () => {\n if (disposed) return;\n disposed = true;\n for (const { signal, handler } of abortHandlers) {\n signal.removeEventListener(\"abort\", handler);\n }\n abortHandlers.length = 0;\n };\n\n for (const signal of signals) {\n if (signal.aborted) {\n controller.abort(signal.reason);\n // Release listeners already attached to earlier signals in this loop.\n dispose();\n return { signal: controller.signal, dispose: NOOP_DISPOSE };\n }\n const handler = () => {\n controller.abort(signal.reason);\n };\n signal.addEventListener(\"abort\", handler);\n abortHandlers.push({ signal, handler });\n }\n\n // Drop sibling listeners as soon as one source aborts.\n controller.signal.addEventListener(\"abort\", dispose, { once: true });\n\n return { signal: controller.signal, dispose };\n}\n\n/**\n * Resolves the AbortSignal that should be passed to `fetch`.\n *\n * Combines an optional caller `signal` with an optional `timeout` so either\n * can cancel the request. Always call `dispose()` when the request settles so\n * listeners / timers are released.\n */\nexport function resolveRequestSignal(\n options?: TransportRequestOptions | null\n): ResolvedRequestSignal {\n if (options == null) {\n return {\n signal: undefined,\n dispose: () => {},\n needsDispose: false,\n stopTimeout: NOOP_DISPOSE,\n toRequestError: (error) => error,\n };\n }\n\n const { signal, timeout } = options;\n const signals: AbortSignal[] = [];\n const disposers: Array<() => void> = [];\n let timeoutSignal: DisposableAbortSignal | undefined;\n\n if (signal) {\n signals.push(signal);\n }\n\n if (timeout != null) {\n timeoutSignal = createTimeoutSignal(validateTimeout(timeout));\n signals.push(timeoutSignal.signal);\n if (timeoutSignal.dispose !== NOOP_DISPOSE) {\n disposers.push(timeoutSignal.dispose);\n }\n }\n\n if (signals.length === 0) {\n return {\n signal: undefined,\n dispose: () => {},\n needsDispose: false,\n stopTimeout: NOOP_DISPOSE,\n toRequestError: (error) => error,\n };\n }\n\n const combined = anySignal(signals);\n if (combined.dispose !== NOOP_DISPOSE) {\n disposers.push(combined.dispose);\n }\n\n // With both a signal and a timeout, the one that fires first cancelled the\n // request; the other may still fire before the rejection is handled.\n let firstAbort: \"signal\" | \"timeout\" | undefined;\n if (signal && timeoutSignal) {\n combined.signal.addEventListener(\n \"abort\",\n () => {\n firstAbort = signal.aborted ? \"signal\" : \"timeout\";\n },\n { once: true }\n );\n }\n\n const toRequestError = (error: unknown, path?: string): unknown => {\n if (error instanceof ExaError || error instanceof ExaAbortError) {\n return error;\n }\n const abortedBy =\n firstAbort ??\n (signal?.aborted\n ? \"signal\"\n : timeoutSignal?.signal.aborted\n ? \"timeout\"\n : undefined);\n if (abortedBy === \"timeout\") {\n return new ExaTimeoutError(timeout as number, path, error);\n }\n if (abortedBy === \"signal\") {\n return new ExaAbortError(error);\n }\n return error;\n };\n const stopTimeout = timeoutSignal?.dispose ?? NOOP_DISPOSE;\n\n if (disposers.length === 0) {\n return {\n signal: combined.signal,\n dispose: () => {},\n needsDispose: false,\n stopTimeout,\n toRequestError,\n };\n }\n\n let disposed = false;\n return {\n signal: combined.signal,\n dispose: () => {\n if (disposed) return;\n disposed = true;\n for (const dispose of disposers) {\n dispose();\n }\n },\n needsDispose: true,\n stopTimeout,\n toRequestError,\n };\n}\n\n/**\n * Keeps transport `dispose()` alive until the response body is consumed,\n * cancelled, or errors. Disposes immediately when there is no body.\n *\n * Used by `rawRequest` so signal listeners stay attached for the\n * full fetch lifetime (headers + body), not just until headers resolve.\n *\n * `mapError` translates a failed body read before the consumer sees it; the\n * SDK's streams pass `toRequestError` so a cancelled read rejects with\n * `ExaAbortError`. It is not applied to the Node stream fallback, whose body\n * is returned as is.\n */\nexport function withDisposeOnBodySettled(\n response: Response,\n dispose: () => void,\n mapError: (error: unknown) => unknown = (error) => error\n): Response {\n const body = response.body;\n if (!body) {\n dispose();\n return response;\n }\n\n // cross-fetch uses node-fetch on older Node versions, whose body is a Node\n // stream rather than a Web ReadableStream. Keep the original Response there.\n if (typeof body.getReader !== \"function\") {\n const nodeBody = body as unknown as NodeJS.ReadableStream;\n const settle = () => {\n nodeBody.removeListener(\"end\", settle);\n nodeBody.removeListener(\"close\", settle);\n nodeBody.removeListener(\"error\", settle);\n dispose();\n };\n nodeBody.once(\"end\", settle);\n nodeBody.once(\"close\", settle);\n nodeBody.once(\"error\", settle);\n return response;\n }\n\n let settled = false;\n const settle = () => {\n if (settled) return;\n settled = true;\n dispose();\n };\n\n const reader = body.getReader();\n const stream = new ReadableStream<Uint8Array>({\n async pull(controller) {\n try {\n const { done, value } = await reader.read();\n if (done) {\n settle();\n controller.close();\n return;\n }\n controller.enqueue(value);\n } catch (error) {\n settle();\n controller.error(mapError(error));\n }\n },\n cancel(reason) {\n settle();\n return reader.cancel(reason);\n },\n });\n\n // Preserve status/headers; body ownership moves to the wrapper stream.\n const wrapped = new Response(stream, {\n status: response.status,\n statusText: response.statusText,\n headers: response.headers,\n });\n // A synthetic Response otherwise loses redirect and URL metadata, including\n // on clones created by callers of the low-level rawRequest API.\n const preserveMetadata = (target: Response): Response => {\n Object.defineProperties(target, {\n url: { value: response.url },\n redirected: { value: response.redirected },\n type: { value: response.type },\n });\n const clone = target.clone.bind(target);\n Object.defineProperty(target, \"clone\", {\n value: () => preserveMetadata(clone()),\n });\n return target;\n };\n preserveMetadata(wrapped);\n\n // A reader or clone can outlive this Response. Only body settlement may\n // dispose transport resources; collecting the Response must not disable aborts.\n return wrapped;\n}\n\n/**\n * Waits `ms` milliseconds, rejecting with `ExaAbortError` as soon as `signal`\n * aborts. Polling helpers wait with it between polls so a cancelled poll does\n * not sit out its interval.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n if (!signal) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n return new Promise<void>((resolve, reject) => {\n if (signal.aborted) {\n reject(new ExaAbortError(signal.reason));\n return;\n }\n\n let timer: ReturnType<typeof setTimeout> | undefined;\n const onAbort = () => {\n clearTimeout(timer);\n reject(new ExaAbortError(signal.reason));\n };\n signal.addEventListener(\"abort\", onAbort, { once: true });\n timer = setTimeout(() => {\n signal.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n });\n}\n\n/**\n * Base for the API sub-clients (websets, research, agent, monitors).\n *\n * A public method receives the caller's request options as its trailing\n * argument and runs on `this.withRequestOptions(requestOptions)`: a view of\n * the client whose requests carry those options. Whatever the method calls on\n * that view, a request or another method such as a page fetch or a poll,\n * inherits them without changing any argument list.\n */\nexport abstract class RequestScopedClient {\n /** Request options of this view; undefined on the client itself. */\n protected requestOptions?: RequestOptions;\n\n /**\n * Returns a view of this client that sends `requestOptions` with every\n * request, on top of any the client already carries. Returns the client\n * itself when there is nothing to add.\n */\n protected withRequestOptions(requestOptions?: RequestOptions | null): this {\n if (mergeRequestOptions(requestOptions) === undefined) {\n return this;\n }\n const view: this = Object.create(this);\n view.requestOptions = mergeRequestOptions(\n this.requestOptions,\n requestOptions\n );\n return view;\n }\n\n /**\n * Returns the view a listing fetches its pages with after the first: this\n * one without a `cursor` in the extra `query`. A listing advances the\n * cursor itself; an extra `cursor` selects where it starts and, sent again,\n * would replace every later cursor and fetch that page forever.\n */\n protected forNextPage(): this {\n const query = this.requestOptions?.query;\n if (!query || !(\"cursor\" in query)) {\n return this;\n }\n const { cursor: _cursor, ...remaining } = query;\n const view: this = Object.create(this);\n view.requestOptions = { ...this.requestOptions, query: remaining };\n return view;\n }\n}\n","/**\n * Base client for the Exa Agent API.\n */\n\nimport { Exa } from \"../index\";\nimport { RequestScopedClient, streamRequestOptions } from \"../request-options\";\nimport { ListAgentRunEventsParams, ListAgentRunsParams } from \"./types\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\ntype RequestBody = Record<string, unknown>;\n\nexport class AgentBaseClient extends RequestScopedClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n super();\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<T> {\n if (this.requestOptions) {\n return this.client.request<T>(\n `/agent/runs${endpoint}`,\n method,\n data,\n params,\n headers,\n this.requestOptions\n );\n }\n return this.client.request<T>(\n `/agent/runs${endpoint}`,\n method,\n data,\n params,\n headers\n );\n }\n\n /**\n * Opens a streamed response. `timeout` covers the wait for the stream to\n * start; the caller's `signal` can cancel it at any point.\n */\n protected async rawRequest(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<Response> {\n const transport = streamRequestOptions(this.client, this.requestOptions);\n if (transport) {\n return this.client.rawRequest(\n `/agent/runs${endpoint}`,\n method,\n data,\n params,\n headers,\n transport\n );\n }\n return this.client.rawRequest(\n `/agent/runs${endpoint}`,\n method,\n data,\n params,\n headers\n );\n }\n\n protected buildPaginationParams(\n pagination?: ListAgentRunsParams | ListAgentRunEventsParams\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n\n return params;\n }\n}\n","/**\n * Shared Exa-Beta header construction for the agent API surfaces.\n */\n\nexport function headersForBetas(\n betas?: string[]\n): Record<string, string> | undefined {\n const betaValues = betas?.filter(Boolean);\n if (!betaValues?.length) return undefined;\n return { \"Exa-Beta\": betaValues.join(\",\") };\n}\n","/**\n * Types for the Exa Agent Monitors API (`/agent/monitors`).\n *\n * An Agent Monitor keeps a table of entities × fields fresh on the monitor's\n * cadence.\n */\n\n/** Beta identifier required for the Agent Monitors API. */\nexport const AGENT_MONITORS_BETA_HEADER = \"agent-monitors-2026-08-04\";\n\nexport interface AgentMonitorsBetaOptions {\n /** Beta feature identifiers to enable for this request. */\n betas: string[];\n}\n\nexport type AgentMonitorStatus =\n | \"creating\"\n | \"pending_first_refresh\"\n | \"active\";\n\nexport type AgentMonitorFieldMode = \"static\" | \"dynamic\";\n\n/** The type of a field's cell values. */\nexport type AgentMonitorFieldValueType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"date\"\n | \"url\"\n | \"email\"\n | \"phone\";\n\n/** A field the monitor keeps fresh for every entity. */\nexport interface AgentMonitorField {\n id: string;\n name: string;\n description: string;\n /** @deprecated Not returned by the API. */\n mode?: AgentMonitorFieldMode;\n /** The type of the field's cell values. */\n type: AgentMonitorFieldValueType;\n}\n\n/** An entity tracked by the monitor. */\nexport interface AgentMonitorEntity {\n id: string;\n name: string;\n domain?: string;\n canonicalEntityId?: string;\n}\n\n/** One grounding citation for a cell value; the Agent API's citation shape. */\nexport interface AgentMonitorCitation {\n url: string;\n title?: string;\n note?: string;\n}\n\n/** One cell value: a field's current content for an entity. */\nexport interface AgentMonitorContent {\n value: unknown;\n /** Grounding for the value, in the Agent API's citation shape. */\n citations?: AgentMonitorCitation[];\n updatedAt: string;\n}\n\n/** Refresh progress on the monitor object; `idle` outside an active refresh. */\nexport type AgentMonitorRefresh =\n | { state: \"idle\" }\n | {\n state: \"running\";\n entitiesProcessed: number;\n entitiesTotal: number;\n startedAt: string;\n };\n\n/** Creation progress on the monitor object; `idle` once the monitor is set up. */\nexport type AgentMonitorCreation =\n | { state: \"idle\" }\n | {\n state: \"running\";\n entitiesProcessed: number;\n entitiesTotal: number;\n startedAt: string;\n };\n\n/** ACU consumption on the monitor object; ACUs are the unit Agent runs bill in. */\nexport interface AgentMonitorUsage {\n /** Lifetime ACUs consumed by the monitor's refreshes (creation's first refresh included). */\n totalAcus: number;\n /** ACUs consumed by the most recently completed refresh run. */\n lastRefreshAcus: number;\n}\n\nexport interface AgentMonitor {\n id: string;\n object: \"agent_monitor\";\n status: AgentMonitorStatus;\n /** Refresh cadence, e.g. `\"12h\"` or `\"7d\"`; also each refresh's lookback window. */\n cadence: string;\n fields: AgentMonitorField[];\n entityCount: number;\n version: number;\n createdAt: string;\n lastRefreshAt: string | null;\n refresh: AgentMonitorRefresh;\n creation: AgentMonitorCreation;\n usage: AgentMonitorUsage;\n sourceRunId?: string;\n}\n\n/** One entity and its current contents, keyed by field id. */\nexport interface AgentMonitorEntityView {\n entity: AgentMonitorEntity;\n contents: Record<string, AgentMonitorContent>;\n}\n\n/**\n * Entity and field references on a change item. Join on `id`. The other\n * attributes show current values for display and are absent once the entity\n * or field is removed.\n */\nexport interface AgentMonitorChangeEntity {\n id: string;\n name?: string;\n domain?: string;\n canonicalEntityId?: string;\n}\n\nexport interface AgentMonitorChangeField {\n id: string;\n name?: string;\n}\n\n/** One content change from the monitor's change feed. */\nexport interface AgentMonitorChange {\n type: \"content.upserted\";\n entity: AgentMonitorChangeEntity;\n field: AgentMonitorChangeField;\n content: AgentMonitorContent;\n version: number;\n /** ISO-8601 commit time of the change event. */\n createdAt: string;\n}\n\n// --- Request params ---\n\n/** An entity to track. Each name and domain pair must be unique. */\nexport interface CreateAgentMonitorEntityParams {\n name: string;\n /** The entity's website domain, used to identify the entity. */\n domain: string;\n /** Extra disambiguation context for entity resolution of ambiguous names. */\n description?: string;\n}\n\n/** A field to keep fresh. */\nexport interface CreateAgentMonitorFieldParams {\n name: string;\n description: string;\n /**\n * The type of the field's values. Defaults to `\"string\"`. Values are\n * converted to this type where possible. An unsupported type fails the\n * request, including the deprecated values `\"static\"` and `\"dynamic\"`.\n */\n type?: AgentMonitorFieldValueType | AgentMonitorFieldMode;\n /** @deprecated Omit this field. The API rejects requests that set it. */\n mode?: AgentMonitorFieldMode;\n}\n\nexport interface CreateAgentMonitorParams {\n /**\n * How often the monitor refreshes, e.g. `\"12h\"` or `\"7d\"` (minimum 6h).\n * Also each refresh's news lookback window.\n */\n cadence: string;\n entities: CreateAgentMonitorEntityParams[];\n fields: CreateAgentMonitorFieldParams[];\n}\n\nexport interface CreateAgentMonitorOptions {\n /**\n * Sent as the `Idempotency-Key` header. A retried create with the same key\n * returns the monitor the first attempt created (resuming any unfinished\n * entity ingestion) instead of creating a duplicate. Reusing a key with a\n * different body is a 409.\n */\n idempotencyKey?: string;\n}\n\nexport interface ListAgentMonitorsParams {\n cursor?: string;\n limit?: number;\n}\n\nexport interface ListAgentMonitorEntitiesParams {\n cursor?: string;\n limit?: number;\n /** Only return entities whose contents were updated at or after this ISO-8601 timestamp. */\n since?: string;\n}\n\nexport interface ListAgentMonitorChangesParams {\n cursor?: string;\n limit?: number;\n /** Only return changes committed at or after this ISO-8601 timestamp. */\n since?: string;\n}\n\nexport interface AddAgentMonitorEntitiesParams {\n entities: CreateAgentMonitorEntityParams[];\n}\n\n// --- Responses ---\n\nexport interface ListAgentMonitorsResponse {\n object: \"list\";\n data: AgentMonitor[];\n hasMore: boolean;\n nextCursor: string | null;\n}\n\nexport interface ListAgentMonitorEntitiesResponse {\n object: \"list\";\n data: AgentMonitorEntityView[];\n hasMore: boolean;\n nextCursor: string | null;\n /**\n * Latest change version of the monitor, for showing whether a reader is up\n * to date. Not a cursor. Page with `nextCursor`.\n */\n version: number;\n}\n\nexport interface ListAgentMonitorChangesResponse {\n object: \"list\";\n data: AgentMonitorChange[];\n hasMore: boolean;\n /** Opaque; resume the feed from the last served change. Null when data is empty. */\n nextCursor: string | null;\n /**\n * Latest change version of the monitor, for showing whether a reader is up\n * to date. Not a cursor. Page with `nextCursor`.\n */\n version: number;\n}\n\nexport interface DeletedAgentMonitor {\n id: string;\n object: \"agent_monitor.deleted\";\n deleted: true;\n}\n\n// --- Backtests ---\n\n/**\n * Params for a backtest that fills fields for entities over a past window.\n * Fields answered from news use only news published between `startTime` and\n * `endTime`. Other fields return present values. No monitor is created.\n */\nexport interface CreateAgentMonitorBacktestParams {\n entities: CreateAgentMonitorEntityParams[];\n fields: CreateAgentMonitorFieldParams[];\n /** Start of the news window as an ISO-8601 UTC timestamp. */\n startTime: string;\n /** End of the news window as an ISO-8601 UTC timestamp. */\n endTime: string;\n}\n\n/** One backtest cell, with a value and its grounding citations. */\nexport interface AgentMonitorBacktestContent {\n value: unknown;\n citations: AgentMonitorCitation[];\n}\n\n/** One entity's backtest result, with populated cells keyed by field name. */\nexport interface AgentMonitorBacktestEntity {\n name: string;\n /** Populated cells by field name. Fields with no update are absent. */\n contents: Record<string, AgentMonitorBacktestContent>;\n}\n\n/** The computed body of a finished backtest, embedded in the job once it completes. */\nexport interface AgentMonitorBacktestResult {\n data: AgentMonitorBacktestEntity[];\n failedEntities?: Array<{ name: string; reason: string }>;\n /** Caveats about how the backtest was computed. */\n warnings?: string[];\n}\n\nexport type AgentMonitorBacktestStatus = \"running\" | \"completed\" | \"failed\";\n\n/**\n * A backtest job. `create` returns it as `running`, and `get` polls it to\n * `completed` (result fields present) or `failed`. Jobs expire and read as\n * 404 after `expiresAt`.\n */\nexport type AgentMonitorBacktest = {\n id: string;\n object: \"agent_monitor.backtest\";\n /** The backtested news window, echoed back as normalized ISO-8601 timestamps. */\n startTime: string;\n endTime: string;\n createdAt: string;\n expiresAt: string;\n} & (\n | { status: \"running\" }\n | ({ status: \"completed\" } & AgentMonitorBacktestResult)\n | { status: \"failed\"; error: string }\n);\n\nexport interface AgentMonitorBacktestWaitOptions {\n pollInterval?: number;\n timeoutMs?: number;\n}\n","/**\n * Base client for the Exa Agent Monitors API.\n */\n\nimport { ExaError, HttpStatusCode } from \"../../errors\";\nimport { Exa } from \"../../index\";\nimport { RequestScopedClient } from \"../../request-options\";\nimport { headersForBetas } from \"../betas\";\nimport {\n AGENT_MONITORS_BETA_HEADER,\n ListAgentMonitorChangesParams,\n ListAgentMonitorEntitiesParams,\n ListAgentMonitorsParams,\n} from \"./types\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\ntype RequestBody = Record<string, any>;\n\nexport class AgentMonitorsBaseClient extends RequestScopedClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n super();\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n betas: string[],\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<T> {\n if (!betas?.includes(AGENT_MONITORS_BETA_HEADER)) {\n throw new ExaError(\n `betas must include the Agent Monitors beta identifier (\"${AGENT_MONITORS_BETA_HEADER}\")`,\n HttpStatusCode.BadRequest\n );\n }\n\n const requestHeaders = {\n ...headersForBetas(betas),\n ...headers,\n };\n if (this.requestOptions) {\n return this.client.request<T>(\n `/agent/monitors${endpoint}`,\n method,\n data,\n params,\n requestHeaders,\n this.requestOptions\n );\n }\n return this.client.request<T>(\n `/agent/monitors${endpoint}`,\n method,\n data,\n params,\n requestHeaders\n );\n }\n\n protected buildPaginationParams(\n pagination?:\n | ListAgentMonitorsParams\n | ListAgentMonitorEntitiesParams\n | ListAgentMonitorChangesParams\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n if (\"since\" in pagination && pagination.since)\n params.since = pagination.since;\n\n return params;\n }\n}\n","/**\n * Client for the Exa Agent Monitors API (`/agent/monitors`).\n */\n\nimport { Exa } from \"../../index\";\nimport { AgentMonitorsBaseClient } from \"./base\";\nimport {\n AddAgentMonitorEntitiesParams,\n AgentMonitor,\n AgentMonitorChange,\n AgentMonitorEntityView,\n AgentMonitorBacktest,\n AgentMonitorBacktestWaitOptions,\n AgentMonitorsBetaOptions,\n CreateAgentMonitorOptions,\n CreateAgentMonitorParams,\n CreateAgentMonitorBacktestParams,\n DeletedAgentMonitor,\n ListAgentMonitorChangesParams,\n ListAgentMonitorChangesResponse,\n ListAgentMonitorEntitiesParams,\n ListAgentMonitorEntitiesResponse,\n ListAgentMonitorsParams,\n ListAgentMonitorsResponse,\n} from \"./types\";\nimport { sleep, type RequestOptions } from \"../../request-options\";\n\nconst DEFAULT_BACKTEST_POLL_INTERVAL_MS = 2000;\nconst DEFAULT_BACKTEST_POLL_TIMEOUT_MS = 60 * 60 * 1000;\n\ntype AgentMonitorTerminalBacktest = AgentMonitorBacktest & {\n status: \"completed\" | \"failed\";\n};\ntype AgentMonitorCompletedBacktest = AgentMonitorBacktest & {\n status: \"completed\";\n};\n\nexport class AgentMonitorBacktestFailedError extends Error {\n backtest: AgentMonitorBacktest & { status: \"failed\" };\n\n constructor(backtest: AgentMonitorBacktest & { status: \"failed\" }) {\n super(backtest.error ?? `Agent monitor backtest ${backtest.id} failed`);\n this.name = \"AgentMonitorBacktestFailedError\";\n this.backtest = backtest;\n }\n}\n\nexport class AgentMonitorEntitiesClient extends AgentMonitorsBaseClient {\n /**\n * Add entities to an existing Agent Monitor. Added entities are resolved\n * and backfilled shortly after the request completes, then update on the\n * monitor's regular refresh cadence.\n */\n async add(\n monitorId: string,\n params: AddAgentMonitorEntitiesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...payload } = params;\n return scoped.request<AgentMonitor>(\n `/${monitorId}/entities`,\n betas,\n \"POST\",\n payload\n );\n }\n\n /**\n * Page an Agent Monitor's current entities and contents, optionally\n * filtered by update time.\n */\n async list(\n monitorId: string,\n options: ListAgentMonitorEntitiesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<ListAgentMonitorEntitiesResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...pagination } = options;\n const params = this.buildPaginationParams(pagination);\n return scoped.request<ListAgentMonitorEntitiesResponse>(\n `/${monitorId}/entities`,\n betas,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all of a monitor's entities, handling pagination\n * automatically.\n */\n async *listAll(\n monitorId: string,\n options: ListAgentMonitorEntitiesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AgentMonitorEntityView> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = options.cursor;\n const { betas, ...pagination } = options;\n const pageOptions: ListAgentMonitorEntitiesParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(monitorId, { ...pageOptions, betas });\n\n for (const entityView of response.data) {\n yield entityView;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all of a monitor's entities into an array.\n */\n async getAll(\n monitorId: string,\n options: ListAgentMonitorEntitiesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitorEntityView[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const entities: AgentMonitorEntityView[] = [];\n for await (const entityView of scoped.listAll(monitorId, options)) {\n entities.push(entityView);\n }\n return entities;\n }\n}\n\nexport class AgentMonitorChangesClient extends AgentMonitorsBaseClient {\n /**\n * Page an Agent Monitor's content change feed since a cursor or timestamp.\n */\n async list(\n monitorId: string,\n options: ListAgentMonitorChangesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<ListAgentMonitorChangesResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...pagination } = options;\n const params = this.buildPaginationParams(pagination);\n return scoped.request<ListAgentMonitorChangesResponse>(\n `/${monitorId}/changes`,\n betas,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through a monitor's change feed, handling pagination\n * automatically.\n */\n async *listAll(\n monitorId: string,\n options: ListAgentMonitorChangesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AgentMonitorChange> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = options.cursor;\n const { betas, ...pagination } = options;\n const pageOptions: ListAgentMonitorChangesParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(monitorId, { ...pageOptions, betas });\n\n for (const change of response.data) {\n yield change;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect a monitor's change feed into an array.\n */\n async getAll(\n monitorId: string,\n options: ListAgentMonitorChangesParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitorChange[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const changes: AgentMonitorChange[] = [];\n for await (const change of scoped.listAll(monitorId, options)) {\n changes.push(change);\n }\n return changes;\n }\n}\n\nexport class AgentMonitorBacktestsClient extends AgentMonitorsBaseClient {\n /**\n * Start an async backtest of entities × fields over an explicit past news\n * window. Returns a `running` job. Poll it with `get`, or use\n * `createAndWait`, for the result.\n */\n async create(\n params: CreateAgentMonitorBacktestParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitorBacktest> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...payload } = params;\n return scoped.request<AgentMonitorBacktest>(\n \"/backtest\",\n betas,\n \"POST\",\n payload\n );\n }\n\n /**\n * Poll a backtest job for its status and, once completed, its result.\n * Jobs expire and read as 404 after `expiresAt`.\n */\n async get(\n backtestId: string,\n options: AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitorBacktest> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<AgentMonitorBacktest>(\n `/backtest/${backtestId}`,\n options.betas,\n \"GET\"\n );\n }\n\n /**\n * Poll a backtest job until it reaches a terminal status.\n */\n async pollUntilFinished(\n backtestId: string,\n options: AgentMonitorBacktestWaitOptions & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitorTerminalBacktest> {\n const scoped = this.withRequestOptions(requestOptions);\n const pollInterval =\n options.pollInterval ?? DEFAULT_BACKTEST_POLL_INTERVAL_MS;\n const timeoutMs = options.timeoutMs ?? DEFAULT_BACKTEST_POLL_TIMEOUT_MS;\n const startTime = Date.now();\n\n while (true) {\n const backtest = await scoped.get(backtestId, { betas: options.betas });\n if (backtest.status !== \"running\") {\n return backtest;\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Agent monitor backtest ${backtestId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await sleep(pollInterval, scoped.requestOptions?.signal);\n }\n }\n\n /**\n * Start a backtest and wait for its result. Throws\n * AgentMonitorBacktestFailedError if the backtest fails.\n */\n async createAndWait(\n params: CreateAgentMonitorBacktestParams & AgentMonitorsBetaOptions,\n options?: AgentMonitorBacktestWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitorCompletedBacktest> {\n const scoped = this.withRequestOptions(requestOptions);\n const backtest = await scoped.create(params);\n const terminalBacktest =\n backtest.status === \"running\"\n ? await scoped.pollUntilFinished(backtest.id, {\n ...options,\n betas: params.betas,\n })\n : backtest;\n if (terminalBacktest.status === \"failed\") {\n throw new AgentMonitorBacktestFailedError(terminalBacktest);\n }\n return terminalBacktest as AgentMonitorCompletedBacktest;\n }\n}\n\nexport class AgentMonitorsClient extends AgentMonitorsBaseClient {\n /**\n * Client for a monitor's entities.\n */\n entities: AgentMonitorEntitiesClient;\n\n /**\n * Client for a monitor's content change feed.\n */\n changes: AgentMonitorChangesClient;\n\n /**\n * Client for one-shot backtest jobs.\n */\n backtests: AgentMonitorBacktestsClient;\n\n constructor(client: Exa) {\n super(client);\n this.entities = new AgentMonitorEntitiesClient(client);\n this.changes = new AgentMonitorChangesClient(client);\n this.backtests = new AgentMonitorBacktestsClient(client);\n }\n\n /**\n * Create an Agent Monitor from its entities, fields, and cadence.\n * Creation is async: the monitor is returned with status `creating` and\n * becomes `active` once its first refresh completes.\n */\n async create(\n params: CreateAgentMonitorParams & AgentMonitorsBetaOptions,\n options?: CreateAgentMonitorOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...payload } = params;\n const headers = options?.idempotencyKey\n ? { \"Idempotency-Key\": options.idempotencyKey }\n : undefined;\n return scoped.request<AgentMonitor>(\n \"\",\n betas,\n \"POST\",\n payload,\n undefined,\n headers\n );\n }\n\n /**\n * Get an Agent Monitor by ID, including refresh progress.\n */\n async get(\n monitorId: string,\n options: AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<AgentMonitor>(`/${monitorId}`, options.betas, \"GET\");\n }\n\n /**\n * List the team's Agent Monitors.\n */\n async list(\n options: ListAgentMonitorsParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<ListAgentMonitorsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...pagination } = options;\n const params = this.buildPaginationParams(pagination);\n return scoped.request<ListAgentMonitorsResponse>(\n \"\",\n betas,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all Agent Monitors, handling pagination automatically.\n */\n async *listAll(\n options: ListAgentMonitorsParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AgentMonitor> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = options.cursor;\n const { betas, ...pagination } = options;\n const pageOptions: ListAgentMonitorsParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list({ ...pageOptions, betas });\n\n for (const monitor of response.data) {\n yield monitor;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Agent Monitors into an array.\n */\n async getAll(\n options: ListAgentMonitorsParams & AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentMonitor[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const monitors: AgentMonitor[] = [];\n for await (const monitor of scoped.listAll(options)) {\n monitors.push(monitor);\n }\n return monitors;\n }\n\n /**\n * Delete an Agent Monitor and stop its refreshes.\n */\n async delete(\n monitorId: string,\n options: AgentMonitorsBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<DeletedAgentMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<DeletedAgentMonitor>(\n `/${monitorId}`,\n options.betas,\n \"DELETE\"\n );\n }\n}\n","/**\n * Types for the Exa Agent API.\n */\n\nimport { ZodSchema } from \"zod\";\n\n/**\n * @deprecated `exa.agent` does not need a beta header.\n */\nexport const AGENT_BETA_HEADER = \"agent-2026-05-07\";\n\nexport const AGENT_MAX_EFFORT_BETA = \"agent-max-effort-2026-07-27\";\n\nexport interface AgentBetaOptions {\n /**\n * @deprecated `exa.agent` does not need a beta header. Values supplied to\n * `exa.beta.agent` are sent as the `Exa-Beta` header.\n */\n betas?: string[];\n}\n\nexport type AgentRunStatus =\n | \"queued\"\n | \"running\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\";\n\nexport type AgentStopReason =\n | \"schema_satisfied\"\n | \"budget_reached\"\n | \"time_limit_reached\"\n | \"stopped\"\n | \"error\"\n | \"cancelled\";\n\nexport type AgentConfidence = \"low\" | \"medium\" | \"high\";\n\nexport type AgentEffort =\n | \"minimal\"\n | \"low\"\n | \"medium\"\n | \"high\"\n | \"xhigh\"\n | \"auto\"\n | \"ultra\"\n | \"max\";\n\n/** Per-run spend ceiling for the metered `auto` and `ultra` efforts. */\nexport interface AgentBudget {\n /**\n * Maximum spend for the run in US dollars, from 1 to 100. Only for `auto`\n * and `ultra` effort. Defaults to 5 for `auto` and 20 for `ultra`.\n */\n maxCostDollars?: number;\n /**\n * Soft wall-clock ceiling in seconds (300–10,800). Only accepted for `ultra`.\n */\n maxDurationSeconds?: number;\n}\n\n/**\n * Identifier of an Exa Connect data provider. See the Exa Connect docs for the\n * full list.\n */\nexport type AgentDataSourceProvider = string;\n\n/** Exa Connect data source to enable for an Agent run. */\nexport interface AgentDataSource {\n /** Exa Connect data provider to enable for the run. */\n provider: AgentDataSourceProvider;\n}\n\nexport interface AgentInput {\n data?: Record<string, unknown>[];\n exclusion?: Record<string, unknown>[];\n [key: string]: unknown;\n}\n\nexport interface AgentGroundingCitation {\n url: string;\n title?: string | null;\n [key: string]: unknown;\n}\n\nexport interface AgentGroundingEntry {\n field: string;\n citations: AgentGroundingCitation[];\n score?: number | null;\n confidence?: AgentConfidence | null;\n [key: string]: unknown;\n}\n\nexport interface AgentOutput {\n text?: string | null;\n structured?: unknown;\n grounding?: AgentGroundingEntry[] | null;\n [key: string]: unknown;\n}\n\nexport interface AgentUsage {\n agentComputeUnits?: number;\n searches?: number;\n emails?: number;\n phoneNumbers?: number;\n /** Per-provider tool call counts for Exa Connect data sources used during the run. */\n dataSources?: Record<string, number>;\n [key: string]: unknown;\n}\n\nexport interface AgentCostDollars {\n total?: number;\n agentCompute?: number;\n search?: number;\n emails?: number;\n phoneNumbers?: number;\n /** Per-provider cost in dollars for Exa Connect data sources used during the run. */\n dataSources?: Record<string, number>;\n [key: string]: unknown;\n}\n\nexport interface AgentError {\n type?: string;\n code?: string;\n message?: string;\n path?: string;\n keyword?: string;\n expected?: unknown;\n actual?: unknown;\n [key: string]: unknown;\n}\n\nexport interface AgentRun {\n id: string;\n object?: string;\n status: AgentRunStatus;\n stopReason?: AgentStopReason | null;\n createdAt?: string;\n completedAt?: string | null;\n request?: Record<string, unknown>;\n output?: AgentOutput | null;\n usage?: AgentUsage;\n costDollars?: AgentCostDollars;\n error?: AgentError;\n [key: string]: unknown;\n}\n\nexport type AgentRunTyped<T> = AgentRun & {\n output?: (AgentOutput & { structured?: T }) | null;\n};\n\nexport interface ListAgentRunsParams {\n cursor?: string;\n limit?: number;\n}\n\nexport interface ListAgentRunsResponse {\n object?: string;\n data: AgentRun[];\n hasMore: boolean;\n nextCursor: string | null;\n}\n\nexport interface DeletedAgentRun {\n id: string;\n object?: string;\n deleted: boolean;\n}\n\nexport interface AgentEvent {\n id?: string;\n event: string;\n data: Record<string, unknown>;\n createdAt?: string;\n [key: string]: unknown;\n}\n\nexport interface ListAgentRunEventsParams {\n cursor?: string;\n limit?: number;\n}\n\nexport interface ListAgentRunEventsResponse {\n object?: string;\n data: AgentEvent[];\n hasMore: boolean;\n nextCursor: string | null;\n}\n\nexport interface CreateAgentRunParams {\n query: string;\n systemPrompt?: string;\n input?: AgentInput;\n outputSchema?: Record<string, unknown>;\n effort?: AgentEffort;\n budget?: AgentBudget;\n previousRunId?: string;\n metadata?: Record<string, unknown>;\n /** Exa Connect data providers to enable for the run. Each entry enables all of that provider's tools. */\n dataSources?: AgentDataSource[];\n /**\n * An opaque ID you assign to the end user this run is made for, such as a\n * UUID, used to attribute usage to that end user. Must not contain personal\n * information such as an email address, phone number, username or name.\n * Hash such values before sending them. 1 to 64 characters: letters, digits,\n * `_` and `-`. Retained even when your team has Zero Data Retention\n * enabled. Does not affect results. A follow-up run (`previousRunId`) that\n * omits it inherits the identifier of the run it continues.\n */\n userIdentifier?: string;\n}\n\nexport type CreateAgentRunParamsTyped<T> = Omit<\n CreateAgentRunParams,\n \"outputSchema\"\n> & {\n outputSchema?: T;\n};\n\nexport type AgentCreateOptions<T = Record<string, unknown>> =\n CreateAgentRunParamsTyped<Record<string, unknown> | ZodSchema<T>> & {\n stream?: boolean;\n };\n","/**\n * Client for the Exa Agent API.\n */\n\nimport { ZodSchema } from \"zod\";\nimport { Exa } from \"../index\";\nimport { exaErrorFromResponse } from \"../error-response\";\nimport { isZodSchema, zodToJsonSchema } from \"../zod-utils\";\nimport { AgentBaseClient } from \"./base\";\nimport { headersForBetas } from \"./betas\";\nimport { AgentMonitorsClient } from \"./monitors/client\";\nimport {\n AGENT_MAX_EFFORT_BETA,\n AgentBetaOptions,\n AgentCreateOptions,\n AgentEvent,\n AgentRun,\n AgentRunTyped,\n CreateAgentRunParams,\n DeletedAgentRun,\n ListAgentRunEventsParams,\n ListAgentRunEventsResponse,\n ListAgentRunsParams,\n ListAgentRunsResponse,\n} from \"./types\";\nimport { sleep, type RequestOptions } from \"../request-options\";\n\ntype WithBetaOptions<T> = T & AgentBetaOptions;\ntype AgentTerminalStatus = \"completed\" | \"failed\" | \"cancelled\";\ntype AgentTerminalRun = AgentRun & { status: AgentTerminalStatus };\ntype AgentTerminalRunTyped<T> = AgentRunTyped<T> & {\n status: AgentTerminalStatus;\n};\ntype AgentCompletedRun = AgentRun & { status: \"completed\" };\ntype AgentCompletedRunTyped<T> = AgentRunTyped<T> & {\n status: \"completed\";\n};\nconst DEFAULT_AGENT_POLL_INTERVAL_MS = 1000;\nconst DEFAULT_AGENT_POLL_TIMEOUT_MS = 60 * 60 * 1000;\nconst DEFAULT_AGENT_CREATE_AND_WAIT_TIMEOUT_MS = 2 * 60 * 1000;\nconst TERMINAL_AGENT_RUN_STATUSES = new Set<AgentTerminalStatus>([\n \"completed\",\n \"failed\",\n \"cancelled\",\n]);\nexport type AgentWaitOptions = {\n pollInterval?: number;\n timeoutMs?: number;\n};\n\nexport class AgentRunFailedError extends Error {\n run: AgentRun & { status: \"failed\" };\n\n constructor(run: AgentRun & { status: \"failed\" }) {\n super(run.error?.message ?? `Agent run ${run.id} failed`);\n this.name = \"AgentRunFailedError\";\n this.run = run;\n }\n}\n\nexport class AgentRunCancelledError extends Error {\n run: AgentRun & { status: \"cancelled\" };\n\n constructor(run: AgentRun & { status: \"cancelled\" }) {\n super(`Agent run ${run.id} was cancelled`);\n this.name = \"AgentRunCancelledError\";\n this.run = run;\n }\n}\n\nfunction isTerminalAgentRunStatus(\n status: AgentRun[\"status\"]\n): status is AgentTerminalStatus {\n return TERMINAL_AGENT_RUN_STATUSES.has(status as AgentTerminalStatus);\n}\n\nfunction ensureCompletedRun<T>(\n run: AgentTerminalRunTyped<T>\n): AgentCompletedRunTyped<T> {\n if (run.status === \"failed\") {\n throw new AgentRunFailedError(run as AgentRun & { status: \"failed\" });\n }\n if (run.status === \"cancelled\") {\n throw new AgentRunCancelledError(run as AgentRun & { status: \"cancelled\" });\n }\n return run as AgentCompletedRunTyped<T>;\n}\n\nfunction createAndWaitPollOptions(\n options?: AgentWaitOptions\n): AgentWaitOptions {\n return {\n pollInterval: options?.pollInterval ?? DEFAULT_AGENT_POLL_INTERVAL_MS,\n timeoutMs: options?.timeoutMs ?? DEFAULT_AGENT_CREATE_AND_WAIT_TIMEOUT_MS,\n };\n}\n\nfunction buildAgentRunPayload<T>(params: AgentCreateOptions<T>): {\n stream?: boolean;\n payload: Record<string, unknown>;\n} {\n const { stream, outputSchema, ...rest } = params;\n let schema = outputSchema;\n if (schema && isZodSchema(schema)) {\n schema = zodToJsonSchema(schema as ZodSchema<T>);\n }\n\n const payload: Record<string, unknown> = { ...rest };\n if (schema) {\n payload.outputSchema = schema;\n }\n\n return { stream, payload };\n}\n\nasync function* streamAgentEvents(\n response: Response\n): AsyncGenerator<AgentEvent> {\n if (!response.body) {\n throw new Error(\"No response body for SSE stream\");\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n let doneReading = false;\n\n const processPart = (part: string): AgentEvent | null => {\n const event: Partial<AgentEvent> = {};\n const dataLines: string[] = [];\n\n for (const line of part.split(\"\\n\")) {\n if (!line || !line.includes(\":\")) continue;\n const [field, ...rest] = line.split(\":\");\n const value = rest.join(\":\").replace(/^ /, \"\");\n\n if (field === \"id\") event.id = value;\n if (field === \"event\") event.event = value;\n if (field === \"data\") dataLines.push(value);\n }\n\n if (!event.event || dataLines.length === 0) return null;\n\n try {\n event.data = JSON.parse(dataLines.join(\"\\n\"));\n } catch {\n event.data = { value: dataLines.join(\"\\n\") };\n }\n\n return event as AgentEvent;\n };\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n doneReading = true;\n break;\n }\n buffer += decoder.decode(value, { stream: true });\n\n const parts = buffer.split(\"\\n\\n\");\n buffer = parts.pop() ?? \"\";\n\n for (const part of parts) {\n const event = processPart(part);\n if (event) yield event;\n }\n }\n\n if (buffer.trim()) {\n const event = processPart(buffer.trim());\n if (event) yield event;\n }\n } finally {\n if (!doneReading) {\n await reader.cancel();\n }\n reader.releaseLock();\n }\n}\n\nexport class AgentRunEventsClient extends AgentBaseClient {\n /**\n * List stored events for an Agent run.\n */\n async list(\n runId: string,\n options?: ListAgentRunEventsParams,\n requestOptions?: RequestOptions\n ): Promise<ListAgentRunEventsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListAgentRunEventsResponse>(\n `/${runId}/events`,\n \"GET\",\n undefined,\n params\n );\n }\n}\n\nexport class AgentRunsClient extends AgentBaseClient {\n /**\n * Client for Agent run events.\n */\n events: AgentRunEventsClient;\n\n constructor(client: Exa) {\n super(client);\n this.events = new AgentRunEventsClient(client);\n }\n\n /**\n * Create an Agent run.\n */\n async create<T>(\n params: AgentCreateOptions<T> & { stream: true },\n requestOptions?: RequestOptions\n ): Promise<AsyncGenerator<AgentEvent>>;\n async create<T>(\n params: AgentCreateOptions<T> & { stream?: false },\n requestOptions?: RequestOptions\n ): Promise<AgentRunTyped<T>>;\n async create(\n params: CreateAgentRunParams,\n requestOptions?: RequestOptions\n ): Promise<AgentRun>;\n async create<T>(\n params: AgentCreateOptions<T>,\n requestOptions?: RequestOptions\n ): Promise<AgentRun | AgentRunTyped<T> | AsyncGenerator<AgentEvent>> {\n const scoped = this.withRequestOptions(requestOptions);\n const { stream, payload } = buildAgentRunPayload(params);\n\n if (stream) {\n const response = await scoped.rawRequest(\"\", \"POST\", payload, undefined, {\n Accept: \"text/event-stream\",\n });\n if (!response.ok) {\n throw await exaErrorFromResponse(response, \"/agent/runs\");\n }\n return streamAgentEvents(response);\n }\n\n return scoped.request<AgentRunTyped<T>>(\"\", \"POST\", payload);\n }\n\n /**\n * Get an Agent run by ID.\n */\n async get(runId: string, requestOptions?: RequestOptions): Promise<AgentRun> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<AgentRun>(`/${runId}`, \"GET\");\n }\n\n /**\n * List Agent runs.\n */\n async list(\n options?: ListAgentRunsParams,\n requestOptions?: RequestOptions\n ): Promise<ListAgentRunsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListAgentRunsResponse>(\"\", \"GET\", undefined, params);\n }\n\n /**\n * Iterate through all Agent runs, handling pagination automatically.\n */\n async *listAll(\n options?: ListAgentRunsParams,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AgentRun> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const run of response.data) {\n yield run;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Agent runs into an array.\n */\n async getAll(\n options?: ListAgentRunsParams,\n requestOptions?: RequestOptions\n ): Promise<AgentRun[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const runs: AgentRun[] = [];\n for await (const run of scoped.listAll(options)) {\n runs.push(run);\n }\n return runs;\n }\n\n /**\n * Cancel a queued or running Agent run.\n */\n async cancel(\n runId: string,\n requestOptions?: RequestOptions\n ): Promise<AgentRun> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<AgentRun>(`/${runId}/cancel`, \"POST\");\n }\n\n /**\n * Stop a running Agent run, completing it early with the results\n * gathered so far. Only supported for `ultra` effort runs.\n */\n async stop(\n runId: string,\n requestOptions?: RequestOptions\n ): Promise<AgentRun> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<AgentRun>(`/${runId}/stop`, \"POST\");\n }\n\n /**\n * Delete a stored Agent run.\n */\n async delete(\n runId: string,\n requestOptions?: RequestOptions\n ): Promise<DeletedAgentRun> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<DeletedAgentRun>(`/${runId}`, \"DELETE\");\n }\n\n /**\n * Poll an Agent run until it reaches a terminal status.\n */\n async pollUntilFinished(\n runId: string,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentTerminalRun> {\n const scoped = this.withRequestOptions(requestOptions);\n const pollInterval =\n options?.pollInterval ?? DEFAULT_AGENT_POLL_INTERVAL_MS;\n const timeoutMs = options?.timeoutMs ?? DEFAULT_AGENT_POLL_TIMEOUT_MS;\n const startTime = Date.now();\n\n while (true) {\n const run = await scoped.get(runId);\n if (isTerminalAgentRunStatus(run.status)) {\n return run as AgentTerminalRun;\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Agent run ${runId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await sleep(pollInterval, scoped.requestOptions?.signal);\n }\n }\n\n /**\n * Create an Agent run and wait until it reaches a terminal status.\n */\n async createAndWait<T>(\n params: Omit<AgentCreateOptions<T>, \"stream\">,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentCompletedRunTyped<T>>;\n async createAndWait(\n params: CreateAgentRunParams,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentCompletedRun>;\n async createAndWait<T>(\n params: Omit<AgentCreateOptions<T>, \"stream\">,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentCompletedRunTyped<T>> {\n const scoped = this.withRequestOptions(requestOptions);\n const { stream: _stream, ...createParams } =\n params as AgentCreateOptions<T>;\n const run = (await scoped.create(\n createParams as AgentCreateOptions<T> & { stream?: false }\n )) as AgentRunTyped<T>;\n const runId = (run as AgentRun).id;\n const terminalRun = (await scoped.pollUntilFinished(\n runId,\n createAndWaitPollOptions(options)\n )) as AgentTerminalRunTyped<T>;\n return ensureCompletedRun(terminalRun);\n }\n}\n\nexport class AgentClient {\n /**\n * @internal\n */\n readonly client: Exa;\n\n /**\n * Client for Agent runs.\n */\n runs: AgentRunsClient;\n\n constructor(client: Exa) {\n this.client = client;\n this.runs = new AgentRunsClient(client);\n }\n}\n\nexport class AgentBetaRunEventsClient extends AgentRunEventsClient {\n /**\n * List stored events for an Agent run.\n *\n * @deprecated Use exa.agent.runs.events instead.\n */\n async list(\n runId: string,\n options?: WithBetaOptions<ListAgentRunEventsParams>,\n requestOptions?: RequestOptions\n ): Promise<ListAgentRunEventsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...pagination } = options ?? {};\n const params = this.buildPaginationParams(pagination);\n return scoped.request<ListAgentRunEventsResponse>(\n `/${runId}/events`,\n \"GET\",\n undefined,\n params,\n headersForBetas(betas)\n );\n }\n}\n\nexport class AgentBetaRunsClient extends AgentRunsClient {\n /**\n * @deprecated Use exa.agent.runs.events instead.\n */\n events: AgentBetaRunEventsClient;\n\n constructor(client: Exa) {\n super(client);\n this.events = new AgentBetaRunEventsClient(client);\n }\n\n async create<T>(\n params: WithBetaOptions<AgentCreateOptions<T>> & { stream: true },\n requestOptions?: RequestOptions\n ): Promise<AsyncGenerator<AgentEvent>>;\n async create<T>(\n params: WithBetaOptions<AgentCreateOptions<T>> & { stream?: false },\n requestOptions?: RequestOptions\n ): Promise<AgentRunTyped<T>>;\n async create(\n params: CreateAgentRunParams & AgentBetaOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentRun>;\n async create<T>(\n params: WithBetaOptions<AgentCreateOptions<T>>,\n requestOptions?: RequestOptions\n ): Promise<AgentRun | AgentRunTyped<T> | AsyncGenerator<AgentEvent>> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...createParams } = params;\n const { stream, payload } = buildAgentRunPayload(\n createParams as AgentCreateOptions<T>\n );\n const headers = headersForBetas(betas);\n\n if (stream) {\n const response = await scoped.rawRequest(\"\", \"POST\", payload, undefined, {\n ...headers,\n Accept: \"text/event-stream\",\n });\n if (!response.ok) {\n throw await exaErrorFromResponse(response, \"/agent/runs\");\n }\n return streamAgentEvents(response);\n }\n\n return scoped.request<AgentRunTyped<T>>(\n \"\",\n \"POST\",\n payload,\n undefined,\n headers\n );\n }\n\n async get(\n runId: string,\n options?: AgentBetaOptions & RequestOptions\n ): Promise<AgentRun> {\n const scoped = this.withRequestOptions(options);\n return scoped.request<AgentRun>(\n `/${runId}`,\n \"GET\",\n undefined,\n undefined,\n headersForBetas(options?.betas)\n );\n }\n\n async list(\n options?: WithBetaOptions<ListAgentRunsParams>,\n requestOptions?: RequestOptions\n ): Promise<ListAgentRunsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const { betas, ...pagination } = options ?? {};\n const params = this.buildPaginationParams(pagination);\n return scoped.request<ListAgentRunsResponse>(\n \"\",\n \"GET\",\n undefined,\n params,\n headersForBetas(betas)\n );\n }\n\n async *listAll(\n options?: WithBetaOptions<ListAgentRunsParams>,\n requestOptions?: RequestOptions\n ): AsyncGenerator<AgentRun> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const { betas, ...pagination } = options ?? {};\n const pageOptions: ListAgentRunsParams = { ...pagination };\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list({ ...pageOptions, betas });\n\n for (const run of response.data) {\n yield run;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n async getAll(\n options?: WithBetaOptions<ListAgentRunsParams>,\n requestOptions?: RequestOptions\n ): Promise<AgentRun[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const runs: AgentRun[] = [];\n for await (const run of scoped.listAll(options)) {\n runs.push(run);\n }\n return runs;\n }\n\n async cancel(\n runId: string,\n options?: AgentBetaOptions & RequestOptions\n ): Promise<AgentRun> {\n const scoped = this.withRequestOptions(options);\n return scoped.request<AgentRun>(\n `/${runId}/cancel`,\n \"POST\",\n undefined,\n undefined,\n headersForBetas(options?.betas)\n );\n }\n\n /**\n * Stop a running Agent run, completing it early with the results\n * gathered so far. Only supported for `ultra` effort runs.\n */\n async stop(\n runId: string,\n options?: AgentBetaOptions & RequestOptions\n ): Promise<AgentRun> {\n const scoped = this.withRequestOptions(options);\n return scoped.request<AgentRun>(\n `/${runId}/stop`,\n \"POST\",\n undefined,\n undefined,\n headersForBetas(options?.betas ?? [AGENT_MAX_EFFORT_BETA])\n );\n }\n\n async delete(\n runId: string,\n options?: AgentBetaOptions & RequestOptions\n ): Promise<DeletedAgentRun> {\n const scoped = this.withRequestOptions(options);\n return scoped.request<DeletedAgentRun>(\n `/${runId}`,\n \"DELETE\",\n undefined,\n undefined,\n headersForBetas(options?.betas)\n );\n }\n\n async pollUntilFinished(\n runId: string,\n options?: WithBetaOptions<AgentWaitOptions>,\n requestOptions?: RequestOptions\n ): Promise<AgentTerminalRun> {\n const scoped = this.withRequestOptions(requestOptions);\n const pollInterval =\n options?.pollInterval ?? DEFAULT_AGENT_POLL_INTERVAL_MS;\n const timeoutMs = options?.timeoutMs ?? DEFAULT_AGENT_POLL_TIMEOUT_MS;\n const startTime = Date.now();\n const headers = headersForBetas(options?.betas);\n\n while (true) {\n const run = await scoped.request<AgentRun>(\n `/${runId}`,\n \"GET\",\n undefined,\n undefined,\n headers\n );\n if (isTerminalAgentRunStatus(run.status)) {\n return run as AgentTerminalRun;\n }\n\n if (Date.now() - startTime > timeoutMs) {\n throw new Error(\n `Polling timeout: Agent run ${runId} did not complete within ${timeoutMs}ms`\n );\n }\n\n await sleep(pollInterval, scoped.requestOptions?.signal);\n }\n }\n\n async createAndWait<T>(\n params: WithBetaOptions<Omit<AgentCreateOptions<T>, \"stream\">>,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentCompletedRunTyped<T>>;\n async createAndWait(\n params: CreateAgentRunParams & AgentBetaOptions,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentCompletedRun>;\n async createAndWait<T>(\n params: WithBetaOptions<Omit<AgentCreateOptions<T>, \"stream\">>,\n options?: AgentWaitOptions,\n requestOptions?: RequestOptions\n ): Promise<AgentCompletedRunTyped<T>> {\n const scoped = this.withRequestOptions(requestOptions);\n const {\n betas,\n stream: _stream,\n ...createParams\n } = params as WithBetaOptions<AgentCreateOptions<T>>;\n const run = (await scoped.create({\n ...createParams,\n betas,\n })) as AgentRunTyped<T>;\n const runId = (run as AgentRun).id;\n const terminalRun = (await scoped.pollUntilFinished(runId, {\n ...createAndWaitPollOptions(options),\n betas,\n })) as AgentTerminalRunTyped<T>;\n return ensureCompletedRun(terminalRun);\n }\n}\n\n/** Beta Agent API clients. */\nexport class AgentBetaClient extends AgentClient {\n /**\n * @deprecated Use exa.agent.runs instead.\n */\n runs: AgentBetaRunsClient;\n\n /**\n * Beta client for Agent Monitors.\n */\n monitors: AgentMonitorsClient;\n\n constructor(clientOrAgent: Exa | AgentClient) {\n const client =\n clientOrAgent instanceof AgentClient\n ? clientOrAgent.client\n : clientOrAgent;\n super(client);\n this.runs = new AgentBetaRunsClient(client);\n this.monitors = new AgentMonitorsClient(client);\n }\n}\n\nexport class BetaClient {\n /** Beta Agent APIs. For Agent runs, use `exa.agent.runs`. */\n agent: AgentBetaClient;\n\n constructor(clientOrAgent: Exa | AgentClient) {\n this.agent = new AgentBetaClient(clientOrAgent);\n }\n}\n","/**\n * Base client for Search Monitors API\n */\nimport { Exa } from \"../index\";\nimport { RequestScopedClient } from \"../request-options\";\nimport { ListSearchMonitorsParams, ListSearchMonitorRunsParams } from \"./types\";\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\nexport class SearchMonitorsBaseClient extends RequestScopedClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n super();\n this.client = client;\n }\n\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: Record<string, any>,\n params?: QueryParams\n ): Promise<T> {\n if (this.requestOptions) {\n return this.client.request<T>(\n `/monitors${endpoint}`,\n method,\n data,\n params,\n undefined,\n this.requestOptions\n );\n }\n return this.client.request<T>(`/monitors${endpoint}`, method, data, params);\n }\n\n protected buildPaginationParams(\n pagination?: ListSearchMonitorsParams | ListSearchMonitorRunsParams\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n if (\"status\" in pagination && pagination.status)\n params.status = pagination.status;\n\n return params;\n }\n}\n","/**\n * Client for the Search Monitors API\n */\nimport { Exa } from \"..\";\nimport { SearchMonitorsBaseClient } from \"./base\";\nimport {\n CreateSearchMonitorParams,\n CreateSearchMonitorResponse,\n ListSearchMonitorRunsParams,\n ListSearchMonitorRunsResponse,\n ListSearchMonitorsParams,\n ListSearchMonitorsResponse,\n SearchMonitor,\n SearchMonitorRun,\n TriggerSearchMonitorResponse,\n UpdateSearchMonitorParams,\n} from \"./types\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Client for managing Search Monitor Runs\n */\nexport class SearchMonitorRunsClient extends SearchMonitorsBaseClient {\n /**\n * List all runs for a Search Monitor\n * @param monitorId The ID of the Search Monitor\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Search Monitor runs\n */\n async list(\n monitorId: string,\n options?: ListSearchMonitorRunsParams,\n requestOptions?: RequestOptions\n ): Promise<ListSearchMonitorRunsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListSearchMonitorRunsResponse>(\n `/${monitorId}/runs`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Get a specific Search Monitor run\n * @param monitorId The ID of the Search Monitor\n * @param runId The ID of the run\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Search Monitor run\n */\n async get(\n monitorId: string,\n runId: string,\n requestOptions?: RequestOptions\n ): Promise<SearchMonitorRun> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<SearchMonitorRun>(\n `/${monitorId}/runs/${runId}`,\n \"GET\"\n );\n }\n\n /**\n * Iterate through all runs for a Search Monitor, handling pagination automatically\n * @param monitorId The ID of the Search Monitor\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Search Monitor runs\n */\n async *listAll(\n monitorId: string,\n options?: ListSearchMonitorRunsParams,\n requestOptions?: RequestOptions\n ): AsyncGenerator<SearchMonitorRun> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(monitorId, pageOptions);\n\n for (const run of response.data) {\n yield run;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all runs for a Search Monitor into an array\n * @param monitorId The ID of the Search Monitor\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Search Monitor runs\n */\n async getAll(\n monitorId: string,\n options?: ListSearchMonitorRunsParams,\n requestOptions?: RequestOptions\n ): Promise<SearchMonitorRun[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const runs: SearchMonitorRun[] = [];\n for await (const run of scoped.listAll(monitorId, options)) {\n runs.push(run);\n }\n return runs;\n }\n}\n\n/**\n * Client for managing Search Monitors\n */\nexport class SearchMonitorsClient extends SearchMonitorsBaseClient {\n /**\n * Client for managing Search Monitor Runs\n */\n runs: SearchMonitorRunsClient;\n\n constructor(client: Exa) {\n super(client);\n this.runs = new SearchMonitorRunsClient(client);\n }\n\n /**\n * Create a Search Monitor\n * @param params The monitor creation parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Search Monitor with webhookSecret\n */\n async create(\n params: CreateSearchMonitorParams,\n requestOptions?: RequestOptions\n ): Promise<CreateSearchMonitorResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<CreateSearchMonitorResponse>(\"\", \"POST\", params);\n }\n\n /**\n * Get a Search Monitor by ID\n * @param id The ID of the Search Monitor\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Search Monitor\n */\n async get(\n id: string,\n requestOptions?: RequestOptions\n ): Promise<SearchMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<SearchMonitor>(`/${id}`, \"GET\");\n }\n\n /**\n * List Search Monitors\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Search Monitors\n */\n async list(\n options?: ListSearchMonitorsParams,\n requestOptions?: RequestOptions\n ): Promise<ListSearchMonitorsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListSearchMonitorsResponse>(\n \"\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Update a Search Monitor\n * @param id The ID of the Search Monitor\n * @param params The update parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The updated Search Monitor\n */\n async update(\n id: string,\n params: UpdateSearchMonitorParams,\n requestOptions?: RequestOptions\n ): Promise<SearchMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<SearchMonitor>(`/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete a Search Monitor\n * @param id The ID of the Search Monitor\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Search Monitor\n */\n async delete(\n id: string,\n requestOptions?: RequestOptions\n ): Promise<SearchMonitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<SearchMonitor>(`/${id}`, \"DELETE\");\n }\n\n /**\n * Trigger a Search Monitor run immediately\n * @param id The ID of the Search Monitor\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Whether the monitor was triggered\n */\n async trigger(\n id: string,\n requestOptions?: RequestOptions\n ): Promise<TriggerSearchMonitorResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<TriggerSearchMonitorResponse>(\n `/${id}/trigger`,\n \"POST\"\n );\n }\n\n /**\n * Iterate through all Search Monitors, handling pagination automatically\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Search Monitors\n */\n async *listAll(\n options?: ListSearchMonitorsParams,\n requestOptions?: RequestOptions\n ): AsyncGenerator<SearchMonitor> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const monitor of response.data) {\n yield monitor;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Search Monitors into an array\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Search Monitors\n */\n async getAll(\n options?: ListSearchMonitorsParams,\n requestOptions?: RequestOptions\n ): Promise<SearchMonitor[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const monitors: SearchMonitor[] = [];\n for await (const monitor of scoped.listAll(options)) {\n monitors.push(monitor);\n }\n return monitors;\n }\n}\n","import { ExaError } from \"../errors\";\nimport { Exa } from \"../index\";\nimport { RequestScopedClient } from \"../request-options\";\nimport { ListResearchRequest } from \"./index\";\n\n/** The message every Research API method rejects with. */\nexport const RESEARCH_RETIRED_MESSAGE =\n \"The Exa Research API has been retired and no longer accepts requests. \" +\n \"Use the Agent API (exa.agent.runs.create) for asynchronous, multi-step research.\";\n\n/**\n * The error every Research API method rejects with, before sending a request.\n * Its `statusCode` is 410, the status the API answers Research paths with.\n */\nexport function researchRetiredError(): ExaError {\n return new ExaError(RESEARCH_RETIRED_MESSAGE, 410);\n}\n\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\ninterface RequestBody {\n [key: string]: unknown;\n}\n\nexport class ResearchBaseClient extends RequestScopedClient {\n protected client: Exa;\n\n constructor(client: Exa) {\n super();\n this.client = client;\n }\n\n /** Rejects with `researchRetiredError()`: the Research API has been retired. */\n protected async request<T = unknown>(\n _endpoint: string,\n _method: string = \"POST\",\n _data?: RequestBody,\n _params?: QueryParams\n ): Promise<T> {\n throw researchRetiredError();\n }\n\n /** Rejects with `researchRetiredError()`: the Research API has been retired. */\n protected async rawRequest(\n _endpoint: string,\n _method: string = \"POST\",\n _data?: RequestBody,\n _params?: QueryParams\n ): Promise<Response> {\n throw researchRetiredError();\n }\n\n protected buildPaginationParams(\n pagination?: ListResearchRequest\n ): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n\n return params;\n }\n}\n","import { Exa } from \"../index\";\nimport { exaErrorFromResponse } from \"../error-response\";\nimport {\n ListResearchRequest,\n ListResearchResponse,\n Research,\n ResearchCreateRequest,\n ResearchCreateResponse,\n ResearchStreamEvent,\n ResearchCreateParamsTyped,\n ResearchTyped,\n} from \"./index\";\nimport { ZodSchema } from \"zod\";\nimport { isZodSchema, zodToJsonSchema } from \"../zod-utils\";\nimport { ResearchBaseClient, researchRetiredError } from \"./base\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Client for the Research API, which has been retired.\n *\n * Every method rejects with an `ExaError` (`statusCode` 410) without sending a\n * request. Use the Agent API (`exa.agent.runs.create`) for asynchronous,\n * multi-step research.\n */\nexport class ResearchClient extends ResearchBaseClient {\n constructor(client: Exa) {\n super(client);\n }\n\n async create<T>(\n params: ResearchCreateParamsTyped<ZodSchema<T>>,\n requestOptions?: RequestOptions\n ): Promise<ResearchCreateResponse>;\n\n async create(\n params: {\n instructions: string;\n model?: ResearchCreateRequest[\"model\"];\n outputSchema?: Record<string, unknown>;\n },\n requestOptions?: RequestOptions\n ): Promise<ResearchCreateResponse>;\n\n async create<T>(\n params: {\n instructions: string;\n model?: ResearchCreateRequest[\"model\"];\n outputSchema?: Record<string, unknown> | ZodSchema<T>;\n },\n requestOptions?: RequestOptions\n ): Promise<ResearchCreateResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const { instructions, model, outputSchema } = params;\n\n let schema = outputSchema;\n if (schema && isZodSchema(schema)) {\n schema = zodToJsonSchema(schema);\n }\n\n const payload: ResearchCreateRequest = {\n instructions,\n model: model ?? \"exa-research-fast\",\n };\n\n if (schema) {\n payload.outputSchema = schema as Record<string, unknown>;\n }\n\n return scoped.request<ResearchCreateResponse>(\"\", \"POST\", payload);\n }\n\n get(\n researchId: string,\n options?: undefined,\n requestOptions?: RequestOptions\n ): Promise<Research>;\n get(\n researchId: string,\n options: { stream?: false; events?: boolean },\n requestOptions?: RequestOptions\n ): Promise<Research>;\n get<T>(\n researchId: string,\n options: { stream?: false; events?: boolean; outputSchema: ZodSchema<T> },\n requestOptions?: RequestOptions\n ): Promise<ResearchTyped<T>>;\n get(\n researchId: string,\n options: { stream: true; events?: boolean },\n requestOptions?: RequestOptions\n ): Promise<AsyncGenerator<ResearchStreamEvent, any, any>>;\n get<T>(\n researchId: string,\n options: { stream: true; events?: boolean; outputSchema?: ZodSchema<T> },\n requestOptions?: RequestOptions\n ): Promise<AsyncGenerator<ResearchStreamEvent, any, any>>;\n get<T = unknown>(\n researchId: string,\n options?: {\n stream?: boolean;\n events?: boolean;\n outputSchema?: ZodSchema<T>;\n },\n requestOptions?: RequestOptions\n ):\n | Promise<Research | ResearchTyped<T>>\n | Promise<AsyncGenerator<ResearchStreamEvent>> {\n const scoped = this.withRequestOptions(requestOptions);\n if (options?.stream) {\n const promise = async () => {\n const params: Record<string, string> = { stream: \"true\" };\n if (options.events !== undefined) {\n params.events = options.events.toString();\n }\n const resp = await scoped.rawRequest(\n `/${researchId}`,\n \"GET\",\n undefined,\n params\n );\n if (!resp.ok) {\n throw await exaErrorFromResponse(resp, `/research/v1/${researchId}`);\n }\n if (!resp.body) {\n throw new Error(\"No response body for SSE stream\");\n }\n const reader = resp.body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n\n function processPart(part: string): ResearchStreamEvent | null {\n const lines = part.split(\"\\n\");\n let data = lines.slice(1).join(\"\\n\");\n if (data.startsWith(\"data:\")) {\n data = data.slice(5).trimStart();\n }\n try {\n return JSON.parse(data);\n } catch (e) {\n return null;\n }\n }\n\n async function* streamEvents() {\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n\n let parts = buffer.split(\"\\n\\n\");\n buffer = parts.pop() ?? \"\";\n\n for (const part of parts) {\n const processed = processPart(part);\n if (processed) {\n yield processed;\n }\n }\n }\n if (buffer.trim()) {\n const processed = processPart(buffer.trim());\n if (processed) {\n yield processed;\n }\n }\n } finally {\n // Cancel so the request's signal listeners are released even if\n // the consumer stops early.\n try {\n await reader.cancel();\n } catch {\n // ignore\n }\n }\n }\n\n return streamEvents();\n };\n return promise() as\n | Promise<Research>\n | Promise<AsyncGenerator<ResearchStreamEvent>>;\n } else {\n const params: Record<string, string> = { stream: \"false\" };\n if (options?.events !== undefined) {\n params.events = options.events.toString();\n }\n return scoped.request<Research>(\n `/${researchId}`,\n \"GET\",\n undefined,\n params\n ) as Promise<Research> | Promise<AsyncGenerator<ResearchStreamEvent>>;\n }\n }\n\n async list(\n options?: ListResearchRequest,\n requestOptions?: RequestOptions\n ): Promise<ListResearchResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListResearchResponse>(\"\", \"GET\", undefined, params);\n }\n\n async pollUntilFinished(\n researchId: string,\n options?: {\n pollInterval?: number;\n timeoutMs?: number;\n events?: boolean;\n },\n requestOptions?: RequestOptions\n ): Promise<Research & { status: \"completed\" | \"failed\" | \"canceled\" }>;\n async pollUntilFinished<T>(\n researchId: string,\n options?: {\n pollInterval?: number;\n timeoutMs?: number;\n events?: boolean;\n outputSchema: ZodSchema<T>;\n },\n requestOptions?: RequestOptions\n ): Promise<\n ResearchTyped<T> & { status: \"completed\" | \"failed\" | \"canceled\" }\n >;\n async pollUntilFinished<T = unknown>(\n _researchId: string,\n _options?: {\n pollInterval?: number;\n timeoutMs?: number;\n events?: boolean;\n outputSchema?: ZodSchema<T>;\n },\n _requestOptions?: RequestOptions\n ): Promise<any> {\n throw researchRetiredError();\n }\n}\n","/**\n * Base client for Websets API\n */\nimport { Exa } from \"../index\";\nimport { RequestScopedClient } from \"../request-options\";\n\n/**\n * Type for API query parameters\n */\ntype QueryParams = Record<\n string,\n string | number | boolean | string[] | undefined\n>;\n\n/**\n * Type for API request body\n */\ninterface RequestBody {\n [key: string]: unknown;\n}\n\n/**\n * Common pagination parameters\n */\nexport interface PaginationParams {\n /**\n * Cursor for pagination\n */\n cursor?: string;\n\n /**\n * Maximum number of items per page\n */\n limit?: number;\n}\n\n/**\n * Base client class for all Websets-related API clients\n */\nexport class WebsetsBaseClient extends RequestScopedClient {\n protected client: Exa;\n\n /**\n * Initialize a new Websets base client\n * @param client The Exa client instance\n */\n constructor(client: Exa) {\n super();\n this.client = client;\n }\n\n /**\n * Make a request to the Websets API\n * @param endpoint The endpoint path\n * @param method The HTTP method\n * @param data Optional request body data\n * @param params Optional query parameters\n * @returns The response JSON\n * @throws ExaError with API error details if the request fails\n */\n protected async request<T = unknown>(\n endpoint: string,\n method: string = \"POST\",\n data?: RequestBody,\n params?: QueryParams,\n headers?: Record<string, string>\n ): Promise<T> {\n if (this.requestOptions) {\n return this.client.request<T>(\n `/websets${endpoint}`,\n method,\n data,\n params,\n headers,\n this.requestOptions\n );\n }\n return this.client.request<T>(\n `/websets${endpoint}`,\n method,\n data,\n params,\n headers\n );\n }\n\n /**\n * Helper to build pagination parameters\n * @param pagination The pagination parameters\n * @returns QueryParams object with pagination parameters\n */\n protected buildPaginationParams(pagination?: PaginationParams): QueryParams {\n const params: QueryParams = {};\n if (!pagination) return params;\n\n if (pagination.cursor) params.cursor = pagination.cursor;\n if (pagination.limit) params.limit = pagination.limit;\n\n return params;\n }\n}\n","/**\n * Client for managing Webset Enrichments\n */\nimport { WebsetsBaseClient } from \"./base\";\nimport {\n CreateEnrichmentParameters,\n UpdateEnrichmentParameters,\n WebsetEnrichment,\n} from \"./openapi\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Client for managing Webset Enrichments\n */\nexport class WebsetEnrichmentsClient extends WebsetsBaseClient {\n /**\n * Create an Enrichment for a Webset\n * @param websetId The ID of the Webset\n * @param params The enrichment parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Webset Enrichment\n */\n async create(\n websetId: string,\n params: CreateEnrichmentParameters,\n requestOptions?: RequestOptions\n ): Promise<WebsetEnrichment> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments`,\n \"POST\",\n params\n );\n }\n\n /**\n * Get an Enrichment by ID\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Webset Enrichment\n */\n async get(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetEnrichment> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments/${id}`,\n \"GET\"\n );\n }\n\n /**\n * Delete an Enrichment\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Webset Enrichment\n */\n async delete(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetEnrichment> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments/${id}`,\n \"DELETE\"\n );\n }\n\n /**\n * Update an Enrichment\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @param params The enrichment update parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise that resolves when the update is complete\n */\n async update(\n websetId: string,\n id: string,\n params: UpdateEnrichmentParameters,\n requestOptions?: RequestOptions\n ): Promise<void> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<void>(\n `/v0/websets/${websetId}/enrichments/${id}`,\n \"PATCH\",\n params\n );\n }\n\n /**\n * Cancel a running Enrichment\n * @param websetId The ID of the Webset\n * @param id The ID of the Enrichment\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The canceled Webset Enrichment\n */\n async cancel(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetEnrichment> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetEnrichment>(\n `/v0/websets/${websetId}/enrichments/${id}/cancel`,\n \"POST\"\n );\n }\n}\n","import { Exa } from \"../index\";\nimport { WebsetsBaseClient } from \"./base\";\nimport { Event, EventType, ListEventsResponse } from \"./openapi\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Options for listing Events\n */\nexport interface ListEventsOptions {\n /**\n * The cursor to paginate through the results\n */\n cursor?: string;\n /**\n * The number of results to return\n */\n limit?: number;\n /**\n * The types of events to filter by\n */\n types?: EventType[];\n}\n\n/**\n * Client for managing Events\n */\nexport class EventsClient extends WebsetsBaseClient {\n /**\n * Initialize a new Events client\n * @param client The Exa client instance\n */\n constructor(client: Exa) {\n super(client);\n }\n\n /**\n * List all Events\n * @param options Optional filtering and pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Events\n */\n async list(\n options?: ListEventsOptions,\n requestOptions?: RequestOptions\n ): Promise<ListEventsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = {\n cursor: options?.cursor,\n limit: options?.limit,\n types: options?.types,\n };\n\n return scoped.request<ListEventsResponse>(\n \"/v0/events\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Get an Event by ID\n * @param id The ID of the Event\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Event\n */\n async get(id: string, requestOptions?: RequestOptions): Promise<Event> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Event>(`/v0/events/${id}`, \"GET\");\n }\n\n /**\n * Iterate through all Events, handling pagination automatically\n * @param options Filtering and pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Events\n */\n async *listAll(\n options?: ListEventsOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<Event> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const event of response.data) {\n yield event;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Events into an array\n * @param options Filtering and pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Events\n */\n async getAll(\n options?: ListEventsOptions,\n requestOptions?: RequestOptions\n ): Promise<Event[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const events: Event[] = [];\n for await (const event of scoped.listAll(options)) {\n events.push(event);\n }\n return events;\n }\n}\n","/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n */\n\nexport interface paths {\n \"/v0/events\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List all Events\n * @description List all events that have occurred in the system.\n *\n * You can paginate through the results using the `cursor` parameter.\n */\n get: operations[\"events-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/events/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get an Event\n * @description Get a single Event by id.\n *\n * You can subscribe to Events by creating a Webhook.\n */\n get: operations[\"events-get\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/imports\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List Imports\n * @description Lists all imports for the Webset.\n */\n get: operations[\"imports-list\"];\n put?: never;\n /**\n * Create an Import\n * @description Creates a new import to upload your data into Websets. Imports can be used to:\n *\n * - **Enrich**: Enhance your data with additional information using our AI-powered enrichment engine\n * - **Search**: Query your data using Websets' agentic search with natural language filters\n * - **Exclude**: Prevent duplicate or already known results from appearing in your searches\n *\n * Once the import is created, you can upload your data to the returned `uploadUrl` until `uploadValidUntil` (by default 1 hour).\n */\n post: operations[\"imports-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/imports/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get Import\n * @description Gets a specific import.\n */\n get: operations[\"imports-get\"];\n put?: never;\n post?: never;\n /**\n * Delete Import\n * @description Deletes a import.\n */\n delete: operations[\"imports-delete\"];\n options?: never;\n head?: never;\n /**\n * Update Import\n * @description Updates a import configuration.\n */\n patch: operations[\"imports-update\"];\n trace?: never;\n };\n \"/v0/monitors\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List Monitors\n * @description Lists all monitors for the Webset.\n */\n get: operations[\"monitors-list\"];\n put?: never;\n /**\n * Create a Monitor\n * @description Creates a new `Monitor` to continuously keep your Websets updated with fresh data.\n *\n * Monitors automatically run on your defined schedule to ensure your Websets stay current without manual intervention:\n *\n * - **Find new content**: Execute `search` operations to discover fresh items matching your criteria\n * - **Update existing content**: Run `refresh` operations to update items contents and enrichments\n * - **Automated scheduling**: Configure `cron` expressions and `timezone` for precise scheduling control\n */\n post: operations[\"monitors-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/monitors/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get Monitor\n * @description Gets a specific monitor.\n */\n get: operations[\"monitors-get\"];\n put?: never;\n post?: never;\n /**\n * Delete Monitor\n * @description Deletes a monitor.\n */\n delete: operations[\"monitors-delete\"];\n options?: never;\n head?: never;\n /**\n * Update Monitor\n * @description Updates a monitor configuration.\n */\n patch: operations[\"monitors-update\"];\n trace?: never;\n };\n \"/v0/monitors/{monitor}/runs\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List Monitor Runs\n * @description Lists all runs for the Monitor.\n */\n get: operations[\"monitors-runs-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/monitors/{monitor}/runs/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get Monitor Run\n * @description Gets a specific monitor run.\n */\n get: operations[\"monitors-runs-get\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/webhooks\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List webhooks\n * @description Get a list of all webhooks in your account.\n * The results come in pages. Use `limit` to set how many webhooks to get per page (up to 200). Use `cursor` to get the next page of results.\n */\n get: operations[\"webhooks-list\"];\n put?: never;\n /**\n * Create a Webhook\n * @description Webhooks let you get notifications when things happen in your Websets. When you create a webhook, you choose which events you want to know about and where to send the notifications.\n *\n * When an event happens, Exa sends an HTTP POST request to your webhook URL with:\n * - Event details (type, time, ID)\n * - Full data of what triggered the event\n * - A signature to verify the request came from Exa\n *\n * The webhook starts as `active` and begins getting notifications right away. You'll get a secret key for checking webhook signatures - save this safely as it's only shown once when you create the webhook.\n */\n post: operations[\"webhooks-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/webhooks/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get a Webhook\n * @description Get information about a webhook using its ID.\n * The webhook secret is not shown here for security - you only get it when you first create the webhook.\n */\n get: operations[\"webhooks-get\"];\n put?: never;\n post?: never;\n /**\n * Delete a Webhook\n * @description Remove a webhook from your account. Once deleted, the webhook stops getting notifications right away and cannot be brought back.\n *\n * Important notes: - The webhook stops working as soon as you delete it - You cannot undo this - you'll need to create a new webhook if you want it back - Any notifications currently being sent may still complete\n */\n delete: operations[\"webhooks-delete\"];\n options?: never;\n head?: never;\n /**\n * Update a Webhook\n * @description Change a webhook's settings. You can update:\n * - Events: Add or remove which events you want to hear about - URL: Change where notifications are sent - Metadata: Update custom data linked to the webhook\n *\n * Changes happen right away. If you change the events list, the webhook will start or stop getting notifications for those events immediately.\n *\n * The webhook keeps its current status (`active` or `inactive`) when you update it.\n */\n patch: operations[\"webhooks-update\"];\n trace?: never;\n };\n \"/v0/webhooks/{id}/attempts\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List webhook attempts\n * @description List all attempts made by a Webhook ordered in descending order.\n */\n get: operations[\"webhooks-attempts-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List all Websets\n * @description Returns a list of Websets.\n *\n * You can paginate through the results using the `cursor` parameter.\n */\n get: operations[\"websets-list\"];\n put?: never;\n /**\n * Create a Webset\n * @description Creates a new Webset with optional search, import, and enrichment configurations. The Webset will automatically begin processing once created.\n *\n * You can specify an `externalId` to reference the Webset with your own identifiers for easier integration.\n */\n post: operations[\"websets-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get a Webset */\n get: operations[\"websets-get\"];\n put?: never;\n /** Update a Webset */\n post: operations[\"websets-update\"];\n /**\n * Delete a Webset\n * @description Deletes a Webset.\n *\n * Once deleted, the Webset and all its Items will no longer be available.\n */\n delete: operations[\"websets-delete\"];\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{id}/cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Cancel a running Webset\n * @description Cancels all operations being performed on a Webset.\n *\n * Any enrichment or search will be stopped and the Webset will be marked as `idle`.\n */\n post: operations[\"websets-cancel\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/enrichments\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Create an Enrichment\n * @description Create an Enrichment for a Webset.\n */\n post: operations[\"websets-enrichments-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/enrichments/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /** Get an Enrichment */\n get: operations[\"websets-enrichments-get\"];\n put?: never;\n post?: never;\n /**\n * Delete an Enrichment\n * @description When deleting an Enrichment, any running enrichments will be canceled and all existing `enrichment_result` generated by this Enrichment will no longer be available.\n */\n delete: operations[\"websets-enrichments-delete\"];\n options?: never;\n head?: never;\n /**\n * Update an Enrichment\n * @description Update an Enrichment configuration for a Webset.\n */\n patch: operations[\"websets-enrichments-update\"];\n trace?: never;\n };\n \"/v0/websets/{webset}/enrichments/{id}/cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Cancel a running Enrichment\n * @description All running enrichments will be canceled. You can not resume an Enrichment after it has been canceled.\n */\n post: operations[\"websets-enrichments-cancel\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/items\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * List all Items for a Webset\n * @description Returns a list of Webset Items.\n *\n * You can paginate through the Items using the `cursor` parameter.\n */\n get: operations[\"websets-items-list\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/items/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get an Item\n * @description Returns a Webset Item.\n */\n get: operations[\"websets-items-get\"];\n put?: never;\n post?: never;\n /**\n * Delete an Item\n * @description Deletes an Item from the Webset.\n *\n * This will cancel any enrichment process for it.\n */\n delete: operations[\"websets-items-delete\"];\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/searches\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Create a Search\n * @description Creates a new Search for the Webset.\n *\n * The default behavior is to reuse the previous Search results and evaluate them against the new criteria.\n */\n post: operations[\"websets-searches-create\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/searches/{id}\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n /**\n * Get a Search\n * @description Gets a Search by id\n */\n get: operations[\"websets-searches-get\"];\n put?: never;\n post?: never;\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/{webset}/searches/{id}/cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Cancel a running Search\n * @description Cancels a currently running Search.\n *\n * You can cancel all searches at once by using the `websets/:webset/cancel` endpoint.\n */\n post: operations[\"websets-searches-cancel\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n \"/v0/websets/preview\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n get?: never;\n put?: never;\n /**\n * Preview a webset\n * @description Preview how a search query will be decomposed before creating a webset. This endpoint performs the same query analysis that happens during webset creation, allowing you to see the detected entity type, generated search criteria, and available enrichment columns in advance.\n *\n * Use this to help users understand how their search will be interpreted before committing to a full webset creation.\n */\n post: operations[\"websets-preview\"];\n delete?: never;\n options?: never;\n head?: never;\n patch?: never;\n trace?: never;\n };\n}\nexport type webhooks = Record<string, never>;\nexport interface components {\n schemas: {\n /** Article */\n ArticleEntity: {\n /**\n * @default article\n * @constant\n */\n type: \"article\";\n };\n /** Company */\n CompanyEntity: {\n /**\n * @default company\n * @constant\n */\n type: \"company\";\n };\n CreateCriterionParameters: {\n /** @description The description of the criterion */\n description: string;\n };\n CreateEnrichmentParameters: {\n /** @description Provide a description of the enrichment task you want to perform to each Webset Item. */\n description: string;\n /**\n * @description Format of the enrichment response.\n *\n * We automatically select the best format based on the description. If you want to explicitly specify the format, you can do so here.\n * @enum {string}\n */\n format?: CreateEnrichmentParametersFormat;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description When the format is options, the different options for the enrichment agent to choose from. */\n options?: {\n /** @description The label of the option */\n label: string;\n }[];\n };\n CreateImportParameters: {\n /** @description The number of records to import */\n count: number;\n /** @description When format is `csv`, these are the specific import parameters. */\n csv?: {\n /** @description Column containing the key identifier for the entity (e.g. URL, Name, etc.). If not provided, we will try to infer it from the file. */\n identifier?: number;\n };\n /** @description What type of entity the import contains (e.g. People, Companies, etc.), and thus should be attempted to be resolved as. */\n entity:\n | components[\"schemas\"][\"CompanyEntity\"]\n | components[\"schemas\"][\"PersonEntity\"]\n | components[\"schemas\"][\"ArticleEntity\"]\n | components[\"schemas\"][\"ResearchPaperEntity\"]\n | components[\"schemas\"][\"CustomEntity\"];\n /**\n * @description When the import is in CSV format, we expect a column containing the key identifier for the entity - for now URL. If not provided, import will fail to be processed.\n * @enum {string}\n */\n format: CreateImportParametersFormat;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description The size of the file in bytes. Maximum size is 50 MB. */\n size: number;\n /** @description The title of the import */\n title?: string;\n };\n /** @description The response to a successful import. Includes the upload URL and the upload valid until date. */\n CreateImportResponse: {\n /** @description The number of entities in the import */\n count: number;\n /**\n * Format: date-time\n * @description When the import was created\n */\n createdAt: string;\n /** @description The type of entity the import contains. */\n entity: components[\"schemas\"][\"Entity\"];\n /**\n * Format: date-time\n * @description When the import failed\n */\n failedAt: string | null;\n /** @description A human readable message of the import failure */\n failedMessage: string | null;\n /**\n * @description The reason the import failed\n * @enum {string|null}\n */\n failedReason: CreateImportResponseFailedReason;\n /**\n * @description The format of the import.\n * @enum {string}\n */\n format: CreateImportResponseFormat;\n /** @description The unique identifier for the Import */\n id: string;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata: {\n [key: string]: string;\n };\n /**\n * @description The type of object\n * @enum {string}\n */\n object: CreateImportResponseObject;\n /**\n * @description The status of the Import\n * @enum {string}\n */\n status: CreateImportResponseStatus;\n /** @description The title of the import */\n title: string;\n /**\n * Format: date-time\n * @description When the import was last updated\n */\n updatedAt: string;\n /** @description The URL to upload the file to */\n uploadUrl: string;\n /** @description The date and time until the upload URL is valid. The upload URL will be valid for 1 hour. */\n uploadValidUntil: string;\n };\n CreateMonitorParameters: {\n /** @description Behavior to perform when monitor runs */\n behavior: {\n /** @description Specify the search parameters for the Monitor.\n *\n * By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */\n config: {\n /**\n * @description The behaviour of the Search when it is added to a Webset.\n * @default append\n * @enum {string}\n */\n behavior: WebsetSearchBehavior;\n /** @description The maximum number of results to find */\n count: number;\n /** @description The criteria to search for. By default, the criteria from the last search is used. */\n criteria?: {\n description: string;\n }[];\n /**\n * Entity\n * @description The entity to search for. By default, the entity from the last search/import is used.\n */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description The query to search for. By default, the query from the last search is used. */\n query?: string;\n };\n /**\n * @default search\n * @constant\n */\n type: \"search\";\n };\n /** @description How often the monitor will run */\n cadence: {\n /** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */\n cron: string;\n /**\n * @description IANA timezone (e.g., \"America/New_York\")\n * @default Etc/UTC\n */\n timezone: string;\n };\n metadata?: {\n [key: string]: string;\n };\n /** @description The id of the Webset */\n websetId: string;\n };\n CreateWebhookParameters: {\n /** @description The events to trigger the webhook */\n events: EventType[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /**\n * Format: uri\n * @description The URL to send the webhook to\n */\n url: string;\n };\n CreateWebsetParameters: {\n /** @description Add enrichments to extract additional data from found items.\n *\n * Enrichments automatically search for and extract specific information (like contact details, funding data, employee counts, etc.) from each item added to your Webset. */\n enrichments?: components[\"schemas\"][\"CreateEnrichmentParameters\"][];\n /** @description Global exclusion sources (existing imports or websets) that apply to all operations within this Webset. Any results found within these sources will be omitted across all search and import operations. */\n exclude?: {\n /** @description The ID of the source to exclude. */\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description The external identifier for the webset.\n *\n * You can use this to reference the Webset by your own internal identifiers. */\n externalId?: string;\n /** @description Attach/load data from existing Imports or Websets into this Webset. For CSV Imports, this schedules ingestion and creates a staging pool of items (ImportItems do not automatically appear as Webset Items; searches create Webset Items). This does not filter searches. To filter a search to only look within an Import or Webset, use search.scope instead. */\n import?: {\n /** @description The ID of the source to search. */\n id: string;\n /** @enum {string} */\n source: WebsetImportSource;\n }[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description Create initial search for the Webset. */\n search?: {\n /**\n * @description Number of Items the Webset will attempt to find.\n *\n * The actual number of Items found may be less than this number depending on the search complexity.\n * @default 10\n */\n count: number;\n /** @description Criteria every item is evaluated against.\n *\n * It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query. Only use this when you need more fine control. */\n criteria?: components[\"schemas\"][\"CreateCriterionParameters\"][];\n /** @description Entity the Webset will return results for.\n *\n * 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. */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description Sources (existing imports or websets) to exclude from search results. Any results found within these sources will be omitted to prevent finding them during search. */\n exclude?: {\n /** @description The ID of the source to exclude. */\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description Optional soft cap for people searches. When set, the search will try to include at most this many matching people from the same current employer company. */\n maxPeoplePerCompany?: number;\n /** @description Natural language search query describing what you are looking for.\n *\n * Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results.\n *\n * Any URLs provided will be crawled and used as additional context for the search. */\n query: string;\n /** @description Whether to provide an estimate of how many total relevant results could exist for this search.\n * Result of the analysis will be available in the `recall` field within the search request. */\n recall?: boolean;\n /** @description Limit this search to only consider candidates from the listed sources (existing Imports or Websets). Scope applies per-search; if you run another search and want to stay within the same dataset, pass scope again. When scope is present, the search behavior is OVERRIDE (replaces results rather than appending). Note: Using the same Import in both top-level import and search.scope will return a 400 error. */\n scope?: {\n /** @description The ID of the source to search. */\n id: string;\n relationship?: {\n /** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. Only needed for hop searches (graph traversal) from the source entities to related targets. Examples: \"investors of\", \"current employer\", \"employees at\". Omit for simple filtering within the source. */\n definition: string;\n /** @description Number of related entities to find per source entity (fanout). Only used for hop searches. Range: 1-10. */\n limit: number;\n };\n /** @enum {string} */\n source: WebsetSearchScopeSource;\n }[];\n };\n };\n CreateWebsetSearchParameters: {\n /**\n * @description How this search interacts with existing items in the Webset:\n *\n * - **override**: Replace existing items and evaluate all items against new criteria\n * - **append**: Add new items to existing ones, keeping items that match the new criteria\n * @default override\n */\n behavior: WebsetSearchBehavior;\n /** @description Number of Items the Search will attempt to find.\n *\n * The actual number of Items found may be less than this number depending on the query complexity. */\n count: number;\n /** @description Criteria every item is evaluated against.\n *\n * It's not required to provide your own criteria, we automatically detect the criteria from all the information provided in the query. Only use this when you need more fine control. */\n criteria?: components[\"schemas\"][\"CreateCriterionParameters\"][];\n /** @description Entity the search will return results for.\n *\n * 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. */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description Sources (existing imports or websets) to exclude from search results. Any results found within these sources will be omitted to prevent finding them during search. */\n exclude?: {\n /** @description The ID of the source to exclude. */\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /** @description Optional soft cap for people searches. When set, the search will try to include at most this many matching people from the same current employer company. */\n maxPeoplePerCompany?: number;\n /** @description Natural language search query describing what you are looking for.\n *\n * Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results.\n *\n * Any URLs provided will be crawled and used as additional context for the search. */\n query: string;\n /** @description Whether to provide an estimate of how many total relevant results could exist for this search.\n * Result of the analysis will be available in the `recall` field within the search request. */\n recall?: boolean;\n /** @description Limit the search to specific sources (existing imports). Any results found within these sources matching the search criteria will be included in the Webset. */\n scope?: {\n /** @description The ID of the source to search. */\n id: string;\n relationship?: {\n /** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. */\n definition: string;\n limit: number;\n };\n /** @enum {string} */\n source: WebsetSearchScopeSource;\n }[];\n };\n /** Custom */\n CustomEntity: {\n description: string;\n /**\n * @default custom\n * @constant\n */\n type: \"custom\";\n };\n EnrichmentResult: {\n /** @description The id of the Enrichment that generated the result */\n enrichmentId: string;\n format: components[\"schemas\"][\"WebsetEnrichmentFormat\"];\n /**\n * @default enrichment_result\n * @constant\n */\n object: \"enrichment_result\";\n /** @description The reasoning for the result when an Agent is used. */\n reasoning: string | null;\n /** @description The references used to generate the result. */\n references: {\n /** @description The relevant snippet of the reference content */\n snippet: string | null;\n /** @description The title of the reference */\n title: string | null;\n /**\n * Format: uri\n * @description The URL of the reference\n */\n url: string;\n }[];\n /** @description The result of the enrichment. */\n result: string[] | null;\n /**\n * @description The status of the enrichment result.\n * @enum {string}\n */\n status: EnrichmentResultStatus;\n };\n Entity:\n | components[\"schemas\"][\"CompanyEntity\"]\n | components[\"schemas\"][\"PersonEntity\"]\n | components[\"schemas\"][\"ArticleEntity\"]\n | components[\"schemas\"][\"ResearchPaperEntity\"]\n | components[\"schemas\"][\"CustomEntity\"];\n /** Event */\n Event:\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.created\n * @constant\n */\n type: \"webset.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.deleted\n * @constant\n */\n type: \"webset.deleted\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.idle\n * @constant\n */\n type: \"webset.idle\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Webset\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.paused\n * @constant\n */\n type: \"webset.paused\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetItem\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.item.created\n * @constant\n */\n type: \"webset.item.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetItem\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.item.enriched\n * @constant\n */\n type: \"webset.item.enriched\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.created\n * @constant\n */\n type: \"webset.search.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.updated\n * @constant\n */\n type: \"webset.search.updated\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.canceled\n * @constant\n */\n type: \"webset.search.canceled\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"WebsetSearch\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default webset.search.completed\n * @constant\n */\n type: \"webset.search.completed\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Import\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default import.created\n * @constant\n */\n type: \"import.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Import\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default import.completed\n * @constant\n */\n type: \"import.completed\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Monitor\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.created\n * @constant\n */\n type: \"monitor.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Monitor\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.updated\n * @constant\n */\n type: \"monitor.updated\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"Monitor\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.deleted\n * @constant\n */\n type: \"monitor.deleted\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"MonitorRun\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.run.created\n * @constant\n */\n type: \"monitor.run.created\";\n }\n | {\n /**\n * Format: date-time\n * @description The date and time the event was created\n */\n createdAt: string;\n data: components[\"schemas\"][\"MonitorRun\"];\n /** @description The unique identifier for the event */\n id: string;\n /**\n * @default event\n * @constant\n */\n object: \"event\";\n /**\n * @default monitor.run.completed\n * @constant\n */\n type: \"monitor.run.completed\";\n };\n /** @enum {string} */\n EventType: EventType;\n GetWebsetResponse: components[\"schemas\"][\"Webset\"] & {\n /** @description When expand query parameter contains `items`, this will contain the items in the webset */\n items?: components[\"schemas\"][\"WebsetItem\"][];\n };\n Import: {\n /** @description The number of entities in the import */\n count: number;\n /**\n * Format: date-time\n * @description When the import was created\n */\n createdAt: string;\n /** @description The type of entity the import contains. */\n entity: components[\"schemas\"][\"Entity\"];\n /**\n * Format: date-time\n * @description When the import failed\n */\n failedAt: string | null;\n /** @description A human readable message of the import failure */\n failedMessage: string | null;\n /**\n * @description The reason the import failed\n * @enum {string|null}\n */\n failedReason: ImportFailedReason;\n /**\n * @description The format of the import.\n * @enum {string}\n */\n format: ImportFormat;\n /** @description The unique identifier for the Import */\n id: string;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata: {\n [key: string]: string;\n };\n /**\n * @description The type of object\n * @enum {string}\n */\n object: ImportObject;\n /**\n * @description The status of the Import\n * @enum {string}\n */\n status: ImportStatus;\n /** @description The title of the import */\n title: string;\n /**\n * Format: date-time\n * @description When the import was last updated\n */\n updatedAt: string;\n };\n ListEventsResponse: {\n /** @description The list of events */\n data: components[\"schemas\"][\"Event\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListImportsResponse: {\n /** @description The list of imports */\n data: components[\"schemas\"][\"Import\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListMonitorRunsResponse: {\n /** @description The list of monitor runs */\n data: components[\"schemas\"][\"MonitorRun\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListMonitorsResponse: {\n /** @description The list of monitors */\n data: components[\"schemas\"][\"Monitor\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListWebhookAttemptsResponse: {\n /** @description The list of webhook attempts */\n data: components[\"schemas\"][\"WebhookAttempt\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListWebhooksResponse: {\n /** @description The list of webhooks */\n data: components[\"schemas\"][\"Webhook\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n ListWebsetItemResponse: {\n /** @description The list of webset items */\n data: components[\"schemas\"][\"WebsetItem\"][];\n /** @description Whether there are more Items to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of Items */\n nextCursor: string | null;\n };\n ListWebsetsResponse: {\n /** @description The list of websets */\n data: components[\"schemas\"][\"Webset\"][];\n /** @description Whether there are more results to paginate through */\n hasMore: boolean;\n /** @description The cursor to paginate through the next set of results */\n nextCursor: string | null;\n };\n Monitor: {\n /** @description Behavior to perform when monitor runs */\n behavior: {\n /** @description Specify the search parameters for the Monitor.\n *\n * By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */\n config: {\n /**\n * @description The behaviour of the Search when it is added to a Webset.\n * @default append\n * @enum {string}\n */\n behavior: WebsetSearchBehavior;\n /** @description The maximum number of results to find */\n count: number;\n /** @description The criteria to search for. By default, the criteria from the last search is used. */\n criteria?: {\n description: string;\n }[];\n /**\n * Entity\n * @description The entity to search for. By default, the entity from the last search/import is used.\n */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description The query to search for. By default, the query from the last search is used. */\n query?: string;\n };\n /**\n * @default search\n * @constant\n */\n type: \"search\";\n };\n /** @description How often the monitor will run */\n cadence: {\n /** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */\n cron: string;\n /**\n * @description IANA timezone (e.g., \"America/New_York\")\n * @default Etc/UTC\n */\n timezone: string;\n };\n /**\n * Format: date-time\n * @description When the monitor was created\n */\n createdAt: string;\n /** @description The unique identifier for the Monitor */\n id: string;\n /**\n * MonitorRun\n * @description The last run of the monitor\n */\n lastRun: components[\"schemas\"][\"MonitorRun\"];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata: {\n [key: string]: string;\n };\n /**\n * Format: date-time\n * @description Date and time when the next run will occur in\n */\n nextRunAt: string | null;\n /**\n * @description The type of object\n * @enum {string}\n */\n object: MonitorObject;\n /**\n * @description The status of the Monitor\n * @enum {string}\n */\n status: MonitorStatus;\n /**\n * Format: date-time\n * @description When the monitor was last updated\n */\n updatedAt: string;\n /** @description The id of the Webset the Monitor belongs to */\n websetId: string;\n };\n MonitorBehavior: {\n /** @description Specify the search parameters for the Monitor.\n *\n * By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */\n config: {\n /**\n * @description The behaviour of the Search when it is added to a Webset.\n * @default append\n * @enum {string}\n */\n behavior: WebsetSearchBehavior;\n /** @description The maximum number of results to find */\n count: number;\n /** @description The criteria to search for. By default, the criteria from the last search is used. */\n criteria?: {\n description: string;\n }[];\n /**\n * Entity\n * @description The entity to search for. By default, the entity from the last search/import is used.\n */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description The query to search for. By default, the query from the last search is used. */\n query?: string;\n };\n /**\n * @default search\n * @constant\n */\n type: \"search\";\n };\n MonitorCadence: {\n /** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */\n cron: string;\n /**\n * @description IANA timezone (e.g., \"America/New_York\")\n * @default Etc/UTC\n */\n timezone: string;\n };\n MonitorRun: {\n /**\n * Format: date-time\n * @description When the run was canceled\n */\n canceledAt: string | null;\n /**\n * Format: date-time\n * @description When the run completed\n */\n completedAt: string | null;\n /**\n * Format: date-time\n * @description When the run was created\n */\n createdAt: string;\n /**\n * Format: date-time\n * @description When the run failed\n */\n failedAt: string | null;\n /** @description The reason the run failed */\n failedReason: string | null;\n /** @description The unique identifier for the Monitor Run */\n id: string;\n /** @description The monitor that the run is associated with */\n monitorId: string;\n /**\n * @description The type of object\n * @enum {string}\n */\n object: MonitorRunObject;\n /**\n * @description The status of the Monitor Run\n * @enum {string}\n */\n status: MonitorRunStatus;\n /**\n * @description The type of the Monitor Run\n * @enum {string}\n */\n type: MonitorRunType;\n /**\n * Format: date-time\n * @description When the run was last updated\n */\n updatedAt: string;\n };\n /** Person */\n PersonEntity: {\n /**\n * @default person\n * @constant\n */\n type: \"person\";\n };\n PreviewWebsetParameters: {\n search: {\n /**\n * @description When query parameter search=true, the number of preview items to return.\n * @default 10\n */\n count: number;\n /** @description Entity used to inform the decomposition.\n *\n * 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. */\n entity?: components[\"schemas\"][\"Entity\"];\n /** @description Natural language search query describing what you are looking for.\n *\n * Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results. */\n query: string;\n };\n };\n PreviewWebsetResponse: {\n /** @description Detected enrichments from the query. */\n enrichments: {\n /** @description Description of the enrichment. */\n description: string;\n /**\n * @description Format of the enrichment.\n * @enum {string}\n */\n format: WebsetEnrichmentFormat;\n /** @description When format is options, the options detected from the query. */\n options?: {\n /** @description Label of the option. */\n label: string;\n }[];\n }[];\n /** @description Preview items matching the search criteria. */\n items: components[\"schemas\"][\"WebsetItemPreview\"][];\n search: {\n /** @description Detected criteria from the query. */\n criteria: {\n description: string;\n }[];\n /** @description Detected entity from the query. */\n entity:\n | components[\"schemas\"][\"CompanyEntity\"]\n | components[\"schemas\"][\"PersonEntity\"]\n | components[\"schemas\"][\"ArticleEntity\"]\n | components[\"schemas\"][\"ResearchPaperEntity\"]\n | components[\"schemas\"][\"CustomEntity\"];\n };\n };\n /** Research Paper */\n ResearchPaperEntity: {\n /**\n * @default research_paper\n * @constant\n */\n type: \"research_paper\";\n };\n UpdateEnrichmentParameters: {\n /** @description Provide a description of the enrichment task you want to perform to each Webset Item. */\n description?: string;\n /**\n * @description Format of the enrichment response.\n *\n * We automatically select the best format based on the description. If you want to explicitly specify the format, you can do so here.\n * @enum {string}\n */\n format?: WebsetEnrichmentFormat;\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n } | null;\n /** @description When the format is options, the different options for the enrichment agent to choose from. */\n options?: {\n /** @description The label of the option */\n label: string;\n }[];\n };\n UpdateImport: {\n metadata?: {\n [key: string]: string;\n };\n title?: string;\n };\n UpdateMonitor: {\n behavior?: components[\"schemas\"][\"MonitorBehavior\"];\n cadence?: components[\"schemas\"][\"MonitorCadence\"];\n metadata?: {\n [key: string]: string;\n };\n /**\n * @description The status of the monitor.\n * @enum {string}\n */\n status?: UpdateMonitorStatus;\n };\n UpdateWebhookParameters: {\n /** @description The events to trigger the webhook */\n events?: EventType[];\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n };\n /**\n * Format: uri\n * @description The URL to send the webhook to\n */\n url?: string;\n };\n UpdateWebsetRequest: {\n /** @description Set of key-value pairs you want to associate with this object. */\n metadata?: {\n [key: string]: string;\n } | null;\n };\n Webhook: {\n /**\n * Format: date-time\n * @description The date and time the webhook was created\n */\n createdAt: string;\n /** @description The events to trigger the webhook */\n events: EventType[];\n /** @description The unique identifier for the webhook */\n id: string;\n /**\n * @description The metadata of the webhook\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /**\n * @default webhook\n * @constant\n */\n object: \"webhook\";\n /** @description The secret to verify the webhook signature. Only returned on Webhook creation. */\n secret: string | null;\n /**\n * WebhookStatus\n * @description The status of the webhook\n * @enum {string}\n */\n status: WebhookStatus;\n /**\n * Format: date-time\n * @description The date and time the webhook was last updated\n */\n updatedAt: string;\n /**\n * Format: uri\n * @description The URL to send the webhook to\n */\n url: string;\n };\n WebhookAttempt: {\n /** @description The attempt number of the webhook */\n attempt: number;\n /**\n * Format: date-time\n * @description The date and time the webhook attempt was made\n */\n attemptedAt: string;\n /** @description The unique identifier for the event */\n eventId: string;\n /**\n * @description The type of event\n * @enum {string}\n */\n eventType: EventType;\n /** @description The unique identifier for the webhook attempt */\n id: string;\n /**\n * @default webhook_attempt\n * @constant\n */\n object: \"webhook_attempt\";\n /** @description The body of the response */\n responseBody: string | null;\n /** @description The headers of the response */\n responseHeaders: {\n [key: string]: string;\n };\n /** @description The status code of the response */\n responseStatusCode: number;\n /** @description Whether the attempt was successful */\n successful: boolean;\n /** @description The URL that was used during the attempt */\n url: string;\n /** @description The unique identifier for the webhook */\n webhookId: string;\n };\n Webset: {\n /**\n * Format: date-time\n * @description The date and time the webset was created\n */\n createdAt: string;\n /** @description The URL to view the webset in the Exa dashboard */\n dashboardUrl: string;\n /** @description The Enrichments to apply to the Webset Items. */\n enrichments: components[\"schemas\"][\"WebsetEnrichment\"][];\n /** @description The Excludes sources (existing imports or websets) that apply to all operations within this Webset. Any results found within these sources will be omitted across all search and import operations. */\n excludes?: {\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description The external identifier for the webset */\n externalId: string | null;\n /** @description The unique identifier for the webset */\n id: string;\n /** @description Imports that have been performed on the webset. */\n imports: components[\"schemas\"][\"Import\"][];\n /**\n * @description Set of key-value pairs you want to associate with this object.\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /** @description The Monitors for the Webset. */\n monitors: components[\"schemas\"][\"Monitor\"][];\n /**\n * @default webset\n * @constant\n */\n object: \"webset\";\n /** @description The searches that have been performed on the webset. */\n searches: components[\"schemas\"][\"WebsetSearch\"][];\n /**\n * WebsetStatus\n * @description The status of the webset\n * @enum {string}\n */\n status: WebsetStatus;\n /** @description The title of the webset */\n title: string | null;\n /**\n * Format: date-time\n * @description The date and time the webset was updated\n */\n updatedAt: string;\n };\n WebsetEnrichment: {\n /**\n * Format: date-time\n * @description The date and time the enrichment was created\n */\n createdAt: string;\n /** @description The description of the enrichment task provided during the creation of the enrichment. */\n description: string;\n /** @description The format of the enrichment response. */\n format: components[\"schemas\"][\"WebsetEnrichmentFormat\"];\n /** @description The unique identifier for the enrichment */\n id: string;\n /** @description The instructions for the enrichment Agent.\n *\n * This will be automatically generated based on the description and format. */\n instructions: string | null;\n /**\n * @description The metadata of the enrichment\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /**\n * @default webset_enrichment\n * @constant\n */\n object: \"webset_enrichment\";\n /**\n * WebsetEnrichmentOptions\n * @description When the format is options, the different options for the enrichment agent to choose from.\n */\n options:\n | {\n /** @description The label of the option */\n label: string;\n }[]\n | null;\n /**\n * WebsetEnrichmentStatus\n * @description The status of the enrichment\n * @enum {string}\n */\n status: WebsetEnrichmentStatus;\n /** @description The title of the enrichment.\n *\n * This will be automatically generated based on the description and format. */\n title: string | null;\n /**\n * Format: date-time\n * @description The date and time the enrichment was updated\n */\n updatedAt: string;\n /** @description The unique identifier for the Webset this enrichment belongs to. */\n websetId: string;\n };\n /** @enum {string} */\n WebsetEnrichmentFormat: WebsetEnrichmentFormat;\n WebsetItem: {\n /**\n * Format: date-time\n * @description The date and time the item was created\n */\n createdAt: string;\n /** @description The enrichments results of the Webset item */\n enrichments: components[\"schemas\"][\"EnrichmentResult\"][] | null;\n /** @description The criteria evaluations of the item */\n evaluations: components[\"schemas\"][\"WebsetItemEvaluation\"][];\n /** @description The unique identifier for the Webset Item */\n id: string;\n /**\n * @default webset_item\n * @constant\n */\n object: \"webset_item\";\n /** @description The properties of the Item */\n properties:\n | components[\"schemas\"][\"WebsetItemPersonProperties\"]\n | components[\"schemas\"][\"WebsetItemCompanyProperties\"]\n | components[\"schemas\"][\"WebsetItemArticleProperties\"]\n | components[\"schemas\"][\"WebsetItemResearchPaperProperties\"]\n | components[\"schemas\"][\"WebsetItemCustomProperties\"];\n /**\n * @description The source of the Item\n * @enum {string}\n */\n source: WebsetItemSource;\n /** @description The unique identifier for the source */\n sourceId: string;\n /**\n * Format: date-time\n * @description The date and time the item was last updated\n */\n updatedAt: string;\n /** @description The unique identifier for the Webset this Item belongs to. */\n websetId: string;\n };\n WebsetItemArticleProperties: {\n /** WebsetItemArticlePropertiesFields */\n article: {\n /** @description The author(s) of the article */\n author: string | null;\n /** @description The date and time the article was published */\n publishedAt: string | null;\n /** @description The title of the article */\n title: string | null;\n };\n /** @description The text content for the article */\n content: string | null;\n /** @description Short description of the relevance of the article */\n description: string;\n /**\n * @default article\n * @constant\n */\n type: \"article\";\n /**\n * Format: uri\n * @description The URL of the article\n */\n url: string;\n };\n WebsetItemCompanyProperties: {\n /** WebsetItemCompanyPropertiesFields */\n company: {\n /** @description A short description of the company */\n about: string | null;\n /** @description The number of employees of the company */\n employees: number | null;\n /** @description The industry of the company */\n industry: string | null;\n /** @description The main location of the company */\n location: string | null;\n /**\n * Format: uri\n * @description The logo URL of the company\n */\n logoUrl: string | null;\n /** @description The name of the company */\n name: string;\n };\n /** @description The text content of the company website */\n content: string | null;\n /** @description Short description of the relevance of the company */\n description: string;\n /**\n * @default company\n * @constant\n */\n type: \"company\";\n /**\n * Format: uri\n * @description The URL of the company website\n */\n url: string;\n };\n WebsetItemCustomProperties: {\n /** @description The text content of the Item */\n content: string | null;\n /** WebsetItemCustomPropertiesFields */\n custom: {\n /** @description The author(s) of the website */\n author: string | null;\n /** @description The date and time the website was published */\n publishedAt: string | null;\n /** @description The title of the website */\n title: string | null;\n };\n /** @description Short description of the Item */\n description: string;\n /**\n * @default custom\n * @constant\n */\n type: \"custom\";\n /**\n * Format: uri\n * @description The URL of the Item\n */\n url: string;\n };\n WebsetItemEvaluation: {\n /** @description The description of the criterion */\n criterion: string;\n /** @description The reasoning for the result of the evaluation */\n reasoning: string;\n /**\n * @description The references used to generate the result.\n * @default []\n */\n references: {\n /** @description The relevant snippet of the reference content */\n snippet: string | null;\n /** @description The title of the reference */\n title: string | null;\n /**\n * Format: uri\n * @description The URL of the reference\n */\n url: string;\n }[];\n /**\n * @description The satisfaction of the criterion\n * @enum {string}\n */\n satisfied: WebsetItemEvaluationSatisfied;\n };\n WebsetItemPersonProperties: {\n /** @description Short description of the relevance of the person */\n description: string;\n /** WebsetItemPersonPropertiesFields */\n person: {\n /** WebsetItemPersonCompanyPropertiesFields */\n company: {\n /** @description The location the person is working at the company */\n location: string | null;\n /** @description The name of the company */\n name: string;\n } | null;\n /** @description The location of the person */\n location: string | null;\n /** @description The name of the person */\n name: string;\n /**\n * Format: uri\n * @description The image URL of the person\n */\n pictureUrl: string | null;\n /** @description The current work position of the person */\n position: string | null;\n };\n /**\n * @default person\n * @constant\n */\n type: \"person\";\n /**\n * Format: uri\n * @description The URL of the person profile\n */\n url: string;\n };\n WebsetItemPreview: {\n /**\n * Format: date-time\n * @description The date and time the preview was created\n */\n createdAt: string;\n /** @description The unique identifier for the preview item */\n id: string;\n /** @description The properties of the preview item */\n properties:\n | components[\"schemas\"][\"WebsetItemPersonProperties\"]\n | components[\"schemas\"][\"WebsetItemCompanyProperties\"]\n | components[\"schemas\"][\"WebsetItemArticleProperties\"]\n | components[\"schemas\"][\"WebsetItemResearchPaperProperties\"]\n | components[\"schemas\"][\"WebsetItemCustomProperties\"];\n };\n WebsetItemResearchPaperProperties: {\n /** @description The text content of the research paper */\n content: string | null;\n /** @description Short description of the relevance of the research paper */\n description: string;\n /** WebsetItemResearchPaperPropertiesFields */\n researchPaper: {\n /** @description The author(s) of the research paper */\n author: string | null;\n /** @description The date and time the research paper was published */\n publishedAt: string | null;\n /** @description The title of the research paper */\n title: string | null;\n };\n /**\n * @default research_paper\n * @constant\n */\n type: \"research_paper\";\n /**\n * Format: uri\n * @description The URL of the research paper\n */\n url: string;\n };\n WebsetSearch: {\n /**\n * @description The behavior of the search when it is added to a Webset.\n *\n * - `override`: the search will replace the existing Items found in the Webset and evaluate them against the new criteria. Any Items that don't match the new criteria will be discarded.\n * - `append`: the search will add the new Items found to the existing Webset. Any Items that don't match the new criteria will be discarded.\n * @default override\n */\n behavior: WebsetSearchBehavior;\n /**\n * Format: date-time\n * @description The date and time the search was canceled\n */\n canceledAt: string | null;\n /** @description The reason the search was canceled */\n canceledReason: WebsetSearchCanceledReason;\n /** @description The number of results the search will attempt to find. The actual number of results may be less than this number depending on the search complexity. */\n count: number;\n /**\n * Format: date-time\n * @description The date and time the search was created\n */\n createdAt: string;\n /** @description The criteria the search will use to evaluate the results. If not provided, we will automatically generate them for you. */\n criteria: {\n /** @description The description of the criterion */\n description: string;\n /** @description Value between 0 and 100 representing the percentage of results that meet the criterion. */\n successRate: number;\n }[];\n /** @description The entity the search will return results for.\n *\n * When no entity is provided during creation, we will automatically select the best entity based on the query. */\n entity: components[\"schemas\"][\"Entity\"];\n /** @description Sources (existing imports or websets) used to omit certain results to be found during the search. */\n exclude: {\n id: string;\n /** @enum {string} */\n source: WebsetExcludeSource;\n }[];\n /** @description The unique identifier for the search */\n id: string;\n /** @description The soft cap requested for matching people from the same current employer company, or null when no cap was requested. */\n maxPeoplePerCompany: number | null;\n /**\n * @description Set of key-value pairs you want to associate with this object.\n * @default {}\n */\n metadata: {\n [key: string]: string;\n };\n /**\n * @default webset_search\n * @constant\n */\n object: \"webset_search\";\n /** @description The progress of the search */\n progress: {\n /** @description The number of results analyzed so far */\n analyzed: number;\n /** @description The completion percentage of the search */\n completion: number;\n /** @description The number of results found so far */\n found: number;\n /** @description The estimated time remaining in seconds, null if unknown */\n timeLeft: number | null;\n };\n /** @description The query used to create the search. */\n query: string;\n /** @description Recall metrics for the search, null if not yet computed or requested. */\n recall: {\n expected: {\n bounds: {\n /** @description The maximum estimated total number of potential matches */\n max: number;\n /** @description The minimum estimated total number of potential matches */\n min: number;\n };\n /**\n * @description The confidence in the estimate\n * @enum {string}\n */\n confidence: WebsetSearchRecallExpectedConfidence;\n /** @description The estimated total number of potential matches */\n total: number;\n };\n /** @description The reasoning for the estimate */\n reasoning: string;\n } | null;\n /** @description The scope of the search. By default, there is no scope - thus searching the web.\n *\n * If provided during creation, the search will only be performed on the sources provided. */\n scope: {\n id: string;\n relationship?: {\n /** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. */\n definition: string;\n limit: number;\n };\n /** @enum {string} */\n source: WebsetSearchScopeSource;\n }[];\n /**\n * WebsetSearchStatus\n * @description The status of the search\n * @enum {string}\n */\n status: WebsetSearchStatus;\n /**\n * Format: date-time\n * @description The date and time the search was updated\n */\n updatedAt: string;\n /** @description The unique identifier for the Webset this search belongs to */\n websetId: string;\n };\n };\n responses: never;\n parameters: never;\n requestBodies: never;\n headers: never;\n pathItems: never;\n}\nexport type ArticleEntity = components[\"schemas\"][\"ArticleEntity\"];\nexport type CompanyEntity = components[\"schemas\"][\"CompanyEntity\"];\nexport type CreateCriterionParameters =\n components[\"schemas\"][\"CreateCriterionParameters\"];\nexport type CreateEnrichmentParameters =\n components[\"schemas\"][\"CreateEnrichmentParameters\"];\nexport type CreateImportParameters =\n components[\"schemas\"][\"CreateImportParameters\"];\nexport type CreateImportResponse =\n components[\"schemas\"][\"CreateImportResponse\"];\nexport type CreateMonitorParameters =\n components[\"schemas\"][\"CreateMonitorParameters\"];\nexport type CreateWebhookParameters =\n components[\"schemas\"][\"CreateWebhookParameters\"];\nexport type CreateWebsetParameters =\n components[\"schemas\"][\"CreateWebsetParameters\"];\nexport type CreateWebsetSearchParameters =\n components[\"schemas\"][\"CreateWebsetSearchParameters\"];\nexport type CustomEntity = components[\"schemas\"][\"CustomEntity\"];\nexport type EnrichmentResult = components[\"schemas\"][\"EnrichmentResult\"];\nexport type Entity = components[\"schemas\"][\"Entity\"];\nexport type Event = components[\"schemas\"][\"Event\"];\nexport type GetWebsetResponse = components[\"schemas\"][\"GetWebsetResponse\"];\nexport type Import = components[\"schemas\"][\"Import\"];\nexport type ListEventsResponse = components[\"schemas\"][\"ListEventsResponse\"];\nexport type ListImportsResponse = components[\"schemas\"][\"ListImportsResponse\"];\nexport type ListMonitorRunsResponse =\n components[\"schemas\"][\"ListMonitorRunsResponse\"];\nexport type ListMonitorsResponse =\n components[\"schemas\"][\"ListMonitorsResponse\"];\nexport type ListWebhookAttemptsResponse =\n components[\"schemas\"][\"ListWebhookAttemptsResponse\"];\nexport type ListWebhooksResponse =\n components[\"schemas\"][\"ListWebhooksResponse\"];\nexport type ListWebsetItemResponse =\n components[\"schemas\"][\"ListWebsetItemResponse\"];\nexport type ListWebsetsResponse = components[\"schemas\"][\"ListWebsetsResponse\"];\nexport type Monitor = components[\"schemas\"][\"Monitor\"];\nexport type MonitorBehavior = components[\"schemas\"][\"MonitorBehavior\"];\nexport type MonitorCadence = components[\"schemas\"][\"MonitorCadence\"];\nexport type MonitorRun = components[\"schemas\"][\"MonitorRun\"];\nexport type PersonEntity = components[\"schemas\"][\"PersonEntity\"];\nexport type PreviewWebsetParameters =\n components[\"schemas\"][\"PreviewWebsetParameters\"];\nexport type PreviewWebsetResponse =\n components[\"schemas\"][\"PreviewWebsetResponse\"];\nexport type ResearchPaperEntity = components[\"schemas\"][\"ResearchPaperEntity\"];\nexport type UpdateEnrichmentParameters =\n components[\"schemas\"][\"UpdateEnrichmentParameters\"];\nexport type UpdateImport = components[\"schemas\"][\"UpdateImport\"];\nexport type UpdateMonitor = components[\"schemas\"][\"UpdateMonitor\"];\nexport type UpdateWebhookParameters =\n components[\"schemas\"][\"UpdateWebhookParameters\"];\nexport type UpdateWebsetRequest = components[\"schemas\"][\"UpdateWebsetRequest\"];\nexport type Webhook = components[\"schemas\"][\"Webhook\"];\nexport type WebhookAttempt = components[\"schemas\"][\"WebhookAttempt\"];\nexport type Webset = components[\"schemas\"][\"Webset\"];\nexport type WebsetEnrichment = components[\"schemas\"][\"WebsetEnrichment\"];\nexport type WebsetItem = components[\"schemas\"][\"WebsetItem\"];\nexport type WebsetItemArticleProperties =\n components[\"schemas\"][\"WebsetItemArticleProperties\"];\nexport type WebsetItemCompanyProperties =\n components[\"schemas\"][\"WebsetItemCompanyProperties\"];\nexport type WebsetItemCustomProperties =\n components[\"schemas\"][\"WebsetItemCustomProperties\"];\nexport type WebsetItemEvaluation =\n components[\"schemas\"][\"WebsetItemEvaluation\"];\nexport type WebsetItemPersonProperties =\n components[\"schemas\"][\"WebsetItemPersonProperties\"];\nexport type WebsetItemPreview = components[\"schemas\"][\"WebsetItemPreview\"];\nexport type WebsetItemResearchPaperProperties =\n components[\"schemas\"][\"WebsetItemResearchPaperProperties\"];\nexport type WebsetSearch = components[\"schemas\"][\"WebsetSearch\"];\nexport type $defs = Record<string, never>;\nexport interface operations {\n \"events-list\": {\n parameters: {\n query?: {\n /** @description Filter events created after or at this timestamp (inclusive). Must be a valid ISO 8601 datetime string. All times are in UTC. */\n createdAfter?: string;\n /** @description Filter events created before or at this timestamp (inclusive). Must be a valid ISO 8601 datetime string. All times are in UTC. */\n createdBefore?: string;\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n /** @description The types of events to filter by */\n types?: EventType[];\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of events */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListEventsResponse\"];\n };\n };\n };\n };\n \"events-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the event */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Event\"];\n };\n };\n /** @description Event not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"imports-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of imports */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListImportsResponse\"];\n };\n };\n };\n };\n \"imports-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateImportParameters\"];\n };\n };\n responses: {\n /** @description Import created successfully */\n 201: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"CreateImportResponse\"];\n };\n };\n };\n };\n \"imports-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Import */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Import details */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Import\"];\n };\n };\n };\n };\n \"imports-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Import */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Import deleted successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Import\"];\n };\n };\n };\n };\n \"imports-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Import */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateImport\"];\n };\n };\n responses: {\n /** @description Import updated successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Import\"];\n };\n };\n };\n };\n \"monitors-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n /** @description The id of the Webset to list monitors for */\n websetId?: string;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of monitors */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListMonitorsResponse\"];\n };\n };\n };\n };\n \"monitors-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateMonitorParameters\"];\n };\n };\n responses: {\n /** @description Monitor created successfully */\n 201: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Monitor details */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Monitor deleted successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateMonitor\"];\n };\n };\n responses: {\n /** @description Monitor updated successfully */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Monitor\"];\n };\n };\n };\n };\n \"monitors-runs-list\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Monitor to list runs for */\n monitor: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of monitor runs */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListMonitorRunsResponse\"];\n };\n };\n };\n };\n \"monitors-runs-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n id: string;\n /** @description The id of the Monitor to get the run for */\n monitor: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Monitor run details */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"MonitorRun\"];\n };\n };\n };\n };\n \"webhooks-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of webhooks */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebhooksResponse\"];\n };\n };\n };\n };\n \"webhooks-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateWebhookParameters\"];\n };\n };\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n };\n };\n \"webhooks-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n /** @description Webhook not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"webhooks-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n /** @description Webhook not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"webhooks-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateWebhookParameters\"];\n };\n };\n responses: {\n /** @description Webhook */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webhook\"];\n };\n };\n /** @description Webhook not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"webhooks-attempts-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The type of event to filter by */\n eventType?: EventType;\n /** @description The number of results to return */\n limit?: number;\n /** @description Filter attempts by their success status */\n successful?: boolean;\n };\n header?: never;\n path: {\n /** @description The ID of the webhook */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of webhook attempts */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebhookAttemptsResponse\"];\n };\n };\n };\n };\n \"websets-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of Websets to return */\n limit?: number;\n };\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description List of Websets */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebsetsResponse\"];\n };\n };\n };\n };\n \"websets-create\": {\n parameters: {\n query?: never;\n header?: never;\n path?: never;\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateWebsetParameters\"];\n };\n };\n responses: {\n /** @description Webset created */\n 201: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n /** @description Webset with this externalId already exists */\n 409: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-get\": {\n parameters: {\n query?: {\n /** @description Expand the response with the specified resources */\n expand?: PathsV0WebsetsIdGetParametersQueryExpand[];\n };\n header?: never;\n path: {\n /** @description The id or externalId of the Webset. */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"GetWebsetResponse\"];\n };\n };\n /** @description Webset not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n id: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateWebsetRequest\"];\n };\n };\n responses: {\n /** @description Webset updated */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n /** @description Webset not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset deleted */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n /** @description Webset not found */\n 404: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n id: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset canceled */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"Webset\"];\n };\n };\n };\n };\n \"websets-enrichments-create\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateEnrichmentParameters\"];\n };\n };\n responses: {\n /** @description Enrichment created */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-enrichments-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Enrichment */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Enrichment */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-enrichments-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Enrichment */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Enrichment deleted */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-enrichments-update\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n id: string;\n webset: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"UpdateEnrichmentParameters\"];\n };\n };\n responses: {\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n \"websets-enrichments-cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Enrichment */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Enrichment cancelled */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetEnrichment\"];\n };\n };\n };\n };\n \"websets-items-list\": {\n parameters: {\n query?: {\n /** @description The cursor to paginate through the results */\n cursor?: string;\n /** @description The number of results to return */\n limit?: number;\n /** @description The id of the source */\n sourceId?: string;\n };\n header?: never;\n path: {\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset Items */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"ListWebsetItemResponse\"];\n };\n };\n };\n };\n \"websets-items-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Webset item */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset Item */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetItem\"];\n };\n };\n };\n };\n \"websets-items-delete\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Webset item */\n id: string;\n /** @description The id or externalId of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Webset Item deleted */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetItem\"];\n };\n };\n };\n };\n \"websets-searches-create\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"CreateWebsetSearchParameters\"];\n };\n };\n responses: {\n /** @description Webset Search created */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetSearch\"];\n };\n };\n };\n };\n \"websets-searches-get\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Search */\n id: string;\n /** @description The id of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Search retrieved */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetSearch\"];\n };\n };\n };\n };\n \"websets-searches-cancel\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description The id of the Search */\n id: string;\n /** @description The id of the Webset */\n webset: string;\n };\n cookie?: never;\n };\n requestBody?: never;\n responses: {\n /** @description Search canceled */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"WebsetSearch\"];\n };\n };\n };\n };\n \"websets-preview\": {\n parameters: {\n query?: never;\n header?: never;\n path: {\n /** @description Weather you want to search for a preview list of items or not */\n search: boolean;\n };\n cookie?: never;\n };\n /** @description Search parameters */\n requestBody: {\n content: {\n \"application/json\": components[\"schemas\"][\"PreviewWebsetParameters\"];\n };\n };\n responses: {\n /** @description Preview of the webset */\n 200: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content: {\n \"application/json\": components[\"schemas\"][\"PreviewWebsetResponse\"];\n };\n };\n /** @description Unable to detect entity or criteria from query */\n 422: {\n headers: {\n /**\n * @description Unique identifier for the request.\n * @example req_N6SsgoiaOQOPqsYKKiw5\n */\n \"X-Request-Id\": string;\n [name: string]: unknown;\n };\n content?: never;\n };\n };\n };\n}\nexport enum PathsV0WebsetsIdGetParametersQueryExpand {\n items = \"items\",\n}\nexport enum CreateEnrichmentParametersFormat {\n text = \"text\",\n date = \"date\",\n number = \"number\",\n options = \"options\",\n email = \"email\",\n phone = \"phone\",\n url = \"url\",\n}\nexport enum CreateImportParametersFormat {\n csv = \"csv\",\n}\nexport enum CreateImportResponseFailedReason {\n invalid_format = \"invalid_format\",\n invalid_file_content = \"invalid_file_content\",\n missing_identifier = \"missing_identifier\",\n}\nexport enum CreateImportResponseFormat {\n csv = \"csv\",\n webset = \"webset\",\n}\nexport enum CreateImportResponseObject {\n import = \"import\",\n}\nexport enum CreateImportResponseStatus {\n pending = \"pending\",\n processing = \"processing\",\n completed = \"completed\",\n failed = \"failed\",\n canceled = \"canceled\",\n}\nexport enum WebsetImportSource {\n import = \"import\",\n webset = \"webset\",\n}\n\nexport enum EnrichmentResultStatus {\n pending = \"pending\",\n completed = \"completed\",\n canceled = \"canceled\",\n}\nexport enum EventType {\n webset_created = \"webset.created\",\n webset_deleted = \"webset.deleted\",\n webset_paused = \"webset.paused\",\n webset_idle = \"webset.idle\",\n webset_search_created = \"webset.search.created\",\n webset_search_canceled = \"webset.search.canceled\",\n webset_search_completed = \"webset.search.completed\",\n webset_search_updated = \"webset.search.updated\",\n import_created = \"import.created\",\n import_completed = \"import.completed\",\n webset_item_created = \"webset.item.created\",\n webset_item_enriched = \"webset.item.enriched\",\n monitor_created = \"monitor.created\",\n monitor_updated = \"monitor.updated\",\n monitor_deleted = \"monitor.deleted\",\n monitor_run_created = \"monitor.run.created\",\n monitor_run_completed = \"monitor.run.completed\",\n webset_export_created = \"webset.export.created\",\n webset_export_completed = \"webset.export.completed\",\n}\nexport enum ImportFailedReason {\n invalid_format = \"invalid_format\",\n invalid_file_content = \"invalid_file_content\",\n missing_identifier = \"missing_identifier\",\n}\nexport enum ImportFormat {\n csv = \"csv\",\n webset = \"webset\",\n}\nexport enum ImportObject {\n import = \"import\",\n}\nexport enum ImportStatus {\n pending = \"pending\",\n processing = \"processing\",\n completed = \"completed\",\n failed = \"failed\",\n canceled = \"canceled\",\n}\nexport enum MonitorObject {\n monitor = \"monitor\",\n}\nexport enum MonitorStatus {\n enabled = \"enabled\",\n disabled = \"disabled\",\n}\nexport enum MonitorRunObject {\n monitor_run = \"monitor_run\",\n}\nexport enum MonitorRunStatus {\n created = \"created\",\n running = \"running\",\n completed = \"completed\",\n canceled = \"canceled\",\n failed = \"failed\",\n}\nexport enum MonitorRunType {\n search = \"search\",\n refresh = \"refresh\",\n}\nexport enum UpdateMonitorStatus {\n enabled = \"enabled\",\n disabled = \"disabled\",\n}\nexport enum WebhookStatus {\n active = \"active\",\n inactive = \"inactive\",\n}\nexport enum WebsetStatus {\n idle = \"idle\",\n pending = \"pending\",\n running = \"running\",\n paused = \"paused\",\n}\nexport enum WebsetEnrichmentStatus {\n pending = \"pending\",\n canceled = \"canceled\",\n completed = \"completed\",\n}\nexport enum WebsetEnrichmentFormat {\n text = \"text\",\n date = \"date\",\n number = \"number\",\n options = \"options\",\n email = \"email\",\n phone = \"phone\",\n url = \"url\",\n}\nexport enum WebsetItemSource {\n search = \"search\",\n import = \"import\",\n}\nexport enum WebsetItemEvaluationSatisfied {\n yes = \"yes\",\n no = \"no\",\n unclear = \"unclear\",\n}\nexport enum WebsetExcludeSource {\n import = \"import\",\n webset = \"webset\",\n}\nexport enum WebsetSearchRecallExpectedConfidence {\n high = \"high\",\n medium = \"medium\",\n low = \"low\",\n}\nexport enum WebsetSearchScopeSource {\n import = \"import\",\n webset = \"webset\",\n}\nexport enum WebsetSearchStatus {\n created = \"created\",\n pending = \"pending\",\n running = \"running\",\n completed = \"completed\",\n canceled = \"canceled\",\n}\nexport enum WebsetSearchBehavior {\n override = \"override\",\n append = \"append\",\n}\nexport enum WebsetSearchCanceledReason {\n webset_deleted = \"webset_deleted\",\n webset_canceled = \"webset_canceled\",\n out_of_credits = \"out_of_credits\",\n}\n","/**\n * Client for managing Imports\n */\nimport { ExaAbortError, ExaError, HttpStatusCode } from \"../errors\";\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport {\n CreateImportParameters,\n CreateImportParametersFormat,\n CreateImportResponse,\n Import,\n ImportStatus,\n ListImportsResponse,\n UpdateImport,\n} from \"./openapi\";\nimport {\n resolveRequestSignal,\n sleep,\n withClientDefaults,\n type RequestOptions,\n} from \"../request-options\";\n\n/**\n * Options for waiting until import completion\n */\nexport interface WaitUntilCompletedOptions {\n /**\n * Maximum time to wait in milliseconds (default: 5 minutes)\n */\n timeout?: number;\n /**\n * How often to poll for status in milliseconds (default: 2 seconds)\n */\n pollInterval?: number;\n /**\n * Callback function called on each poll with the current status\n */\n onPoll?: (status: ImportStatus) => void;\n}\n\n/**\n * Parameters for creating an import with CSV data\n */\nexport interface CreateImportWithCsvParameters {\n /**\n * Title of the import\n */\n title: string;\n /**\n * Entity type and configuration\n */\n entity: CreateImportParameters[\"entity\"];\n /**\n * Optional metadata\n */\n metadata?: CreateImportParameters[\"metadata\"];\n /**\n * Optional CSV-specific parameters\n */\n csv?: CreateImportParameters[\"csv\"];\n}\n\n/**\n * CSV data to import, as text or as UTF-8 bytes in a `Uint8Array`, such as a\n * Node.js `Buffer`.\n */\nexport type CsvDataInput = string | Uint8Array;\n\n/**\n * Client for managing Imports\n */\nexport class ImportsClient extends WebsetsBaseClient {\n /**\n * Create a new Import (basic version - returns upload URL)\n * @param params The import creation parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Import response with upload URL\n */\n async create(\n params: CreateImportParameters,\n csv?: undefined,\n requestOptions?: RequestOptions\n ): Promise<CreateImportResponse>;\n\n /**\n * Create a new Import with CSV data (handles upload)\n * @param params The import creation parameters (without size/count - calculated automatically)\n * @param csv CSV data as a string, or as UTF-8 bytes in a Uint8Array such as a Buffer\n * @param requestOptions Per-call request options. `signal` and `timeout` also apply to the upload. `body`, `headers` and `query` apply to the create request only\n * @returns The create response, once the CSV is uploaded. The import is not\n * fetched again, so its status is the one it was created with. Call `get`\n * or `waitUntilCompleted` for its current state.\n */\n async create(\n params: CreateImportWithCsvParameters,\n csv: CsvDataInput,\n requestOptions?: RequestOptions\n ): Promise<Import>;\n\n async create(\n params: CreateImportParameters | CreateImportWithCsvParameters,\n csv?: CsvDataInput,\n requestOptions?: RequestOptions\n ): Promise<CreateImportResponse | Import> {\n const scoped = this.withRequestOptions(requestOptions);\n if (csv === undefined) {\n return scoped.request<CreateImportResponse>(\n \"/v0/imports\",\n \"POST\",\n params as CreateImportParameters\n );\n }\n\n // The bytes to upload and their text, with the web encoding APIs rather\n // than Node's Buffer, so a CSV upload also works where Buffer is absent.\n // A Buffer is a Uint8Array and is uploaded as is.\n let csvBytes: Uint8Array;\n let csvText: string;\n if (typeof csv === \"string\") {\n csvBytes = new TextEncoder().encode(csv);\n csvText = csv;\n } else if (csv instanceof Uint8Array) {\n csvBytes = csv;\n csvText = new TextDecoder().decode(csv);\n } else {\n throw new ExaError(\n \"Invalid CSV data input. Must be a string or a Uint8Array such as a Buffer\",\n HttpStatusCode.BadRequest\n );\n }\n\n const sizeInBytes = csvBytes.byteLength;\n const sizeInMB = Math.max(1, Math.ceil(sizeInBytes / (1024 * 1024)));\n\n const lines = csvText.split(\"\\n\").filter((line) => line.trim().length > 0);\n const recordCount = Math.max(0, lines.length - 1); // Subtract 1 for header\n\n if (sizeInMB > 50) {\n throw new ExaError(\n `CSV file too large: ${sizeInMB}MB. Maximum size is 50MB.`,\n HttpStatusCode.BadRequest\n );\n }\n\n if (recordCount === 0) {\n throw new ExaError(\n \"CSV file appears to have no data records (only header or empty)\",\n HttpStatusCode.BadRequest\n );\n }\n\n const createParams: CreateImportParameters = {\n title: params.title,\n format: CreateImportParametersFormat.csv,\n entity: params.entity,\n size: sizeInBytes,\n count: recordCount,\n metadata: params.metadata,\n csv: (params as CreateImportWithCsvParameters).csv,\n };\n\n const importResponse = await scoped.request<CreateImportResponse>(\n \"/v0/imports\",\n \"POST\",\n createParams\n );\n\n // The upload goes to a presigned URL rather than through the client, so\n // it resolves the same transport options itself.\n const upload = resolveRequestSignal(\n withClientDefaults(this.client, scoped.requestOptions)\n );\n try {\n const uploadResponse = await fetch(importResponse.uploadUrl, {\n method: \"PUT\",\n body: csvBytes as BodyInit,\n signal: upload.signal,\n });\n\n if (!uploadResponse.ok) {\n const errorText = await uploadResponse.text();\n throw new ExaError(\n `Upload failed: ${uploadResponse.status} ${uploadResponse.statusText}. ${errorText}`,\n HttpStatusCode.BadRequest\n );\n }\n } catch (error) {\n const requestError = upload.toRequestError(error);\n if (\n requestError instanceof ExaError ||\n requestError instanceof ExaAbortError\n ) {\n throw requestError;\n }\n throw new ExaError(\n `Failed to upload CSV data: ${(error as Error).message}`,\n HttpStatusCode.BadRequest\n );\n } finally {\n upload.dispose();\n }\n\n return importResponse;\n }\n\n /**\n * Get an Import by ID\n * @param id The ID of the Import\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Import\n */\n async get(id: string, requestOptions?: RequestOptions): Promise<Import> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Import>(`/v0/imports/${id}`, \"GET\");\n }\n\n /**\n * List all Imports\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Imports\n */\n async list(\n options?: PaginationParams,\n requestOptions?: RequestOptions\n ): Promise<ListImportsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListImportsResponse>(\n \"/v0/imports\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Update an Import\n * @param id The ID of the Import\n * @param params The import update parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The updated Import\n */\n async update(\n id: string,\n params: UpdateImport,\n requestOptions?: RequestOptions\n ): Promise<Import> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Import>(`/v0/imports/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete an Import\n * @param id The ID of the Import\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Import\n */\n async delete(id: string, requestOptions?: RequestOptions): Promise<Import> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Import>(`/v0/imports/${id}`, \"DELETE\");\n }\n\n /**\n * Wait until an Import is completed or failed\n * @param id The ID of the Import\n * @param options Configuration options for timeout and polling\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Import once it reaches a final state (completed or failed)\n * @throws Error if the Import does not complete within the timeout or fails\n */\n async waitUntilCompleted(\n id: string,\n options?: WaitUntilCompletedOptions,\n requestOptions?: RequestOptions\n ): Promise<Import> {\n const scoped = this.withRequestOptions(requestOptions);\n const timeout = options?.timeout ?? 30 * 60 * 1000;\n const pollInterval = options?.pollInterval ?? 2_000;\n const onPoll = options?.onPoll;\n\n const startTime = Date.now();\n\n while (true) {\n const importItem = await scoped.get(id);\n\n if (onPoll) {\n onPoll(importItem.status);\n }\n\n if (importItem.status === ImportStatus.completed) {\n return importItem;\n }\n\n if (importItem.status === ImportStatus.failed) {\n throw new ExaError(\n `Import ${id} failed: ${importItem.failedMessage || \"Unknown error\"}`,\n HttpStatusCode.BadRequest\n );\n }\n\n if (Date.now() - startTime > timeout) {\n throw new ExaError(\n `Import ${id} did not complete within ${timeout}ms. Current status: ${importItem.status}`,\n HttpStatusCode.RequestTimeout\n );\n }\n\n await sleep(pollInterval, scoped.requestOptions?.signal);\n }\n }\n\n /**\n * Iterate through all Imports, handling pagination automatically\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Imports\n */\n async *listAll(\n options?: PaginationParams,\n requestOptions?: RequestOptions\n ): AsyncGenerator<Import> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const importItem of response.data) {\n yield importItem;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Imports into an array\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Imports\n */\n async getAll(\n options?: PaginationParams,\n requestOptions?: RequestOptions\n ): Promise<Import[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const imports: Import[] = [];\n for await (const importItem of scoped.listAll(options)) {\n imports.push(importItem);\n }\n return imports;\n }\n}\n","/**\n * Client for managing Webset Items\n */\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport { ListWebsetItemResponse, WebsetItem } from \"./openapi\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Options for listing webset items\n */\nexport interface ListWebsetItemsOptions extends PaginationParams {\n /**\n * The id of the source to filter items by\n */\n sourceId?: string;\n}\n\n/**\n * Client for managing Webset Items\n */\nexport class WebsetItemsClient extends WebsetsBaseClient {\n /**\n * List all Items for a Webset\n * @param websetId The ID of the Webset\n * @param params - Optional pagination and filtering parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns A promise that resolves with the list of Items\n */\n list(\n websetId: string,\n params?: ListWebsetItemsOptions,\n requestOptions?: RequestOptions\n ): Promise<ListWebsetItemResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const queryParams = {\n ...this.buildPaginationParams(params),\n sourceId: params?.sourceId,\n };\n return scoped.request<ListWebsetItemResponse>(\n `/v0/websets/${websetId}/items`,\n \"GET\",\n undefined,\n queryParams\n );\n }\n\n /**\n * Iterate through all Items in a Webset, handling pagination automatically\n * @param websetId The ID of the Webset\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Webset Items\n */\n async *listAll(\n websetId: string,\n options?: ListWebsetItemsOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<WebsetItem> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(websetId, pageOptions);\n\n for (const item of response.data) {\n yield item;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all items from a Webset into an array\n * @param websetId The ID of the Webset\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Webset Items\n */\n async getAll(\n websetId: string,\n options?: ListWebsetItemsOptions,\n requestOptions?: RequestOptions\n ): Promise<WebsetItem[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const items: WebsetItem[] = [];\n for await (const item of scoped.listAll(websetId, options)) {\n items.push(item);\n }\n return items;\n }\n\n /**\n * Get an Item by ID\n * @param websetId The ID of the Webset\n * @param id The ID of the Item\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Webset Item\n */\n async get(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetItem> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetItem>(\n `/v0/websets/${websetId}/items/${id}`,\n \"GET\"\n );\n }\n\n /**\n * Delete an Item\n * @param websetId The ID of the Webset\n * @param id The ID of the Item\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Webset Item\n */\n async delete(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetItem> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetItem>(\n `/v0/websets/${websetId}/items/${id}`,\n \"DELETE\"\n );\n }\n}\n","/**\n * Client for managing Webset Monitors\n */\nimport { Exa } from \"..\";\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport {\n CreateMonitorParameters,\n ListMonitorRunsResponse,\n ListMonitorsResponse,\n Monitor,\n MonitorRun,\n UpdateMonitor,\n} from \"./openapi\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Options for listing monitors\n */\nexport interface ListMonitorsOptions extends PaginationParams {\n /**\n * The id of the Webset to list monitors for\n */\n websetId?: string;\n}\n\n/**\n * Client for managing Monitor Runs\n */\nexport class WebsetMonitorRunsClient extends WebsetsBaseClient {\n /**\n * List all runs for a Monitor\n * @param monitorId The ID of the Monitor\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Monitor runs\n */\n async list(\n monitorId: string,\n options?: PaginationParams,\n requestOptions?: RequestOptions\n ): Promise<ListMonitorRunsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListMonitorRunsResponse>(\n `/v0/monitors/${monitorId}/runs`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Get a specific Monitor run\n * @param monitorId The ID of the Monitor\n * @param runId The ID of the Monitor run\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Monitor run\n */\n async get(\n monitorId: string,\n runId: string,\n requestOptions?: RequestOptions\n ): Promise<MonitorRun> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<MonitorRun>(\n `/v0/monitors/${monitorId}/runs/${runId}`,\n \"GET\"\n );\n }\n}\n\n/**\n * Client for managing Webset Monitors\n */\nexport class WebsetMonitorsClient extends WebsetsBaseClient {\n /**\n * Client for managing Monitor Runs\n */\n runs: WebsetMonitorRunsClient;\n\n constructor(client: Exa) {\n super(client);\n this.runs = new WebsetMonitorRunsClient(client);\n }\n\n /**\n * Create a Monitor\n * @param params The monitor parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Monitor\n */\n async create(\n params: CreateMonitorParameters,\n requestOptions?: RequestOptions\n ): Promise<Monitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Monitor>(\"/v0/monitors\", \"POST\", params);\n }\n\n /**\n * Get a Monitor by ID\n * @param id The ID of the Monitor\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Monitor\n */\n async get(id: string, requestOptions?: RequestOptions): Promise<Monitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Monitor>(`/v0/monitors/${id}`, \"GET\");\n }\n\n /**\n * List all Monitors\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Monitors\n */\n async list(\n options?: ListMonitorsOptions,\n requestOptions?: RequestOptions\n ): Promise<ListMonitorsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = {\n cursor: options?.cursor,\n limit: options?.limit,\n websetId: options?.websetId,\n };\n return scoped.request<ListMonitorsResponse>(\n \"/v0/monitors\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Update a Monitor\n * @param id The ID of the Monitor\n * @param params The monitor update parameters (status, metadata)\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The updated Monitor\n */\n async update(\n id: string,\n params: UpdateMonitor,\n requestOptions?: RequestOptions\n ): Promise<Monitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Monitor>(`/v0/monitors/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete a Monitor\n * @param id The ID of the Monitor\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Monitor\n */\n async delete(id: string, requestOptions?: RequestOptions): Promise<Monitor> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Monitor>(`/v0/monitors/${id}`, \"DELETE\");\n }\n\n /**\n * Iterate through all Monitors, handling pagination automatically\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Monitors\n */\n async *listAll(\n options?: ListMonitorsOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<Monitor> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const monitor of response.data) {\n yield monitor;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Monitors into an array\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Monitors\n */\n async getAll(\n options?: ListMonitorsOptions,\n requestOptions?: RequestOptions\n ): Promise<Monitor[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const monitors: Monitor[] = [];\n for await (const monitor of scoped.listAll(options)) {\n monitors.push(monitor);\n }\n return monitors;\n }\n}\n","/**\n * Client for managing Webset Searches\n */\nimport { WebsetHeadersLike } from \".\";\nimport { WebsetsBaseClient } from \"./base\";\nimport { CreateWebsetSearchParameters, WebsetSearch } from \"./openapi\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Client for managing Webset Searches\n */\nexport class WebsetSearchesClient extends WebsetsBaseClient {\n /**\n * Create a new Search for the Webset\n * @param websetId The ID of the Webset\n * @param params The search parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Webset Search\n */\n async create(\n websetId: string,\n params: CreateWebsetSearchParameters,\n options?: { headers?: WebsetHeadersLike },\n requestOptions?: RequestOptions\n ): Promise<WebsetSearch> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetSearch>(\n `/v0/websets/${websetId}/searches`,\n \"POST\",\n params,\n undefined,\n options?.headers\n );\n }\n\n /**\n * Get a Search by ID\n * @param websetId The ID of the Webset\n * @param id The ID of the Search\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Webset Search\n */\n async get(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetSearch> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetSearch>(\n `/v0/websets/${websetId}/searches/${id}`,\n \"GET\"\n );\n }\n\n /**\n * Cancel a running Search\n * @param websetId The ID of the Webset\n * @param id The ID of the Search\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The canceled Webset Search\n */\n async cancel(\n websetId: string,\n id: string,\n requestOptions?: RequestOptions\n ): Promise<WebsetSearch> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<WebsetSearch>(\n `/v0/websets/${websetId}/searches/${id}/cancel`,\n \"POST\"\n );\n }\n}\n","/**\n * Client for managing Webset Webhooks\n */\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport {\n CreateWebhookParameters,\n EventType,\n ListWebhookAttemptsResponse,\n ListWebhooksResponse,\n UpdateWebhookParameters,\n Webhook,\n WebhookAttempt,\n} from \"./openapi\";\nimport { type RequestOptions } from \"../request-options\";\n\n/**\n * Options for listing webhooks (only pagination is supported by API)\n */\nexport interface ListWebhooksOptions extends PaginationParams {}\n\n/**\n * Options for listing webhook attempts\n */\nexport interface ListWebhookAttemptsOptions extends PaginationParams {\n /**\n * The type of event to filter by\n */\n eventType?: EventType;\n /**\n * Filter attempts by their success status\n */\n successful?: boolean;\n}\n\n/**\n * Client for managing Webset Webhooks\n */\nexport class WebsetWebhooksClient extends WebsetsBaseClient {\n /**\n * Create a Webhook\n * @param params The webhook parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Webhook\n */\n async create(\n params: CreateWebhookParameters,\n requestOptions?: RequestOptions\n ): Promise<Webhook> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webhook>(\"/v0/webhooks\", \"POST\", params);\n }\n\n /**\n * Get a Webhook by ID\n * @param id The ID of the Webhook\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Webhook\n */\n async get(id: string, requestOptions?: RequestOptions): Promise<Webhook> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webhook>(`/v0/webhooks/${id}`, \"GET\");\n }\n\n /**\n * List all Webhooks\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Webhooks\n */\n async list(\n options?: ListWebhooksOptions,\n requestOptions?: RequestOptions\n ): Promise<ListWebhooksResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListWebhooksResponse>(\n \"/v0/webhooks\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all Webhooks, handling pagination automatically\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Webhooks\n */\n async *listAll(\n options?: ListWebhooksOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<Webhook> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const webhook of response.data) {\n yield webhook;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Webhooks into an array\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Webhooks\n */\n async getAll(\n options?: ListWebhooksOptions,\n requestOptions?: RequestOptions\n ): Promise<Webhook[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const webhooks: Webhook[] = [];\n for await (const webhook of scoped.listAll(options)) {\n webhooks.push(webhook);\n }\n return webhooks;\n }\n\n /**\n * Update a Webhook\n * @param id The ID of the Webhook\n * @param params The webhook update parameters (events, metadata, url)\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The updated Webhook\n */\n async update(\n id: string,\n params: UpdateWebhookParameters,\n requestOptions?: RequestOptions\n ): Promise<Webhook> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webhook>(`/v0/webhooks/${id}`, \"PATCH\", params);\n }\n\n /**\n * Delete a Webhook\n * @param id The ID of the Webhook\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Webhook\n */\n async delete(id: string, requestOptions?: RequestOptions): Promise<Webhook> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webhook>(`/v0/webhooks/${id}`, \"DELETE\");\n }\n\n /**\n * List all attempts for a Webhook\n * @param id The ID of the Webhook\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Webhook attempts\n */\n async listAttempts(\n id: string,\n options?: ListWebhookAttemptsOptions,\n requestOptions?: RequestOptions\n ): Promise<ListWebhookAttemptsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = {\n cursor: options?.cursor,\n limit: options?.limit,\n eventType: options?.eventType,\n successful: options?.successful,\n };\n\n return scoped.request<ListWebhookAttemptsResponse>(\n `/v0/webhooks/${id}/attempts`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all attempts for a Webhook, handling pagination automatically\n * @param id The ID of the Webhook\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Webhook attempts\n */\n async *listAllAttempts(\n id: string,\n options?: ListWebhookAttemptsOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<WebhookAttempt> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.listAttempts(id, pageOptions);\n\n for (const attempt of response.data) {\n yield attempt;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all attempts for a Webhook into an array\n * @param id The ID of the Webhook\n * @param options Pagination and filtering options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Webhook attempts\n */\n async getAllAttempts(\n id: string,\n options?: ListWebhookAttemptsOptions,\n requestOptions?: RequestOptions\n ): Promise<WebhookAttempt[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const attempts: WebhookAttempt[] = [];\n for await (const attempt of scoped.listAllAttempts(id, options)) {\n attempts.push(attempt);\n }\n return attempts;\n }\n}\n","/**\n * Main client for Websets API\n */\nimport { Exa, ExaError, HttpStatusCode, WebsetHeadersLike } from \"../index\";\nimport { PaginationParams, WebsetsBaseClient } from \"./base\";\nimport { WebsetEnrichmentsClient } from \"./enrichments\";\nimport { EventsClient } from \"./events\";\nimport { ImportsClient } from \"./imports\";\nimport { WebsetItemsClient } from \"./items\";\nimport { WebsetMonitorsClient } from \"./monitors\";\nimport {\n CreateWebsetParameters,\n GetWebsetResponse,\n ListWebsetsResponse,\n PreviewWebsetParameters,\n PreviewWebsetResponse,\n UpdateWebsetRequest,\n Webset,\n WebsetStatus,\n} from \"./openapi\";\nimport { WebsetSearchesClient } from \"./searches\";\nimport { WebsetWebhooksClient } from \"./webhooks\";\nimport { sleep, type RequestOptions } from \"../request-options\";\n\n/**\n * Options for listing Websets (API only supports pagination)\n */\nexport interface ListWebsetsOptions extends PaginationParams {}\n\n/**\n * Client for managing Websets\n */\nexport class WebsetsClient extends WebsetsBaseClient {\n /**\n * Client for managing Events\n */\n events: EventsClient;\n\n /**\n * Client for managing Imports\n */\n imports: ImportsClient;\n\n /**\n * Client for managing Webset Items\n */\n items: WebsetItemsClient;\n\n /**\n * Client for managing Webset Searches\n */\n searches: WebsetSearchesClient;\n\n /**\n * Client for managing Webset Enrichments\n */\n enrichments: WebsetEnrichmentsClient;\n\n /**\n * Client for managing Webset Monitors\n */\n monitors: WebsetMonitorsClient;\n\n /**\n * Client for managing Webset Webhooks\n */\n webhooks: WebsetWebhooksClient;\n\n /**\n * Initialize a new Websets client\n * @param client The Exa client instance\n */\n constructor(client: Exa) {\n super(client);\n this.events = new EventsClient(client);\n this.imports = new ImportsClient(client);\n this.items = new WebsetItemsClient(client);\n this.searches = new WebsetSearchesClient(client);\n this.enrichments = new WebsetEnrichmentsClient(client);\n this.monitors = new WebsetMonitorsClient(client);\n this.webhooks = new WebsetWebhooksClient(client);\n }\n\n /**\n * Create a new Webset\n * @param params The Webset creation parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The created Webset\n */\n async create(\n params: CreateWebsetParameters,\n options?: { headers?: WebsetHeadersLike },\n requestOptions?: RequestOptions\n ): Promise<Webset> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webset>(\n \"/v0/websets\",\n \"POST\",\n params,\n undefined,\n options?.headers\n );\n }\n\n /**\n * Preview a webset\n * @param params The preview parameters\n * @param options Optional parameters. Search = true allows you to retrieve a preview set of items that could be returned by the webset.\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns How the query will be interpreted.\n */\n async preview(\n params: PreviewWebsetParameters,\n options?: { search?: boolean },\n requestOptions?: RequestOptions\n ): Promise<PreviewWebsetResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const queryParams: { search?: boolean } = {};\n if (options?.search !== undefined) {\n queryParams.search = options.search;\n }\n\n return scoped.request<PreviewWebsetResponse>(\n \"/v0/websets/preview\",\n \"POST\",\n params,\n queryParams\n );\n }\n\n /**\n * Get a Webset by ID\n * @param id The ID of the Webset\n * @param expand Optional array of relations to expand\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Webset\n */\n async get(\n id: string,\n expand?: Array<\"items\">,\n requestOptions?: RequestOptions\n ): Promise<GetWebsetResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params: { expand?: Array<\"items\"> } = {};\n if (expand) {\n params.expand = expand;\n }\n\n return scoped.request<GetWebsetResponse>(\n `/v0/websets/${id}`,\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * List all Websets\n * @param options Pagination options (filtering by status is not supported by API)\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The list of Websets\n */\n async list(\n options?: ListWebsetsOptions,\n requestOptions?: RequestOptions\n ): Promise<ListWebsetsResponse> {\n const scoped = this.withRequestOptions(requestOptions);\n const params = this.buildPaginationParams(options);\n return scoped.request<ListWebsetsResponse>(\n \"/v0/websets\",\n \"GET\",\n undefined,\n params\n );\n }\n\n /**\n * Iterate through all Websets, handling pagination automatically\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Async generator of Websets\n */\n async *listAll(\n options?: ListWebsetsOptions,\n requestOptions?: RequestOptions\n ): AsyncGenerator<Webset> {\n let scoped = this.withRequestOptions(requestOptions);\n let cursor: string | undefined = undefined;\n const pageOptions = options ? { ...options } : {};\n\n while (true) {\n pageOptions.cursor = cursor;\n const response = await scoped.list(pageOptions);\n\n for (const webset of response.data) {\n yield webset;\n }\n\n if (!response.hasMore || !response.nextCursor) {\n break;\n }\n\n cursor = response.nextCursor;\n scoped = scoped.forNextPage();\n }\n }\n\n /**\n * Collect all Websets into an array\n * @param options Pagination options\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns Promise resolving to an array of all Websets\n */\n async getAll(\n options?: ListWebsetsOptions,\n requestOptions?: RequestOptions\n ): Promise<Webset[]> {\n const scoped = this.withRequestOptions(requestOptions);\n const websets: Webset[] = [];\n for await (const webset of scoped.listAll(options)) {\n websets.push(webset);\n }\n return websets;\n }\n\n /**\n * Update a Webset\n * @param id The ID of the Webset\n * @param params The Webset update parameters\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The updated Webset\n */\n async update(\n id: string,\n params: UpdateWebsetRequest,\n requestOptions?: RequestOptions\n ): Promise<Webset> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webset>(`/v0/websets/${id}`, \"POST\", params);\n }\n\n /**\n * Delete a Webset\n * @param id The ID of the Webset\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The deleted Webset\n */\n async delete(id: string, requestOptions?: RequestOptions): Promise<Webset> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webset>(`/v0/websets/${id}`, \"DELETE\");\n }\n\n /**\n * Cancel a running Webset\n * @param id The ID or external ID of the Webset\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The canceled Webset (as returned by the API)\n */\n async cancel(id: string, requestOptions?: RequestOptions): Promise<Webset> {\n const scoped = this.withRequestOptions(requestOptions);\n return scoped.request<Webset>(`/v0/websets/${id}/cancel`, \"POST\");\n }\n\n /**\n * Wait until a Webset is idle\n * @param id The ID of the Webset\n * @param options Configuration options for timeout and polling\n * @param requestOptions Per-call request options (`signal`, `timeout`, `body`, `headers`, `query`)\n * @returns The Webset once it becomes idle\n * @throws Error if the Webset does not become idle within the timeout\n */\n async waitUntilIdle(\n id: string,\n options?:\n | {\n timeout?: number;\n pollInterval?: number;\n onPoll?: (status: WebsetStatus) => void;\n }\n | number, // Legacy: timeout only\n requestOptions?: RequestOptions\n ): Promise<Webset> {\n const scoped = this.withRequestOptions(requestOptions);\n let timeout: number | undefined;\n let pollInterval = 1000;\n let onPoll: ((status: WebsetStatus) => void) | undefined;\n\n // Handle legacy timeout argument or new options object\n if (typeof options === \"number\") {\n timeout = options;\n } else if (options) {\n timeout = options.timeout;\n pollInterval = options.pollInterval || 1000;\n onPoll = options.onPoll;\n }\n\n const startTime = Date.now();\n\n while (true) {\n const webset = await scoped.get(id);\n\n if (onPoll) {\n onPoll(webset.status);\n }\n\n if (webset.status === WebsetStatus.idle) {\n return webset;\n }\n\n if (timeout && Date.now() - startTime > timeout) {\n throw new ExaError(\n `Webset ${id} did not reach idle state within ${timeout}ms. Current status: ${webset.status}`,\n HttpStatusCode.RequestTimeout\n );\n }\n\n await sleep(pollInterval, scoped.requestOptions?.signal);\n }\n }\n}\n","import { z } from \"zod\";\nimport type {\n ContentsOptions,\n RegularSearchOptions,\n SearchResponse,\n} from \"../index\";\n\n// Search responses can carry `notices`: notes about how the results were\n// produced, written for a model. The search tool's text leads with one\n// `Note: <message>` line per notice, then a blank line, then the results: the\n// format agent evals measured. A response without notices formats exactly as\n// before. `warnings` describe the request, not the results, so the tool leaves\n// them out of its text.\nimport type { Exa } from \"../index\";\nimport { zodToJsonSchema } from \"../zod-utils\";\n\nexport type ToolJsonSchema = {\n type: \"object\";\n properties?: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n [key: string]: unknown;\n};\n\nexport type ToolDefinition = {\n name: string;\n description: string;\n parameters?: ToolJsonSchema;\n input_schema?: ToolJsonSchema;\n strict?: boolean;\n};\n\nexport type ExaToolSpec<Args = unknown, Result = unknown> = {\n name: string;\n description: string;\n inputSchema: z.ZodType<Args>;\n jsonSchema: ToolJsonSchema;\n execute(args: Args): Promise<Result>;\n format(result: Result): string;\n definition: ToolDefinition;\n run(args: unknown): Promise<string>;\n};\n\nexport type WebSearchToolConfig = RegularSearchOptions & {\n /**\n * Tool name shown to the model. Defaults to `\"web_search\"`. Set a custom\n * name to avoid collisions, e.g. with Anthropic's built-in `web_search`\n * server tool, or to register multiple differently-configured search tools.\n */\n name?: string;\n /** Tool description shown to the model. */\n description?: string;\n};\n\nexport type GetContentsToolConfig = ContentsOptions & {\n /**\n * Tool name shown to the model. Defaults to `\"get_contents\"`. Set a custom\n * name to avoid collisions, or to register multiple differently-configured\n * contents tools.\n */\n name?: string;\n /** Tool description shown to the model. */\n description?: string;\n};\n\nexport type ToolNamespace = {\n webSearch(config?: WebSearchToolConfig): WebSearchTool;\n getContents(config?: GetContentsToolConfig): GetContentsTool;\n};\n\ntype SearchArgs = { query: string; objective?: string };\ntype GetContentsArgs = { urls: string[] };\ntype FormattableResult = {\n title?: string | null;\n url?: string;\n publishedDate?: string;\n author?: string;\n highlights?: string[];\n text?: string;\n summary?: string;\n};\n\nexport type WebSearchTool = ExaToolSpec<\n SearchArgs,\n SearchResponse<ContentsOptions>\n>;\n\nexport type GetContentsTool = ExaToolSpec<\n GetContentsArgs,\n SearchResponse<ContentsOptions>\n>;\n\nexport const DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION =\n \"Search the web for up-to-date, relevant information. Describe the ideal page rather than listing keywords.\";\n\nexport const DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION =\n \"Read the full contents of web pages you already have URLs for, such as pages returned by a search or mentioned by the user.\";\n\n/** Model-facing description of the `objective` search tool parameter. */\nexport const SEARCH_OBJECTIVE_TOOL_DESCRIPTION =\n \"Goal for this search turn; say which documents should rank first, which should be excluded, and what specific facts or figures to pull from them.\";\n\nconst MAX_OBJECTIVE_LENGTH = 4096;\n\nfunction formatResults(\n response: SearchResponse<ContentsOptions>,\n emptyMessage: string\n): string {\n const formatted = (response.results as FormattableResult[])\n .map((result) => {\n const lines = [\n `Title: ${result.title || \"N/A\"}`,\n `URL: ${result.url || \"N/A\"}`,\n `Published: ${result.publishedDate || \"N/A\"}`,\n `Author: ${result.author || \"N/A\"}`,\n ];\n if (result.summary) {\n lines.push(`Summary: ${result.summary}`);\n }\n if (result.highlights && result.highlights.length > 0) {\n lines.push(`Highlights:\\n${result.highlights.join(\"\\n\")}`);\n } else if (result.text) {\n lines.push(`Text: ${result.text}`);\n }\n return lines.join(\"\\n\");\n })\n .join(\"\\n\\n---\\n\\n\");\n return formatted || emptyMessage;\n}\n\n/** One `Note: <message>` line per notice on a search response. */\nfunction formatSearchNotices(\n response: SearchResponse<ContentsOptions>\n): string[] {\n return (response.notices ?? [])\n .filter((notice) => typeof notice?.message === \"string\")\n .map((notice) => `Note: ${notice.message}`);\n}\n\nfunction formatSearchResponse(\n response: SearchResponse<ContentsOptions>\n): string {\n const text = formatResults(response, \"No search results found.\");\n const notes = formatSearchNotices(response);\n return notes.length === 0 ? text : `${notes.join(\"\\n\")}\\n\\n${text}`;\n}\n\nfunction formatContentsResponse(\n response: SearchResponse<ContentsOptions>\n): string {\n return formatResults(response, \"No contents found.\");\n}\n\nfunction registerTool<T extends ExaToolSpec>(\n registry: ToolRegistry,\n tool: T\n): T {\n registry.register(tool);\n return tool;\n}\n\nfunction createTool<TArgs, TResult>(\n registry: ToolRegistry,\n params: {\n name: string;\n description: string;\n inputSchema: z.ZodType<TArgs>;\n jsonSchema: ToolJsonSchema;\n execute(args: TArgs): Promise<TResult>;\n format(result: TResult): string;\n definition: ToolDefinition;\n }\n): ExaToolSpec<TArgs, TResult> {\n const tool: ExaToolSpec<TArgs, TResult> = {\n name: params.name,\n description: params.description,\n inputSchema: params.inputSchema,\n jsonSchema: params.jsonSchema,\n execute: params.execute,\n format: params.format,\n definition: params.definition,\n async run(args: unknown): Promise<string> {\n try {\n const parsed = params.inputSchema.parse(args);\n const result = await params.execute(parsed);\n return params.format(result);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n return `Error: ${message}`;\n }\n },\n };\n return registerTool(registry, tool);\n}\n\n/**\n * Optional when parsing, but listed in the JSON schema's `required` so models\n * fill it in on every call. `zod-to-json-schema` decides `required` from\n * `isOptional()`.\n */\nclass AdvertisedRequiredOptional<\n T extends z.ZodTypeAny,\n> extends z.ZodOptional<T> {\n isOptional(): boolean {\n return false;\n }\n}\n\nfunction advertisedRequired<T extends z.ZodTypeAny>(\n inner: T\n): AdvertisedRequiredOptional<T> {\n return new AdvertisedRequiredOptional({\n innerType: inner,\n typeName: z.ZodFirstPartyTypeKind.ZodOptional,\n });\n}\n\n/** Create a `web_search` tool. Defaults to `type: \"auto\"` and highlights. */\nexport function createWebSearchTool(\n exa: Exa,\n registry: ToolRegistry,\n config: WebSearchToolConfig = {}\n): WebSearchTool {\n const {\n name = \"web_search\",\n description = DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION,\n ...searchOptions\n } = config;\n const inputSchema = z.object({\n query: z\n .string()\n .describe(\n \"Natural language search query. Should be a semantically rich description of the ideal page, not just keywords.\"\n ),\n // Length limits are validated but not advertised: strict tool use on some\n // providers rejects `minLength`/`maxLength` in the schema.\n objective: advertisedRequired(\n z\n .string()\n .trim()\n .refine((value) => value.length > 0, \"objective must not be empty\")\n .refine(\n (value) => value.length <= MAX_OBJECTIVE_LENGTH,\n `objective must be at most ${MAX_OBJECTIVE_LENGTH} characters`\n )\n ).describe(SEARCH_OBJECTIVE_TOOL_DESCRIPTION),\n });\n const jsonSchema = zodToJsonSchema(inputSchema) as ToolJsonSchema;\n delete jsonSchema.$schema;\n\n return createTool(registry, {\n name,\n description,\n inputSchema,\n jsonSchema,\n definition: {\n name,\n description,\n parameters: jsonSchema,\n },\n execute: ({ query, objective }) => {\n const options = {\n type: \"auto\",\n numResults: 10,\n contents: { highlights: true },\n ...searchOptions,\n ...(objective !== undefined && { objective }),\n } as RegularSearchOptions;\n return exa.search(query, options) as Promise<\n SearchResponse<ContentsOptions>\n >;\n },\n format: formatSearchResponse,\n }) as WebSearchTool;\n}\n\n/**\n * Create a `get_contents` tool that reads pages the model already has URLs for.\n * Inherits `exa.getContents` defaults, which return page text when no content\n * option is configured.\n */\nexport function createGetContentsTool(\n exa: Exa,\n registry: ToolRegistry,\n config: GetContentsToolConfig = {}\n): GetContentsTool {\n const {\n name = \"get_contents\",\n description = DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION,\n ...contentsOptions\n } = config;\n const inputSchema = z.object({\n urls: z\n .array(z.string())\n .describe(\n \"Absolute URLs of the pages to read, including the scheme. Pass several URLs to read them in a single call.\"\n ),\n });\n const jsonSchema = zodToJsonSchema(inputSchema) as ToolJsonSchema;\n delete jsonSchema.$schema;\n\n return createTool(registry, {\n name,\n description,\n inputSchema,\n jsonSchema,\n definition: {\n name,\n description,\n parameters: jsonSchema,\n },\n execute: ({ urls }) =>\n exa.getContents(urls, contentsOptions) as Promise<\n SearchResponse<ContentsOptions>\n >,\n format: formatContentsResponse,\n }) as GetContentsTool;\n}\n\nexport class ToolRegistry {\n private readonly registry = new Map<string, ExaToolSpec>();\n\n register(tool: ExaToolSpec): void {\n this.registry.set(tool.name, tool);\n }\n\n resolve(tools?: readonly ExaToolSpec[]): Map<string, ExaToolSpec> {\n return tools\n ? new Map(tools.map((tool) => [tool.name, tool]))\n : new Map(this.registry);\n }\n}\n\nexport function getTool(\n tools: Map<string, ExaToolSpec>,\n name: string\n): ExaToolSpec | undefined {\n return tools.get(name);\n}\n\nexport function unknownToolError(name: string): string {\n return `Error: unknown tool \"${name}\"`;\n}\n","import type { Exa } from \"../index\";\nimport {\n createGetContentsTool,\n createWebSearchTool,\n type ExaToolSpec,\n type GetContentsToolConfig,\n type WebSearchToolConfig,\n ToolRegistry,\n getTool,\n unknownToolError,\n} from \"./core\";\nimport type { ToolDefinition } from \"./core\";\n\ntype AnthropicToolUse = {\n type: \"tool_use\";\n id: string;\n name: string;\n input: unknown;\n};\n\ntype AnthropicMessage = {\n content?: readonly unknown[] | null;\n};\n\nexport type AnthropicToolResult = {\n type: \"tool_result\";\n tool_use_id: string;\n content: string;\n};\n\ntype AnthropicRunnable = ExaToolSpec & {\n type: \"custom\";\n name: string;\n description: string;\n input_schema: ExaToolSpec[\"jsonSchema\"];\n parse: (input: unknown) => unknown;\n run: (args: unknown) => Promise<string>;\n definition: ToolDefinition & {\n input_schema: ExaToolSpec[\"jsonSchema\"];\n };\n};\n\nexport class AnthropicTools {\n constructor(\n private readonly exa: Exa,\n private readonly registry: ToolRegistry\n ) {}\n\n /** Anthropic `web_search` tool. Defaults to `auto` + highlights. */\n webSearch(config?: WebSearchToolConfig) {\n return runnable(createWebSearchTool(this.exa, this.registry, config));\n }\n\n /** Anthropic `get_contents` tool for reading pages by URL. */\n getContents(config?: GetContentsToolConfig) {\n return runnable(createGetContentsTool(this.exa, this.registry, config));\n }\n\n /**\n * Run the `tool_use` blocks in an assistant message and return the matching\n * `tool_result` blocks. Every `tool_use` block is answered so the follow-up\n * request never omits a required result: a block whose name doesn't match a\n * known tool gets an `Error: unknown tool \"<name>\"` result. When handling\n * some tools yourself, replace those error results with your own before\n * sending the next request.\n */\n async handleToolUse(\n message: AnthropicMessage,\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<AnthropicToolResult[]> {\n const tools = this.registry.resolve(options?.tools);\n const blocks = (message.content ?? []).filter(isAnthropicToolUse);\n return Promise.all(\n blocks.map(async (block) => {\n const tool = getTool(tools, block.name);\n return {\n type: \"tool_result\" as const,\n tool_use_id: block.id,\n content: tool\n ? await tool.run(block.input)\n : unknownToolError(block.name),\n };\n })\n );\n }\n}\n\nfunction isAnthropicToolUse(value: unknown): value is AnthropicToolUse {\n if (!value || typeof value !== \"object\") return false;\n const block = value as Partial<AnthropicToolUse>;\n return (\n block.type === \"tool_use\" &&\n typeof block.id === \"string\" &&\n typeof block.name === \"string\"\n );\n}\n\nfunction runnable(tool: ExaToolSpec): AnthropicRunnable {\n const definition = {\n type: \"custom\" as const,\n name: tool.name,\n description: tool.description,\n input_schema: tool.jsonSchema,\n parse: (input: unknown) => tool.inputSchema.parse(input),\n run: (args: unknown) => tool.run(args),\n };\n Object.defineProperties(definition, {\n parse: { enumerable: false },\n run: { enumerable: false },\n });\n Object.defineProperties(\n definition,\n Object.fromEntries(\n Object.entries(tool)\n .filter(([key]) => ![\"name\", \"description\"].includes(key))\n .map(([key, value]) => [\n key,\n { value, enumerable: false, configurable: true },\n ])\n )\n );\n Object.defineProperty(definition, \"type\", {\n value: \"custom\",\n enumerable: false,\n configurable: true,\n });\n Object.defineProperty(definition, \"definition\", {\n value: {\n name: tool.name,\n description: tool.description,\n input_schema: tool.jsonSchema,\n },\n enumerable: false,\n });\n return definition as AnthropicRunnable;\n}\n","import type { Exa } from \"../index\";\nimport {\n createGetContentsTool,\n createWebSearchTool,\n type ExaToolSpec,\n type GetContentsToolConfig,\n type WebSearchToolConfig,\n type ToolDefinition,\n type ToolJsonSchema,\n ToolRegistry,\n getTool,\n unknownToolError,\n} from \"./core\";\n\ntype OpenAIToolCall = {\n id: string;\n function: { name: string; arguments: string };\n};\n\ntype OpenAIAssistantMessage = {\n tool_calls?: readonly unknown[] | null;\n};\n\nexport type OpenAIToolMessage = {\n role: \"tool\";\n tool_call_id: string;\n content: string;\n};\n\ntype ResponsesFunctionCall = {\n type: \"function_call\";\n call_id: string;\n name: string;\n arguments: string;\n};\n\ntype ResponsesOutput = {\n output?: readonly unknown[];\n};\n\nexport type ResponsesFunctionCallOutput = {\n type: \"function_call_output\";\n call_id: string;\n output: string;\n};\n\ntype OpenAIChatDefinition = {\n type: \"function\";\n function: {\n name: string;\n description: string;\n parameters: any;\n };\n};\n\ntype OpenAIRunnable = ExaToolSpec & {\n type: \"function\";\n function: {\n name: string;\n description: string;\n parameters: any;\n parse: (input: string) => any;\n function: (args: any, runner?: unknown) => Promise<string>;\n };\n definition: OpenAIChatDefinition;\n};\n\ntype OpenAIResponsesRunnable = ExaToolSpec & {\n type: \"function\";\n name: string;\n description: string;\n parameters: any;\n strict: false;\n definition: ToolDefinition & {\n type: \"function\";\n parameters: ToolJsonSchema;\n strict: false;\n };\n};\n\nfunction runnable(tool: ExaToolSpec): OpenAIRunnable {\n const functionDefinition = {\n ...tool.definition,\n parse: (input: string) => JSON.parse(input),\n function: (args: any) => tool.run(args),\n };\n Object.defineProperties(functionDefinition, {\n parse: { enumerable: false },\n function: { enumerable: false },\n });\n const definition = {\n type: \"function\" as const,\n function: functionDefinition,\n };\n Object.defineProperties(\n definition,\n Object.fromEntries(\n Object.entries(tool)\n .filter(([key]) => ![\"name\", \"description\"].includes(key))\n .map(([key, value]) => [\n key,\n { value, enumerable: false, configurable: true },\n ])\n )\n );\n Object.defineProperties(definition, {\n name: {\n value: tool.name,\n enumerable: false,\n configurable: true,\n },\n description: {\n value: tool.description,\n enumerable: false,\n configurable: true,\n },\n });\n Object.defineProperty(definition, \"definition\", {\n value: {\n type: \"function\",\n function: {\n name: tool.name,\n description: tool.description,\n parameters: tool.jsonSchema,\n },\n } satisfies OpenAIChatDefinition,\n enumerable: false,\n configurable: true,\n });\n return definition as OpenAIRunnable;\n}\n\nexport class OpenAIResponsesTools {\n constructor(\n private readonly exa: Exa,\n private readonly registry: ToolRegistry,\n private readonly handleResponses: (\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ) => Promise<ResponsesFunctionCallOutput[]>\n ) {}\n\n /** Responses API `web_search` tool. Defaults to `auto` + highlights. */\n webSearch(config?: WebSearchToolConfig) {\n return responsesRunnable(\n createWebSearchTool(this.exa, this.registry, config)\n );\n }\n\n /** Responses API `get_contents` tool for reading pages by URL. */\n getContents(config?: GetContentsToolConfig) {\n return responsesRunnable(\n createGetContentsTool(this.exa, this.registry, config)\n );\n }\n\n /**\n * Run the function calls in a Responses API response (or output item array)\n * and return `function_call_output` items. Every function call is answered\n * so the follow-up request never omits a required output: a call whose name\n * doesn't match a known tool gets an `Error: unknown tool \"<name>\"` output.\n * When handling some tools yourself, replace those error outputs with your\n * own results before sending the next request.\n */\n async handleToolCalls(\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<ResponsesFunctionCallOutput[]> {\n return this.handleResponses(responseOrOutputItems, options);\n }\n}\n\nfunction responsesRunnable(tool: ExaToolSpec): OpenAIResponsesRunnable {\n const definition = {\n type: \"function\" as const,\n name: tool.name,\n description: tool.description,\n parameters: tool.jsonSchema,\n strict: false,\n };\n Object.defineProperties(\n definition,\n Object.fromEntries(\n Object.entries(tool)\n .filter(([key]) => ![\"name\", \"description\"].includes(key))\n .map(([key, value]) => [\n key,\n { value, enumerable: false, configurable: true },\n ])\n )\n );\n Object.defineProperty(definition, \"definition\", {\n value: {\n ...tool.definition,\n type: \"function\",\n parameters: tool.jsonSchema,\n strict: false,\n },\n enumerable: false,\n });\n return definition as OpenAIResponsesRunnable;\n}\n\nexport class OpenAITools {\n readonly responses: OpenAIResponsesTools;\n\n constructor(\n private readonly exa: Exa,\n private readonly registry: ToolRegistry\n ) {\n this.responses = new OpenAIResponsesTools(\n exa,\n registry,\n (responseOrOutputItems, options) =>\n this.handleResponsesToolCalls(responseOrOutputItems, options)\n );\n }\n\n /** Chat Completions `web_search` tool. Defaults to `auto` + highlights. */\n webSearch(config?: WebSearchToolConfig) {\n return runnable(createWebSearchTool(this.exa, this.registry, config));\n }\n\n /** Chat Completions `get_contents` tool for reading pages by URL. */\n getContents(config?: GetContentsToolConfig) {\n return runnable(createGetContentsTool(this.exa, this.registry, config));\n }\n\n /**\n * Run the tool calls in a Chat Completions assistant message and return the\n * matching `role: \"tool\"` messages. Every tool call is answered so the\n * follow-up request never omits a required tool response: a call whose name\n * doesn't match a known tool gets an `Error: unknown tool \"<name>\"` output.\n * When handling some tools yourself, replace those error outputs with your\n * own results before sending the next request.\n */\n handleToolCalls(\n assistantMessage: OpenAIAssistantMessage,\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<OpenAIToolMessage[]>;\n /**\n * Run the function calls in a Responses API response (or output item array)\n * and return `function_call_output` items, answering calls whose name\n * doesn't match a known tool with `Error: unknown tool \"<name>\"` outputs.\n */\n handleToolCalls(\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<ResponsesFunctionCallOutput[]>;\n async handleToolCalls(\n assistantMessage:\n | OpenAIAssistantMessage\n | ResponsesOutput\n | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<(OpenAIToolMessage | ResponsesFunctionCallOutput)[]> {\n if (isResponsesInput(assistantMessage)) {\n return this.handleResponsesToolCalls(assistantMessage, options);\n }\n return this.handleChatToolCalls(assistantMessage, options);\n }\n\n private async handleChatToolCalls(\n assistantMessage: OpenAIAssistantMessage,\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<OpenAIToolMessage[]> {\n const tools = this.registry.resolve(options?.tools);\n const calls = (assistantMessage.tool_calls ?? []).filter(isOpenAIToolCall);\n return Promise.all(\n calls.map(async (call) => {\n const tool = getTool(tools, call.function.name);\n return {\n role: \"tool\" as const,\n tool_call_id: call.id,\n content: tool\n ? await tool.run(parseArguments(call.function.arguments))\n : unknownToolError(call.function.name),\n };\n })\n );\n }\n\n private async handleResponsesToolCalls(\n responseOrOutputItems: ResponsesOutput | readonly unknown[],\n options?: { tools?: readonly ExaToolSpec[] }\n ): Promise<ResponsesFunctionCallOutput[]> {\n const tools = this.registry.resolve(options?.tools);\n const rawItems: readonly unknown[] =\n !Array.isArray(responseOrOutputItems) && \"output\" in responseOrOutputItems\n ? (responseOrOutputItems.output ?? [])\n : (responseOrOutputItems as readonly unknown[]);\n const items = rawItems.filter(isResponsesFunctionCall);\n return Promise.all(\n items.map(async (call) => {\n const tool = getTool(tools, call.name);\n return {\n type: \"function_call_output\" as const,\n call_id: call.call_id,\n output: tool\n ? await tool.run(parseArguments(call.arguments))\n : unknownToolError(call.name),\n };\n })\n );\n }\n}\n\nfunction parseArguments(argumentsText: string): unknown {\n try {\n return JSON.parse(argumentsText);\n } catch {\n return argumentsText;\n }\n}\n\nfunction isOpenAIToolCall(value: unknown): value is OpenAIToolCall {\n if (!value || typeof value !== \"object\") return false;\n const call = value as Partial<OpenAIToolCall>;\n return (\n typeof call.id === \"string\" &&\n !!call.function &&\n typeof call.function.name === \"string\" &&\n typeof call.function.arguments === \"string\"\n );\n}\n\nfunction isResponsesFunctionCall(\n value: unknown\n): value is ResponsesFunctionCall {\n if (!value || typeof value !== \"object\") return false;\n const call = value as Partial<ResponsesFunctionCall>;\n return (\n call.type === \"function_call\" &&\n typeof call.call_id === \"string\" &&\n typeof call.name === \"string\" &&\n typeof call.arguments === \"string\"\n );\n}\n\nfunction isResponsesInput(\n value: OpenAIAssistantMessage | ResponsesOutput | readonly unknown[]\n): value is ResponsesOutput | readonly unknown[] {\n if (Array.isArray(value)) return value.some(isResponsesFunctionCall);\n return \"output\" in value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA+B;;;ACA/B;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,eAAiB;AAAA,IACf,QAAU;AAAA,EACZ;AAAA,EACA,OAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,EACR,QAAU;AAAA,EACV,SAAW;AAAA,IACT,KAAK;AAAA,MACH,OAAS;AAAA,MACT,SAAW;AAAA,MACX,QA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AAI,CAAC,KAAK,WAAW,QAAQ,EAAG;AAChC,gBAAM,UAAU,KAAK,QAAQ,aAAa,EAAE,EAAE,KAAK;AACnD,cAAI,CAAC,WAAW,YAAY,SAAU;AAEtC,cAAI;AACJ,cAAI;AACF,oBAAQ,KAAK,MAAM,OAAO;AAAA,UAC5B,QAAQ;AACN;AAAA,UACF;AAEA,cAAI,MAAM,QAAQ,WAAY,QAAO,MAAM;AAC3C,cAAI,MAAM,QAAQ,SAAS;AACzB,kBAAM,IAAI;AAAA,cACR,MAAM,OAAO,WAAW;AAAA;AAAA,eAExB,oBAAI,KAAK,GAAE,YAAY;AAAA,YACzB;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAEA,YAAM,IAAI;AAAA,QACR;AAAA;AAAA,SAEA,oBAAI,KAAK,GAAE,YAAY;AAAA,MACzB;AAAA,IACF,UAAE;AAEA,UAAI;AACF,cAAM,OAAO,OAAO;AAAA,MACtB,QAAQ;AAAA,MAER;AACA,aAAO,YAAY;AAAA,IACrB;AAAA,EACF;AACF;AAaA,IAAO,gBAAQD;","names":["Exa","HttpStatusCode","message","convertZodToJsonSchema","settle","CreateEnrichmentParametersFormat","CreateImportParametersFormat","WebsetImportSource","EventType","ImportFailedReason","ImportFormat","ImportObject","ImportStatus","MonitorObject","MonitorStatus","MonitorRunObject","MonitorRunStatus","MonitorRunType","UpdateMonitorStatus","WebhookStatus","WebsetStatus","WebsetEnrichmentStatus","WebsetEnrichmentFormat","WebsetItemSource","WebsetItemEvaluationSatisfied","WebsetExcludeSource","WebsetSearchScopeSource","WebsetSearchStatus","WebsetSearchBehavior","WebsetSearchCanceledReason","import_zod","runnable","fetch","Exa","options"]}
|