Comparing version 1.0.6 to 1.0.7
@@ -0,1 +1,15 @@ | ||
/** | ||
* Search options for performing a search query. | ||
* @typedef {Object} SearchOptions | ||
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans. | ||
* @property {string[]} [includeDomains] - List of domains to include in the search. | ||
* @property {string[]} [excludeDomains] - List of domains to exclude in the search. | ||
* @property {string} [startCrawlDate] - Start date for results based on crawl date. | ||
* @property {string} [endCrawlDate] - End date for results based on crawl date. | ||
* @property {string} [startPublishedDate] - Start date for results based on published date. | ||
* @property {string} [endPublishedDate] - End date for results based on published date. | ||
* @property {boolean} [useAutoprompt] - If true, converts query to a Metaphor query. | ||
* @property {string} [type] - Type of search, 'keyword' or 'neural'. | ||
* @property {string} [category] - A data category to focus on, with higher comprehensivity and data cleanliness. Currently, the only category is company. | ||
*/ | ||
type BaseSearchOptions = { | ||
@@ -11,2 +25,7 @@ numResults?: number; | ||
}; | ||
/** | ||
* Search options for performing a search query. | ||
* @typedef {Object} ContentsOptions | ||
* @property {string[]} [formats] - An array of format types asked for. Currently supports `extract` (first 1000 tokens) and `text` (full parsed HTML text). If this isn't specified, defaults to `extract`. | ||
*/ | ||
type RegularSearchOptions = BaseSearchOptions & { | ||
@@ -16,5 +35,23 @@ useAutoprompt?: boolean; | ||
}; | ||
/** | ||
* Options for finding similar links. | ||
* @typedef {Object} FindSimilarOptions | ||
* @property {number} [numResults] - Number of search results to return. Default 10. Max 10 for basic plans. | ||
* @property {string[]} [includeDomains] - List of domains to include in the search. | ||
* @property {string[]} [excludeDomains] - List of domains to exclude from the search. | ||
* @property {string} [startCrawlDate] - Start date for results based on crawl date. | ||
* @property {string} [endCrawlDate] - End date for results based on crawl date. | ||
* @property {string} [startPublishedDate] - Start date for results based on published date. | ||
* @property {string} [endPublishedDate] - End date for results based on published date. | ||
* @property {boolean} [excludeSourceDomain] - If true, excludes links from the base domain of the input. | ||
* @property {string} [category] - A data category to focus on, with higher comprehensivity and data cleanliness. Currently, the only category is company. | ||
*/ | ||
type FindSimilarOptions = BaseSearchOptions & { | ||
excludeSourceDomain?: boolean; | ||
}; | ||
/** | ||
* Search options for performing a search query. | ||
* @typedef {Object} ContentsOptions | ||
* @property {string[]} [formats] - An array of format types asked for. Currently supports `extract` (first 1000 tokens) and `text` (full parsed HTML text). If this isn't specified, defaults to `extract`. | ||
*/ | ||
type ContentsOptions = { | ||
@@ -41,2 +78,12 @@ text?: TextContentsOptions | boolean; | ||
type ContentsResultComponent<T extends ContentsOptions> = (T['text'] extends (object | true) ? TextResponse : {}) & (T['highlights'] extends (object | true) ? HighlightsResponse : {}); | ||
/** | ||
* Represents a search result object. | ||
* @typedef {Object} Result | ||
* @property {string} title - The title of the search result. | ||
* @property {string} url - The URL of the search result. | ||
* @property {string} [publishedDate] - The estimated creation date of the content. | ||
* @property {string} [author] - The author of the content, if available. | ||
* @property {number} [score] - Similarity score between the query/url and the result. | ||
* @property {string} id - The temporary ID for the document. | ||
*/ | ||
type SearchResult<T extends ContentsOptions = {}> = { | ||
@@ -50,2 +97,8 @@ title: string | null; | ||
} & ContentsResultComponent<T>; | ||
/** | ||
* Represents a search response object. | ||
* @typedef {Object} SearchResponse | ||
* @property {Result[]} results - The list of search results. | ||
* @property {string} [autopromptString] - The autoprompt string, if applicable. | ||
*/ | ||
type SearchResponse<T extends ContentsOptions = {}> = { | ||
@@ -82,2 +135,8 @@ results: SearchResult<T>[]; | ||
search(query: string, options?: RegularSearchOptions): Promise<SearchResponse>; | ||
/** | ||
* Performs a search with a Exa prompt-engineered query and returns the contents of the documents. | ||
* @param {string} query - The query string. | ||
* @param {SearchOptions} [options] - Additional search options. | ||
* @returns {Promise<SearchResponse>} A list of relevant search results. | ||
*/ | ||
searchAndContents<T extends ContentsOptions>(query: string, options?: RegularSearchOptions & T): Promise<SearchResponse<T>>; | ||
@@ -91,2 +150,8 @@ /** | ||
findSimilar(url: string, options?: FindSimilarOptions): Promise<SearchResponse>; | ||
/** | ||
* Finds similar links to the provided URL and returns the contents of the documents. | ||
* @param {string} url - The URL for which to find similar links. | ||
* @param {FindSimilarOptions} [options] - Additional options for finding similar links. | ||
* @returns {Promise<SearchResponse>} A list of similar search results. | ||
*/ | ||
findSimilarAndContents<T extends ContentsOptions>(url: string, options?: FindSimilarOptions & T): Promise<SearchResponse<T>>; | ||
@@ -93,0 +158,0 @@ /** |
@@ -87,2 +87,8 @@ "use strict"; | ||
} | ||
/** | ||
* Performs a search with a Exa prompt-engineered query and returns the contents of the documents. | ||
* @param {string} query - The query string. | ||
* @param {SearchOptions} [options] - Additional search options. | ||
* @returns {Promise<SearchResponse>} A list of relevant search results. | ||
*/ | ||
async searchAndContents(query, options) { | ||
@@ -108,2 +114,8 @@ const { text, highlights, ...rest } = options || {}; | ||
} | ||
/** | ||
* Finds similar links to the provided URL and returns the contents of the documents. | ||
* @param {string} url - The URL for which to find similar links. | ||
* @param {FindSimilarOptions} [options] - Additional options for finding similar links. | ||
* @returns {Promise<SearchResponse>} A list of similar search results. | ||
*/ | ||
async findSimilarAndContents(url, options) { | ||
@@ -110,0 +122,0 @@ const { text, highlights, ...rest } = options || {}; |
{ | ||
"name": "exa-js", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Exa SDK for Node.js and the browser", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46084
430