exa-js 2.24.0 → 2.25.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 +8 -0
- package/dist/index.d.mts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.js +29 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -93,6 +93,14 @@ Deep search variants that also support `additionalQueries`:
|
|
|
93
93
|
- `deep`
|
|
94
94
|
- `deep-reasoning`
|
|
95
95
|
|
|
96
|
+
### Raw body fields
|
|
97
|
+
|
|
98
|
+
Pass `requestOptions.body` as the third argument for per-call search body overrides.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const result = await exa.search("AI research", undefined, { body: { futureField: true } });
|
|
102
|
+
```
|
|
103
|
+
|
|
96
104
|
## Contents
|
|
97
105
|
|
|
98
106
|
Get clean text, highlights, or summaries from any URL.
|
package/dist/index.d.mts
CHANGED
|
@@ -4303,6 +4303,10 @@ type ContentsOptions = {
|
|
|
4303
4303
|
subpageTarget?: string | string[];
|
|
4304
4304
|
extras?: ExtrasOptions;
|
|
4305
4305
|
};
|
|
4306
|
+
type RequestOptions = {
|
|
4307
|
+
/** Per-call body overrides, except stream. */
|
|
4308
|
+
body?: Record<string, unknown>;
|
|
4309
|
+
};
|
|
4306
4310
|
/**
|
|
4307
4311
|
* Options for performing a search query
|
|
4308
4312
|
* @typedef {Object} SearchOptions
|
|
@@ -4913,6 +4917,7 @@ declare class Exa {
|
|
|
4913
4917
|
* Helper method to separate out the contents-specific options from the rest.
|
|
4914
4918
|
*/
|
|
4915
4919
|
private extractContentsOptions;
|
|
4920
|
+
private mergeSearchRequestBody;
|
|
4916
4921
|
private buildSearchRequestBody;
|
|
4917
4922
|
/**
|
|
4918
4923
|
* Constructs the Exa API client.
|
|
@@ -4944,9 +4949,10 @@ declare class Exa {
|
|
|
4944
4949
|
* Omitting contents still returns text by default.
|
|
4945
4950
|
*
|
|
4946
4951
|
* @param {string} query - The query string.
|
|
4952
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4947
4953
|
* @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of relevant search results with text contents.
|
|
4948
4954
|
*/
|
|
4949
|
-
search(query: string): Promise<SearchResponse<{
|
|
4955
|
+
search(query: string, options?: undefined, requestOptions?: RequestOptions): Promise<SearchResponse<{
|
|
4950
4956
|
text: {
|
|
4951
4957
|
maxCharacters: 10_000;
|
|
4952
4958
|
};
|
|
@@ -4956,11 +4962,12 @@ declare class Exa {
|
|
|
4956
4962
|
*
|
|
4957
4963
|
* @param {string} query - The query string.
|
|
4958
4964
|
* @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled
|
|
4965
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4959
4966
|
* @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.
|
|
4960
4967
|
*/
|
|
4961
4968
|
search(query: string, options: RegularSearchOptions & BetaOptions & {
|
|
4962
4969
|
contents: false | null | undefined;
|
|
4963
|
-
}): Promise<SearchResponse<{}>>;
|
|
4970
|
+
}, requestOptions?: RequestOptions): Promise<SearchResponse<{}>>;
|
|
4964
4971
|
/**
|
|
4965
4972
|
* Performs a search with specific contents.
|
|
4966
4973
|
* Prefer `{ contents: { highlights: true } }` for query-relevant passages
|
|
@@ -4983,11 +4990,12 @@ declare class Exa {
|
|
|
4983
4990
|
*
|
|
4984
4991
|
* @param {string} query - The query string.
|
|
4985
4992
|
* @param {RegularSearchOptions & { contents: T }} options - Search options with specific contents
|
|
4993
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4986
4994
|
* @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.
|
|
4987
4995
|
*/
|
|
4988
4996
|
search<T extends ContentsOptions>(query: string, options: RegularSearchOptions & BetaOptions & {
|
|
4989
4997
|
contents: T;
|
|
4990
|
-
}): Promise<SearchResponse<T>>;
|
|
4998
|
+
}, requestOptions?: RequestOptions): Promise<SearchResponse<T>>;
|
|
4991
4999
|
/**
|
|
4992
5000
|
* Performs a search with an Exa prompt-engineered query.
|
|
4993
5001
|
* When no contents option is specified, returns text contents by default.
|
|
@@ -4996,9 +5004,10 @@ declare class Exa {
|
|
|
4996
5004
|
*
|
|
4997
5005
|
* @param {string} query - The query string.
|
|
4998
5006
|
* @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents
|
|
5007
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4999
5008
|
* @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
|
|
5000
5009
|
*/
|
|
5001
|
-
search(query: string, options: (Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">) & BetaOptions): Promise<SearchResponse<{
|
|
5010
|
+
search(query: string, options: (Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">) & BetaOptions, requestOptions?: RequestOptions): Promise<SearchResponse<{
|
|
5002
5011
|
text: true;
|
|
5003
5012
|
}>>;
|
|
5004
5013
|
/**
|
|
@@ -5006,10 +5015,11 @@ declare class Exa {
|
|
|
5006
5015
|
*
|
|
5007
5016
|
* Each iteration yields a chunk with partial text (`content`) or new citations.
|
|
5008
5017
|
* Use this if you'd like to read synthesized search output incrementally.
|
|
5018
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
5009
5019
|
*/
|
|
5010
5020
|
streamSearch(query: string, options?: RegularSearchOptions & {
|
|
5011
5021
|
contents?: ContentsOptions | false | null | undefined;
|
|
5012
|
-
}): AsyncGenerator<SearchStreamChunk>;
|
|
5022
|
+
}, requestOptions?: RequestOptions): AsyncGenerator<SearchStreamChunk>;
|
|
5013
5023
|
/**
|
|
5014
5024
|
* DEPRECATED: Use `search()` instead. This legacy wrapper will be removed in a future version.
|
|
5015
5025
|
* @deprecated Use `search()` instead. The search method now returns text contents by default.
|
|
@@ -5023,9 +5033,10 @@ declare class Exa {
|
|
|
5023
5033
|
*
|
|
5024
5034
|
* @param {string} query - The query string.
|
|
5025
5035
|
* @param {RegularSearchOptions & T} [options] - Additional search + contents options
|
|
5036
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
5026
5037
|
* @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.
|
|
5027
5038
|
*/
|
|
5028
|
-
searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T): Promise<SearchResponse<T>>;
|
|
5039
|
+
searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T, requestOptions?: RequestOptions): Promise<SearchResponse<T>>;
|
|
5029
5040
|
/**
|
|
5030
5041
|
* DEPRECATED: Use `search()` for new discovery flows. There is no direct replacement for URL-based similarity.
|
|
5031
5042
|
* @deprecated Use `search()` for new discovery flows. This legacy URL-similarity method will be removed in a future version.
|
|
@@ -5172,4 +5183,4 @@ declare class Exa {
|
|
|
5172
5183
|
private parseSSEStream;
|
|
5173
5184
|
}
|
|
5174
5185
|
|
|
5175
|
-
export { AGENT_BETA_HEADER, AGENT_MAX_EFFORT_BETA, AGENT_MONITORS_BETA_HEADER, type AddAgentMonitorEntitiesParams, AgentBetaClient, type AgentBetaOptions, type AgentBudget, AgentClient, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentDataSource, type AgentDataSourceProvider, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentMonitor, type AgentMonitorBacktest, type AgentMonitorBacktestContent, type AgentMonitorBacktestEntity, AgentMonitorBacktestFailedError, type AgentMonitorBacktestResult, type AgentMonitorBacktestStatus, type AgentMonitorBacktestWaitOptions, AgentMonitorBacktestsClient, type AgentMonitorChange, type AgentMonitorChangeEntity, type AgentMonitorChangeField, AgentMonitorChangesClient, type AgentMonitorCitation, type AgentMonitorContent, type AgentMonitorCreation, AgentMonitorEntitiesClient, type AgentMonitorEntity, type AgentMonitorEntityView, type AgentMonitorField, type AgentMonitorFieldMode, type AgentMonitorFieldValueType, type AgentMonitorRefresh, type AgentMonitorStatus, type AgentMonitorUsage, type AgentMonitorsBetaOptions, AgentMonitorsClient, type AgentOutput, type AgentRun, AgentRunCancelledError, AgentRunEventsClient, AgentRunFailedError, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AgentWaitOptions, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type AnthropicToolResult, AnthropicTools, type ArticleEntity, type BaseSearchOptions, BetaClient, type BetaOptions, type CompanyEntity, type ContentStatusError, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentMonitorBacktestParams, type CreateAgentMonitorEntityParams, type CreateAgentMonitorFieldParams, type CreateAgentMonitorOptions, type CreateAgentMonitorParams, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION, DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION, DYNAMIC_HIGHLIGHTS_BETA, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentMonitor, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExaErrorEnvelope, type ExaToolSpec, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetContentsTool, type GetContentsToolConfig, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentMonitorChangesParams, type ListAgentMonitorChangesResponse, type ListAgentMonitorEntitiesParams, type ListAgentMonitorEntitiesResponse, type ListAgentMonitorsParams, type ListAgentMonitorsResponse, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, OpenAIResponsesTools, type OpenAIToolMessage, OpenAITools, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type ResponsesFunctionCallOutput, SEARCH_OBJECTIVE_TOOL_DESCRIPTION, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type ToolDefinition, type ToolJsonSchema, type ToolNamespace, ToolRegistry, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type WebSearchTool, type WebSearchToolConfig, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, createGetContentsTool, createWebSearchTool, Exa as default };
|
|
5186
|
+
export { AGENT_BETA_HEADER, AGENT_MAX_EFFORT_BETA, AGENT_MONITORS_BETA_HEADER, type AddAgentMonitorEntitiesParams, AgentBetaClient, type AgentBetaOptions, type AgentBudget, AgentClient, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentDataSource, type AgentDataSourceProvider, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentMonitor, type AgentMonitorBacktest, type AgentMonitorBacktestContent, type AgentMonitorBacktestEntity, AgentMonitorBacktestFailedError, type AgentMonitorBacktestResult, type AgentMonitorBacktestStatus, type AgentMonitorBacktestWaitOptions, AgentMonitorBacktestsClient, type AgentMonitorChange, type AgentMonitorChangeEntity, type AgentMonitorChangeField, AgentMonitorChangesClient, type AgentMonitorCitation, type AgentMonitorContent, type AgentMonitorCreation, AgentMonitorEntitiesClient, type AgentMonitorEntity, type AgentMonitorEntityView, type AgentMonitorField, type AgentMonitorFieldMode, type AgentMonitorFieldValueType, type AgentMonitorRefresh, type AgentMonitorStatus, type AgentMonitorUsage, type AgentMonitorsBetaOptions, AgentMonitorsClient, type AgentOutput, type AgentRun, AgentRunCancelledError, AgentRunEventsClient, AgentRunFailedError, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AgentWaitOptions, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type AnthropicToolResult, AnthropicTools, type ArticleEntity, type BaseSearchOptions, BetaClient, type BetaOptions, type CompanyEntity, type ContentStatusError, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentMonitorBacktestParams, type CreateAgentMonitorEntityParams, type CreateAgentMonitorFieldParams, type CreateAgentMonitorOptions, type CreateAgentMonitorParams, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION, DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION, DYNAMIC_HIGHLIGHTS_BETA, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentMonitor, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExaErrorEnvelope, type ExaToolSpec, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetContentsTool, type GetContentsToolConfig, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentMonitorChangesParams, type ListAgentMonitorChangesResponse, type ListAgentMonitorEntitiesParams, type ListAgentMonitorEntitiesResponse, type ListAgentMonitorsParams, type ListAgentMonitorsResponse, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, OpenAIResponsesTools, type OpenAIToolMessage, OpenAITools, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type RequestOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type ResponsesFunctionCallOutput, SEARCH_OBJECTIVE_TOOL_DESCRIPTION, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type ToolDefinition, type ToolJsonSchema, type ToolNamespace, ToolRegistry, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type WebSearchTool, type WebSearchToolConfig, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, createGetContentsTool, createWebSearchTool, Exa as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -4303,6 +4303,10 @@ type ContentsOptions = {
|
|
|
4303
4303
|
subpageTarget?: string | string[];
|
|
4304
4304
|
extras?: ExtrasOptions;
|
|
4305
4305
|
};
|
|
4306
|
+
type RequestOptions = {
|
|
4307
|
+
/** Per-call body overrides, except stream. */
|
|
4308
|
+
body?: Record<string, unknown>;
|
|
4309
|
+
};
|
|
4306
4310
|
/**
|
|
4307
4311
|
* Options for performing a search query
|
|
4308
4312
|
* @typedef {Object} SearchOptions
|
|
@@ -4913,6 +4917,7 @@ declare class Exa {
|
|
|
4913
4917
|
* Helper method to separate out the contents-specific options from the rest.
|
|
4914
4918
|
*/
|
|
4915
4919
|
private extractContentsOptions;
|
|
4920
|
+
private mergeSearchRequestBody;
|
|
4916
4921
|
private buildSearchRequestBody;
|
|
4917
4922
|
/**
|
|
4918
4923
|
* Constructs the Exa API client.
|
|
@@ -4944,9 +4949,10 @@ declare class Exa {
|
|
|
4944
4949
|
* Omitting contents still returns text by default.
|
|
4945
4950
|
*
|
|
4946
4951
|
* @param {string} query - The query string.
|
|
4952
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4947
4953
|
* @returns {Promise<SearchResponse<{ text: { maxCharacters: 10_000 } }>>} A list of relevant search results with text contents.
|
|
4948
4954
|
*/
|
|
4949
|
-
search(query: string): Promise<SearchResponse<{
|
|
4955
|
+
search(query: string, options?: undefined, requestOptions?: RequestOptions): Promise<SearchResponse<{
|
|
4950
4956
|
text: {
|
|
4951
4957
|
maxCharacters: 10_000;
|
|
4952
4958
|
};
|
|
@@ -4956,11 +4962,12 @@ declare class Exa {
|
|
|
4956
4962
|
*
|
|
4957
4963
|
* @param {string} query - The query string.
|
|
4958
4964
|
* @param {RegularSearchOptions & { contents: false }} options - Search options with contents explicitly disabled
|
|
4965
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4959
4966
|
* @returns {Promise<SearchResponse<{}>>} A list of relevant search results without contents.
|
|
4960
4967
|
*/
|
|
4961
4968
|
search(query: string, options: RegularSearchOptions & BetaOptions & {
|
|
4962
4969
|
contents: false | null | undefined;
|
|
4963
|
-
}): Promise<SearchResponse<{}>>;
|
|
4970
|
+
}, requestOptions?: RequestOptions): Promise<SearchResponse<{}>>;
|
|
4964
4971
|
/**
|
|
4965
4972
|
* Performs a search with specific contents.
|
|
4966
4973
|
* Prefer `{ contents: { highlights: true } }` for query-relevant passages
|
|
@@ -4983,11 +4990,12 @@ declare class Exa {
|
|
|
4983
4990
|
*
|
|
4984
4991
|
* @param {string} query - The query string.
|
|
4985
4992
|
* @param {RegularSearchOptions & { contents: T }} options - Search options with specific contents
|
|
4993
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4986
4994
|
* @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.
|
|
4987
4995
|
*/
|
|
4988
4996
|
search<T extends ContentsOptions>(query: string, options: RegularSearchOptions & BetaOptions & {
|
|
4989
4997
|
contents: T;
|
|
4990
|
-
}): Promise<SearchResponse<T>>;
|
|
4998
|
+
}, requestOptions?: RequestOptions): Promise<SearchResponse<T>>;
|
|
4991
4999
|
/**
|
|
4992
5000
|
* Performs a search with an Exa prompt-engineered query.
|
|
4993
5001
|
* When no contents option is specified, returns text contents by default.
|
|
@@ -4996,9 +5004,10 @@ declare class Exa {
|
|
|
4996
5004
|
*
|
|
4997
5005
|
* @param {string} query - The query string.
|
|
4998
5006
|
* @param {Omit<DeepSearchOptions, 'contents'> | Omit<NonDeepSearchOptions, 'contents'>} options - Search options without contents
|
|
5007
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
4999
5008
|
* @returns {Promise<SearchResponse<{ text: true }>>} A list of relevant search results with text contents.
|
|
5000
5009
|
*/
|
|
5001
|
-
search(query: string, options: (Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">) & BetaOptions): Promise<SearchResponse<{
|
|
5010
|
+
search(query: string, options: (Omit<DeepSearchOptions, "contents"> | Omit<NonDeepSearchOptions, "contents">) & BetaOptions, requestOptions?: RequestOptions): Promise<SearchResponse<{
|
|
5002
5011
|
text: true;
|
|
5003
5012
|
}>>;
|
|
5004
5013
|
/**
|
|
@@ -5006,10 +5015,11 @@ declare class Exa {
|
|
|
5006
5015
|
*
|
|
5007
5016
|
* Each iteration yields a chunk with partial text (`content`) or new citations.
|
|
5008
5017
|
* Use this if you'd like to read synthesized search output incrementally.
|
|
5018
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
5009
5019
|
*/
|
|
5010
5020
|
streamSearch(query: string, options?: RegularSearchOptions & {
|
|
5011
5021
|
contents?: ContentsOptions | false | null | undefined;
|
|
5012
|
-
}): AsyncGenerator<SearchStreamChunk>;
|
|
5022
|
+
}, requestOptions?: RequestOptions): AsyncGenerator<SearchStreamChunk>;
|
|
5013
5023
|
/**
|
|
5014
5024
|
* DEPRECATED: Use `search()` instead. This legacy wrapper will be removed in a future version.
|
|
5015
5025
|
* @deprecated Use `search()` instead. The search method now returns text contents by default.
|
|
@@ -5023,9 +5033,10 @@ declare class Exa {
|
|
|
5023
5033
|
*
|
|
5024
5034
|
* @param {string} query - The query string.
|
|
5025
5035
|
* @param {RegularSearchOptions & T} [options] - Additional search + contents options
|
|
5036
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
5026
5037
|
* @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.
|
|
5027
5038
|
*/
|
|
5028
|
-
searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T): Promise<SearchResponse<T>>;
|
|
5039
|
+
searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T, requestOptions?: RequestOptions): Promise<SearchResponse<T>>;
|
|
5029
5040
|
/**
|
|
5030
5041
|
* DEPRECATED: Use `search()` for new discovery flows. There is no direct replacement for URL-based similarity.
|
|
5031
5042
|
* @deprecated Use `search()` for new discovery flows. This legacy URL-similarity method will be removed in a future version.
|
|
@@ -5172,4 +5183,4 @@ declare class Exa {
|
|
|
5172
5183
|
private parseSSEStream;
|
|
5173
5184
|
}
|
|
5174
5185
|
|
|
5175
|
-
export { AGENT_BETA_HEADER, AGENT_MAX_EFFORT_BETA, AGENT_MONITORS_BETA_HEADER, type AddAgentMonitorEntitiesParams, AgentBetaClient, type AgentBetaOptions, type AgentBudget, AgentClient, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentDataSource, type AgentDataSourceProvider, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentMonitor, type AgentMonitorBacktest, type AgentMonitorBacktestContent, type AgentMonitorBacktestEntity, AgentMonitorBacktestFailedError, type AgentMonitorBacktestResult, type AgentMonitorBacktestStatus, type AgentMonitorBacktestWaitOptions, AgentMonitorBacktestsClient, type AgentMonitorChange, type AgentMonitorChangeEntity, type AgentMonitorChangeField, AgentMonitorChangesClient, type AgentMonitorCitation, type AgentMonitorContent, type AgentMonitorCreation, AgentMonitorEntitiesClient, type AgentMonitorEntity, type AgentMonitorEntityView, type AgentMonitorField, type AgentMonitorFieldMode, type AgentMonitorFieldValueType, type AgentMonitorRefresh, type AgentMonitorStatus, type AgentMonitorUsage, type AgentMonitorsBetaOptions, AgentMonitorsClient, type AgentOutput, type AgentRun, AgentRunCancelledError, AgentRunEventsClient, AgentRunFailedError, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AgentWaitOptions, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type AnthropicToolResult, AnthropicTools, type ArticleEntity, type BaseSearchOptions, BetaClient, type BetaOptions, type CompanyEntity, type ContentStatusError, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentMonitorBacktestParams, type CreateAgentMonitorEntityParams, type CreateAgentMonitorFieldParams, type CreateAgentMonitorOptions, type CreateAgentMonitorParams, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION, DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION, DYNAMIC_HIGHLIGHTS_BETA, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentMonitor, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExaErrorEnvelope, type ExaToolSpec, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetContentsTool, type GetContentsToolConfig, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentMonitorChangesParams, type ListAgentMonitorChangesResponse, type ListAgentMonitorEntitiesParams, type ListAgentMonitorEntitiesResponse, type ListAgentMonitorsParams, type ListAgentMonitorsResponse, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, OpenAIResponsesTools, type OpenAIToolMessage, OpenAITools, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type ResponsesFunctionCallOutput, SEARCH_OBJECTIVE_TOOL_DESCRIPTION, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type ToolDefinition, type ToolJsonSchema, type ToolNamespace, ToolRegistry, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type WebSearchTool, type WebSearchToolConfig, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, createGetContentsTool, createWebSearchTool, Exa as default };
|
|
5186
|
+
export { AGENT_BETA_HEADER, AGENT_MAX_EFFORT_BETA, AGENT_MONITORS_BETA_HEADER, type AddAgentMonitorEntitiesParams, AgentBetaClient, type AgentBetaOptions, type AgentBudget, AgentClient, type AgentConfidence, type AgentCostDollars, type AgentCreateOptions, type AgentDataSource, type AgentDataSourceProvider, type AgentEffort, type AgentError, type AgentEvent, type AgentGroundingCitation, type AgentGroundingEntry, type AgentInput, type AgentMonitor, type AgentMonitorBacktest, type AgentMonitorBacktestContent, type AgentMonitorBacktestEntity, AgentMonitorBacktestFailedError, type AgentMonitorBacktestResult, type AgentMonitorBacktestStatus, type AgentMonitorBacktestWaitOptions, AgentMonitorBacktestsClient, type AgentMonitorChange, type AgentMonitorChangeEntity, type AgentMonitorChangeField, AgentMonitorChangesClient, type AgentMonitorCitation, type AgentMonitorContent, type AgentMonitorCreation, AgentMonitorEntitiesClient, type AgentMonitorEntity, type AgentMonitorEntityView, type AgentMonitorField, type AgentMonitorFieldMode, type AgentMonitorFieldValueType, type AgentMonitorRefresh, type AgentMonitorStatus, type AgentMonitorUsage, type AgentMonitorsBetaOptions, AgentMonitorsClient, type AgentOutput, type AgentRun, AgentRunCancelledError, AgentRunEventsClient, AgentRunFailedError, type AgentRunStatus, type AgentRunTyped, AgentRunsClient, type AgentStopReason, type AgentUsage, type AgentWaitOptions, type AnswerOptions, type AnswerOptionsTyped, type AnswerResponse, type AnswerResponseTyped, type AnswerStreamChunk, type AnswerStreamResponse, type AnthropicToolResult, AnthropicTools, type ArticleEntity, type BaseSearchOptions, BetaClient, type BetaOptions, type CompanyEntity, type ContentStatusError, type ContentsOptions, type ContentsResultComponent, type ContextOptions, type CostDollars, type CostDollarsContents, type CostDollarsSeearch, type CreateAgentMonitorBacktestParams, type CreateAgentMonitorEntityParams, type CreateAgentMonitorFieldParams, type CreateAgentMonitorOptions, type CreateAgentMonitorParams, type CreateAgentRunParams, type CreateAgentRunParamsTyped, type CreateCriterionParameters, type CreateEnrichmentParameters, CreateEnrichmentParametersFormat, type CreateImportParameters, CreateImportParametersFormat, type CreateImportResponse, type CreateImportWithCsvParameters, type CreateMonitorParameters, type CreateSearchMonitorParams, type CreateSearchMonitorResponse, type CreateWebhookParameters, type CreateWebsetParameters, type CreateWebsetSearchParameters, type CsvDataInput, type CustomEntity, DEFAULT_GET_CONTENTS_TOOL_DESCRIPTION, DEFAULT_WEB_SEARCH_TOOL_DESCRIPTION, DYNAMIC_HIGHLIGHTS_BETA, type DeepObjectOutputSchema, type DeepOutputSchema, type DeepSearchOutput, type DeepSearchOutputGrounding, type DeepSearchOutputGroundingCitation, type DeepSearchOutputGroundingConfidence, type DeepSearchType, type DeepTextOutputSchema, type Default, type DeletedAgentMonitor, type DeletedAgentRun, type EnrichmentResult, type Entity, type EntityCompanyProperties, type EntityCompanyPropertiesFinancials, type EntityCompanyPropertiesFundingRound, type EntityCompanyPropertiesHeadquarters, type EntityCompanyPropertiesWebTraffic, type EntityCompanyPropertiesWorkforce, type EntityDateRange, type EntityPersonProperties, type EntityPersonPropertiesCompanyRef, type EntityPersonPropertiesWorkHistoryEntry, type Event, EventType, EventsClient, Exa, ExaError, type ExaErrorEnvelope, type ExaToolSpec, type ExtrasOptions, type ExtrasResponse, type FindSimilarOptions, type GetContentsTool, type GetContentsToolConfig, type GetWebsetResponse, type GroundingCitation, type GroundingEntry, type HighlightsContentsOptions, type HighlightsResponse, HttpStatusCode, type Import, ImportFailedReason, ImportFormat, ImportObject, ImportStatus, ImportsClient, type JSONSchema, type ListAgentMonitorChangesParams, type ListAgentMonitorChangesResponse, type ListAgentMonitorEntitiesParams, type ListAgentMonitorEntitiesResponse, type ListAgentMonitorsParams, type ListAgentMonitorsResponse, type ListAgentRunEventsParams, type ListAgentRunEventsResponse, type ListAgentRunsParams, type ListAgentRunsResponse, type ListEventsResponse, type ListImportsResponse, type ListMonitorRunsResponse, type ListMonitorsOptions, type ListMonitorsResponse, type ListResearchRequest, type ListResearchResponse, type ListSearchMonitorRunsParams, type ListSearchMonitorRunsResponse, type ListSearchMonitorsParams, type ListSearchMonitorsResponse, type ListWebhookAttemptsResponse, type ListWebhooksResponse, type ListWebsetItemResponse, type ListWebsetItemsOptions, type ListWebsetsResponse, type LivecrawlOptions, type Monitor, type MonitorBehavior, type MonitorCadence, MonitorObject, type MonitorRun, MonitorRunObject, MonitorRunStatus, MonitorRunType, MonitorStatus, OpenAIResponsesTools, type OpenAIToolMessage, OpenAITools, type PersonEntity, type PreviewWebsetParameters, type PreviewWebsetResponse, type RegularSearchOptions, type RequestOptions, type Research, type ResearchCreateParamsTyped, type ResearchCreateRequest, type ResearchCreateResponse, type ResearchDefinitionEvent, type ResearchEvent, type ResearchOperation, type ResearchOutputEvent, type ResearchPaperEntity, type ResearchPlanDefinitionEvent, type ResearchPlanOperationEvent, type ResearchPlanOutputEvent, type ResearchStatus, type ResearchStreamEvent, type ResearchStreamEventTyped, type ResearchTaskDefinitionEvent, type ResearchTaskOperationEvent, type ResearchTaskOutputEvent, type ResearchTyped, type ResponsesFunctionCallOutput, SEARCH_OBJECTIVE_TOOL_DESCRIPTION, type SearchMonitor, type SearchMonitorRun, type SearchMonitorRunFailReason, type SearchMonitorRunOutput, type SearchMonitorRunStatus, SearchMonitorRunsClient, type SearchMonitorSearch, type SearchMonitorStatus, type SearchMonitorTrigger, type SearchMonitorWebhook, type SearchMonitorWebhookEvent, SearchMonitorsClient, type SearchResponse, type SearchResult, type SearchStreamChunk, type SectionTag, type Status, type SubpagesResponse, type SummaryContentsOptions, type SummaryContentsOptionsTyped, type SummaryResponse, type TextContentsOptions, type TextResponse, type ToolDefinition, type ToolJsonSchema, type ToolNamespace, ToolRegistry, type TriggerSearchMonitorResponse, type UpdateEnrichmentParameters, type UpdateImport, type UpdateMonitor, UpdateMonitorStatus, type UpdateSearchMonitorParams, type UpdateWebhookParameters, type UpdateWebsetRequest, type VerbosityOptions, type WaitUntilCompletedOptions, type WebSearchTool, type WebSearchToolConfig, type Webhook, type WebhookAttempt, WebhookStatus, type Webset, type WebsetEnrichment, WebsetEnrichmentFormat, WebsetEnrichmentStatus, WebsetEnrichmentsClient, WebsetExcludeSource, type WebsetHeadersLike, WebsetImportSource, type WebsetItem, type WebsetItemArticleProperties, type WebsetItemCompanyProperties, type WebsetItemCustomProperties, type WebsetItemEvaluation, WebsetItemEvaluationSatisfied, type WebsetItemPersonProperties, type WebsetItemResearchPaperProperties, WebsetItemSource, WebsetItemsClient, WebsetMonitorsClient, type WebsetSearch, WebsetSearchBehavior, WebsetSearchCanceledReason, WebsetSearchScopeSource, WebsetSearchStatus, WebsetSearchesClient, WebsetStatus, WebsetWebhooksClient, WebsetsClient, createGetContentsTool, createWebSearchTool, Exa as default };
|
package/dist/index.js
CHANGED
|
@@ -101,7 +101,7 @@ var import_cross_fetch = __toESM(require("cross-fetch"));
|
|
|
101
101
|
// package.json
|
|
102
102
|
var package_default = {
|
|
103
103
|
name: "exa-js",
|
|
104
|
-
version: "2.
|
|
104
|
+
version: "2.25.0",
|
|
105
105
|
description: "Exa SDK for Node.js and the browser",
|
|
106
106
|
publishConfig: {
|
|
107
107
|
access: "public"
|
|
@@ -2946,30 +2946,27 @@ var Exa2 = class {
|
|
|
2946
2946
|
if (livecrawlTimeout !== void 0)
|
|
2947
2947
|
contentsOptions.livecrawlTimeout = livecrawlTimeout;
|
|
2948
2948
|
if (maxAgeHours !== void 0) contentsOptions.maxAgeHours = maxAgeHours;
|
|
2949
|
-
if (snapshotAsOf !== void 0)
|
|
2950
|
-
contentsOptions.snapshotAsOf = snapshotAsOf;
|
|
2949
|
+
if (snapshotAsOf !== void 0) contentsOptions.snapshotAsOf = snapshotAsOf;
|
|
2951
2950
|
if (context !== void 0) contentsOptions.context = context;
|
|
2952
2951
|
return {
|
|
2953
2952
|
contentsOptions,
|
|
2954
2953
|
restOptions: rest
|
|
2955
2954
|
};
|
|
2956
2955
|
}
|
|
2957
|
-
|
|
2958
|
-
const
|
|
2959
|
-
delete
|
|
2960
|
-
|
|
2956
|
+
mergeSearchRequestBody(body, requestOptions) {
|
|
2957
|
+
const merged = { ...body, ...requestOptions?.body };
|
|
2958
|
+
delete merged.stream;
|
|
2959
|
+
return merged;
|
|
2960
|
+
}
|
|
2961
|
+
buildSearchRequestBody(query, options, requestOptions) {
|
|
2962
|
+
const body = { ...options ?? {} };
|
|
2963
|
+
delete body.betas;
|
|
2961
2964
|
if (options === void 0 || !("contents" in options)) {
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
contents: { text: { maxCharacters: DEFAULT_MAX_CHARACTERS } }
|
|
2966
|
-
};
|
|
2965
|
+
body.contents = { text: { maxCharacters: DEFAULT_MAX_CHARACTERS } };
|
|
2966
|
+
} else if (options.contents === false || options.contents === null || options.contents === void 0) {
|
|
2967
|
+
delete body.contents;
|
|
2967
2968
|
}
|
|
2968
|
-
|
|
2969
|
-
delete requestOptions.contents;
|
|
2970
|
-
return { query, ...requestOptions };
|
|
2971
|
-
}
|
|
2972
|
-
return { query, ...requestOptions };
|
|
2969
|
+
return this.mergeSearchRequestBody({ query, ...body }, requestOptions);
|
|
2973
2970
|
}
|
|
2974
2971
|
/**
|
|
2975
2972
|
* Makes a request to the Exa API.
|
|
@@ -3104,14 +3101,14 @@ var Exa2 = class {
|
|
|
3104
3101
|
});
|
|
3105
3102
|
return response;
|
|
3106
3103
|
}
|
|
3107
|
-
async search(query, options) {
|
|
3104
|
+
async search(query, options, requestOptions) {
|
|
3108
3105
|
if (options?.stream) {
|
|
3109
3106
|
throw new ExaError(
|
|
3110
3107
|
"For streaming responses, please use streamSearch() instead:\n\nfor await (const chunk of exa.streamSearch(query)) {\n // Handle chunks\n}",
|
|
3111
3108
|
400 /* BadRequest */
|
|
3112
3109
|
);
|
|
3113
3110
|
}
|
|
3114
|
-
const body = this.buildSearchRequestBody(query, options);
|
|
3111
|
+
const body = this.buildSearchRequestBody(query, options, requestOptions);
|
|
3115
3112
|
const betaHeaders = headersForBetas(options?.betas);
|
|
3116
3113
|
return betaHeaders ? await this.request("/search", "POST", body, void 0, betaHeaders) : await this.request("/search", "POST", body);
|
|
3117
3114
|
}
|
|
@@ -3120,10 +3117,11 @@ var Exa2 = class {
|
|
|
3120
3117
|
*
|
|
3121
3118
|
* Each iteration yields a chunk with partial text (`content`) or new citations.
|
|
3122
3119
|
* Use this if you'd like to read synthesized search output incrementally.
|
|
3120
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
3123
3121
|
*/
|
|
3124
|
-
streamSearch(query, options) {
|
|
3122
|
+
streamSearch(query, options, requestOptions) {
|
|
3125
3123
|
return this.streamChatCompletions("/search", {
|
|
3126
|
-
...this.buildSearchRequestBody(query, options),
|
|
3124
|
+
...this.buildSearchRequestBody(query, options, requestOptions),
|
|
3127
3125
|
stream: true
|
|
3128
3126
|
});
|
|
3129
3127
|
}
|
|
@@ -3140,20 +3138,24 @@ var Exa2 = class {
|
|
|
3140
3138
|
*
|
|
3141
3139
|
* @param {string} query - The query string.
|
|
3142
3140
|
* @param {RegularSearchOptions & T} [options] - Additional search + contents options
|
|
3141
|
+
* @param {RequestOptions} [requestOptions] - Per-call body overrides.
|
|
3143
3142
|
* @returns {Promise<SearchResponse<T>>} A list of relevant search results with requested contents.
|
|
3144
3143
|
*/
|
|
3145
|
-
async searchAndContents(query, options) {
|
|
3144
|
+
async searchAndContents(query, options, requestOptions) {
|
|
3146
3145
|
const { contentsOptions, restOptions } = options === void 0 ? {
|
|
3147
3146
|
contentsOptions: {
|
|
3148
3147
|
text: { maxCharacters: DEFAULT_MAX_CHARACTERS }
|
|
3149
3148
|
},
|
|
3150
3149
|
restOptions: {}
|
|
3151
3150
|
} : this.extractContentsOptions(options);
|
|
3152
|
-
return await this.request(
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3151
|
+
return await this.request(
|
|
3152
|
+
"/search",
|
|
3153
|
+
"POST",
|
|
3154
|
+
this.mergeSearchRequestBody(
|
|
3155
|
+
{ query, contents: contentsOptions, ...restOptions },
|
|
3156
|
+
requestOptions
|
|
3157
|
+
)
|
|
3158
|
+
);
|
|
3157
3159
|
}
|
|
3158
3160
|
async findSimilar(url, options) {
|
|
3159
3161
|
if (options === void 0 || !("contents" in options)) {
|