exa-js
Version:
Exa SDK for Node.js and the browser
1,154 lines (1,146 loc) • 141 kB
text/typescript
import { ZodSchema } from 'zod';
interface components$1 {
schemas: {
ListResearchResponseDto: {
/** @description Research requests ordered by creation time (newest first) */
data: components$1["schemas"]["ResearchDtoClass"][];
/** @description If true, use nextCursor to fetch more results */
hasMore: boolean;
/** @description Pass this value as the cursor parameter to fetch the next page */
nextCursor: string | null;
};
ResearchCreateRequestDtoClass: {
/** @description Instructions for what you would like research on. A good prompt clearly defines what information you want to find, how research should be conducted, and what the output should look like. */
instructions: string;
/**
* @description Research model to use. exa-research is faster and cheaper, while exa-research-pro provides more thorough analysis and stronger reasoning.
* @default exa-research
* @enum {string}
*/
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
/** @description JSON Schema to enforce structured output. When provided, the research output will be validated against this schema and returned as parsed JSON. */
outputSchema?: {
[key: string]: unknown;
};
};
ResearchDtoClass: {
/** @description When the research was created (Unix timestamp in milliseconds) */
createdAt: number;
/** @description The original research instructions provided */
instructions: string;
/**
* @description The model used for this research request
* @default exa-research
* @enum {string}
*/
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
/** @description The JSON Schema used to validate the output, if provided */
outputSchema?: {
[key: string]: unknown;
};
/** @description Unique identifier for tracking and retrieving this research request */
researchId: string;
/** @enum {string} */
status: "pending";
} | {
/** @description When the research was created (Unix timestamp in milliseconds) */
createdAt: number;
/** @description Real-time log of operations as research progresses. Poll this endpoint or use ?stream=true for live updates. */
events?: components$1["schemas"]["ResearchEventDtoClass"][];
/** @description The original research instructions provided */
instructions: string;
/**
* @description The model used for this research request
* @default exa-research
* @enum {string}
*/
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
/** @description The JSON Schema used to validate the output, if provided */
outputSchema?: {
[key: string]: unknown;
};
/** @description Unique identifier for tracking and retrieving this research request */
researchId: string;
/** @enum {string} */
status: "running";
} | {
/** @description Detailed cost breakdown for billing purposes */
costDollars: {
/** @description Count of web pages fully crawled and processed. Only pages that were read in detail are counted. */
numPages: number;
/** @description Count of web searches performed. Each search query counts as one search. */
numSearches: number;
/** @description Total AI tokens used for reasoning, planning, and generating the final output */
reasoningTokens: number;
/** @description Total cost in USD for this research request */
total: number;
};
/** @description When the research was created (Unix timestamp in milliseconds) */
createdAt: number;
/** @description Detailed log of all operations performed during research. Use ?events=true to include this field for debugging or monitoring progress. */
events?: components$1["schemas"]["ResearchEventDtoClass"][];
/** @description When the research completed (Unix timestamp in milliseconds) */
finishedAt: number;
/** @description The original research instructions provided */
instructions: string;
/**
* @description The model used for this research request
* @default exa-research
* @enum {string}
*/
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
/** @description The final research results, containing both raw text and parsed JSON if outputSchema was provided */
output: {
/** @description The complete research output as text. If outputSchema was provided, this is a JSON string. */
content: string;
/** @description Structured JSON object matching your outputSchema. Only present when outputSchema was provided and the output successfully validated. */
parsed?: {
[key: string]: unknown;
};
};
/** @description The JSON Schema used to validate the output, if provided */
outputSchema?: {
[key: string]: unknown;
};
/** @description Unique identifier for tracking and retrieving this research request */
researchId: string;
/** @enum {string} */
status: "completed";
} | {
/** @description When the research was created (Unix timestamp in milliseconds) */
createdAt: number;
/** @description Detailed log of all operations performed during research. Use ?events=true to include this field for debugging or monitoring progress. */
events?: components$1["schemas"]["ResearchEventDtoClass"][];
/** @description When the research was canceled (Unix timestamp in milliseconds) */
finishedAt: number;
/** @description The original research instructions provided */
instructions: string;
/**
* @description The model used for this research request
* @default exa-research
* @enum {string}
*/
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
/** @description The JSON Schema used to validate the output, if provided */
outputSchema?: {
[key: string]: unknown;
};
/** @description Unique identifier for tracking and retrieving this research request */
researchId: string;
/** @enum {string} */
status: "canceled";
} | {
/** @description When the research was created (Unix timestamp in milliseconds) */
createdAt: number;
/** @description Human-readable error message explaining what went wrong. */
error: string;
/** @description Detailed log of all operations performed during research. Use ?events=true to include this field for debugging or monitoring progress. */
events?: components$1["schemas"]["ResearchEventDtoClass"][];
/** @description When the research failed (Unix timestamp in milliseconds) */
finishedAt: number;
/** @description The original research instructions provided */
instructions: string;
/**
* @description The model used for this research request
* @default exa-research
* @enum {string}
*/
model: "exa-research-fast" | "exa-research" | "exa-research-pro";
/** @description The JSON Schema used to validate the output, if provided */
outputSchema?: {
[key: string]: unknown;
};
/** @description Unique identifier for tracking and retrieving this research request */
researchId: string;
/** @enum {string} */
status: "failed";
};
ResearchEventDtoClass: ({
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @enum {string} */
eventType: "research-definition";
/** @description The complete research instructions as provided */
instructions: string;
/** @description The JSON Schema that will validate the final output */
outputSchema?: {
[key: string]: unknown;
};
/** @description The research request this event belongs to */
researchId: string;
} | {
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @enum {string} */
eventType: "research-output";
/** @description The final research result, either successful with data or failed with error */
output: {
/** @description The complete research output as text. If outputSchema was provided, this is a JSON string. */
content: string;
costDollars: {
/** @description Count of web pages fully crawled and processed. Only pages that were read in detail are counted. */
numPages: number;
/** @description Count of web searches performed. Each search query counts as one search. */
numSearches: number;
/** @description Total AI tokens used for reasoning, planning, and generating the final output */
reasoningTokens: number;
/** @description Total cost in USD for this research request */
total: number;
};
/** @enum {string} */
outputType: "completed";
/** @description Structured JSON object matching your outputSchema. Only present when outputSchema was provided and the output successfully validated. */
parsed?: {
[key: string]: unknown;
};
} | {
/** @description Detailed error message explaining why the research failed */
error: string;
/** @enum {string} */
outputType: "failed";
};
/** @description The research request this event belongs to */
researchId: string;
}) | ({
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @enum {string} */
eventType: "plan-definition";
/** @description Identifier for this planning cycle */
planId: string;
/** @description The research request this event belongs to */
researchId: string;
} | {
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @description The actual operation performed (think, search, or crawl) */
data: {
/** @description The AI's reasoning process and decision-making steps */
content: string;
/** @enum {string} */
type: "think";
} | {
/** @description What the AI is trying to find with this search */
goal?: string;
/** @description Token cost for processing search result snippets */
pageTokens: number;
/** @description The exact search query sent to the search engine */
query: string;
/** @description URLs returned by the search, ranked by relevance */
results: {
url: string;
}[];
/**
* @description Search algorithm used (neural for semantic search, keyword for exact matches)
* @enum {string}
*/
searchType: "neural" | "keyword" | "auto" | "fast";
/** @enum {string} */
type: "search";
} | {
/** @description What information the AI expects to find on this page */
goal?: string;
/** @description Token cost for processing the full page content */
pageTokens: number;
/** @description The specific page that was crawled */
result: {
url: string;
};
/** @enum {string} */
type: "crawl";
};
/** @enum {string} */
eventType: "plan-operation";
/** @description Unique identifier for this specific operation */
operationId: string;
/** @description Which plan this operation belongs to */
planId: string;
/** @description The research request this event belongs to */
researchId: string;
} | {
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @enum {string} */
eventType: "plan-output";
/** @description The plan's decision: either generate tasks or stop researching */
output: {
/** @enum {string} */
outputType: "tasks";
/** @description Why these specific tasks were chosen */
reasoning: string;
/** @description List of task instructions that will be executed in parallel */
tasksInstructions: string[];
} | {
/** @enum {string} */
outputType: "stop";
/** @description Why the AI decided to stop researching */
reasoning: string;
};
/** @description Which plan is producing this output */
planId: string;
/** @description The research request this event belongs to */
researchId: string;
}) | ({
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @enum {string} */
eventType: "task-definition";
/** @description What this task should accomplish */
instructions: string;
/** @description The plan that generated this task */
planId: string;
/** @description The research request this event belongs to */
researchId: string;
/** @description Identifier for tracking this specific task */
taskId: string;
} | {
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @description The actual operation performed within this task */
data: {
/** @description The AI's reasoning process and decision-making steps */
content: string;
/** @enum {string} */
type: "think";
} | {
/** @description What the AI is trying to find with this search */
goal?: string;
/** @description Token cost for processing search result snippets */
pageTokens: number;
/** @description The exact search query sent to the search engine */
query: string;
/** @description URLs returned by the search, ranked by relevance */
results: {
url: string;
}[];
/**
* @description Search algorithm used (neural for semantic search, keyword for exact matches)
* @enum {string}
*/
searchType: "neural" | "keyword" | "auto" | "fast";
/** @enum {string} */
type: "search";
} | {
/** @description What information the AI expects to find on this page */
goal?: string;
/** @description Token cost for processing the full page content */
pageTokens: number;
/** @description The specific page that was crawled */
result: {
url: string;
};
/** @enum {string} */
type: "crawl";
};
/** @enum {string} */
eventType: "task-operation";
/** @description Unique identifier for this specific operation */
operationId: string;
/** @description The plan that owns this task */
planId: string;
/** @description The research request this event belongs to */
researchId: string;
/** @description Which task is performing this operation */
taskId: string;
} | {
/** @description When this event occurred (Unix timestamp in milliseconds) */
createdAt: number;
/** @enum {string} */
eventType: "task-output";
/** @description The successful completion result of this task */
output: {
/** @description The information gathered by this task */
content: string;
/** @enum {string} */
outputType: "completed";
};
/** @description The plan that owns this task */
planId: string;
/** @description The research request this event belongs to */
researchId: string;
/** @description Which task produced this output */
taskId: string;
});
ResearchOperationDtoClass: {
/** @description The AI's reasoning process and decision-making steps */
content: string;
/** @enum {string} */
type: "think";
} | {
/** @description What the AI is trying to find with this search */
goal?: string;
/** @description Token cost for processing search result snippets */
pageTokens: number;
/** @description The exact search query sent to the search engine */
query: string;
/** @description URLs returned by the search, ranked by relevance */
results: {
url: string;
}[];
/**
* @description Search algorithm used (neural for semantic search, keyword for exact matches)
* @enum {string}
*/
searchType: "neural" | "keyword" | "auto" | "fast";
/** @enum {string} */
type: "search";
} | {
/** @description What information the AI expects to find on this page */
goal?: string;
/** @description Token cost for processing the full page content */
pageTokens: number;
/** @description The specific page that was crawled */
result: {
url: string;
};
/** @enum {string} */
type: "crawl";
};
};
responses: never;
parameters: never;
requestBodies: never;
headers: never;
pathItems: never;
}
type Research = components$1["schemas"]["ResearchDtoClass"];
type ResearchStatus = Research["status"];
type ResearchEvent = components$1["schemas"]["ResearchEventDtoClass"];
type ResearchOperation = components$1["schemas"]["ResearchOperationDtoClass"];
type DeepReplaceParsed<T, TData> = T extends {
parsed?: Record<string, unknown>;
} ? Omit<T, "parsed"> & {
parsed: TData;
} : T extends object ? {
[K in keyof T]: DeepReplaceParsed<T[K], TData>;
} : T;
type ResearchTyped<T> = DeepReplaceParsed<Research, T>;
type ResearchStreamEventTyped<T> = DeepReplaceParsed<ResearchStreamEvent, T>;
type ListResearchRequest = {
cursor?: string;
limit?: number;
};
type ListResearchResponse = components$1["schemas"]["ListResearchResponseDto"];
type ResearchCreateRequest = components$1["schemas"]["ResearchCreateRequestDtoClass"];
type ResearchCreateResponse = Research;
type ResearchStreamEvent = ResearchEvent;
/**
* Enhanced research creation params with zod schema support
*/
type ResearchCreateParamsTyped<T> = {
instructions: string;
model?: ResearchCreateRequest["model"];
outputSchema?: T;
};
type ResearchDefinitionEvent = Extract<ResearchEvent, {
eventType: "research-definition";
}>;
type ResearchOutputEvent = Extract<ResearchEvent, {
eventType: "research-output";
}>;
type ResearchPlanDefinitionEvent = Extract<ResearchEvent, {
eventType: "plan-definition";
}>;
type ResearchPlanOperationEvent = Extract<ResearchEvent, {
eventType: "plan-operation";
}>;
type ResearchPlanOutputEvent = Extract<ResearchEvent, {
eventType: "plan-output";
}>;
type ResearchTaskDefinitionEvent = Extract<ResearchEvent, {
eventType: "task-definition";
}>;
type ResearchTaskOperationEvent = Extract<ResearchEvent, {
eventType: "task-operation";
}>;
type ResearchTaskOutputEvent = Extract<ResearchEvent, {
eventType: "task-output";
}>;
type QueryParams$1 = Record<string, string | number | boolean | string[] | undefined>;
interface RequestBody$1 {
[key: string]: unknown;
}
declare class ResearchBaseClient {
protected client: Exa;
constructor(client: Exa);
protected request<T = unknown>(endpoint: string, method?: string, data?: RequestBody$1, params?: QueryParams$1): Promise<T>;
protected rawRequest(endpoint: string, method?: string, data?: RequestBody$1, params?: QueryParams$1): Promise<Response>;
protected buildPaginationParams(pagination?: ListResearchRequest): QueryParams$1;
}
declare class ResearchClient extends ResearchBaseClient {
constructor(client: Exa);
create<T>(params: ResearchCreateParamsTyped<ZodSchema<T>>): Promise<ResearchCreateResponse>;
create(params: {
instructions: string;
model?: ResearchCreateRequest["model"];
outputSchema?: Record<string, unknown>;
}): Promise<ResearchCreateResponse>;
get(researchId: string): Promise<Research>;
get(researchId: string, options: {
stream?: false;
events?: boolean;
}): Promise<Research>;
get<T>(researchId: string, options: {
stream?: false;
events?: boolean;
outputSchema: ZodSchema<T>;
}): Promise<ResearchTyped<T>>;
get(researchId: string, options: {
stream: true;
events?: boolean;
}): Promise<AsyncGenerator<ResearchStreamEvent, any, any>>;
get<T>(researchId: string, options: {
stream: true;
events?: boolean;
outputSchema?: ZodSchema<T>;
}): Promise<AsyncGenerator<ResearchStreamEvent, any, any>>;
list(options?: ListResearchRequest): Promise<ListResearchResponse>;
pollUntilFinished(researchId: string, options?: {
pollInterval?: number;
timeoutMs?: number;
events?: boolean;
}): Promise<Research & {
status: "completed" | "failed" | "canceled";
}>;
pollUntilFinished<T>(researchId: string, options?: {
pollInterval?: number;
timeoutMs?: number;
events?: boolean;
outputSchema: ZodSchema<T>;
}): Promise<ResearchTyped<T> & {
status: "completed" | "failed" | "canceled";
}>;
}
/**
* Base client for Websets API
*/
/**
* Type for API query parameters
*/
type QueryParams = Record<string, string | number | boolean | string[] | undefined>;
/**
* Type for API request body
*/
interface RequestBody {
[key: string]: unknown;
}
/**
* Common pagination parameters
*/
interface PaginationParams {
/**
* Cursor for pagination
*/
cursor?: string;
/**
* Maximum number of items per page
*/
limit?: number;
}
/**
* Base client class for all Websets-related API clients
*/
declare class WebsetsBaseClient {
protected client: Exa;
/**
* Initialize a new Websets base client
* @param client The Exa client instance
*/
constructor(client: Exa);
/**
* Make a request to the Websets API
* @param endpoint The endpoint path
* @param method The HTTP method
* @param data Optional request body data
* @param params Optional query parameters
* @returns The response JSON
* @throws ExaError with API error details if the request fails
*/
protected request<T = unknown>(endpoint: string, method?: string, data?: RequestBody, params?: QueryParams, headers?: Record<string, string>): Promise<T>;
/**
* Helper to build pagination parameters
* @param pagination The pagination parameters
* @returns QueryParams object with pagination parameters
*/
protected buildPaginationParams(pagination?: PaginationParams): QueryParams;
}
interface components {
schemas: {
/** Article */
ArticleEntity: {
/**
* @default article
* @constant
*/
type: "article";
};
/** Company */
CompanyEntity: {
/**
* @default company
* @constant
*/
type: "company";
};
CreateCriterionParameters: {
/** @description The description of the criterion */
description: string;
};
CreateEnrichmentParameters: {
/** @description Provide a description of the enrichment task you want to perform to each Webset Item. */
description: string;
/**
* @description Format of the enrichment response.
*
* We automatically select the best format based on the description. If you want to explicitly specify the format, you can do so here.
* @enum {string}
*/
format?: CreateEnrichmentParametersFormat;
/** @description Set of key-value pairs you want to associate with this object. */
metadata?: {
[key: string]: string;
};
/** @description When the format is options, the different options for the enrichment agent to choose from. */
options?: {
/** @description The label of the option */
label: string;
}[];
};
CreateImportParameters: {
/** @description The number of records to import */
count: number;
/** @description When format is `csv`, these are the specific import parameters. */
csv?: {
/** @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. */
identifier?: number;
};
/** @description What type of entity the import contains (e.g. People, Companies, etc.), and thus should be attempted to be resolved as. */
entity: components["schemas"]["CompanyEntity"] | components["schemas"]["PersonEntity"] | components["schemas"]["ArticleEntity"] | components["schemas"]["ResearchPaperEntity"] | components["schemas"]["CustomEntity"];
/**
* @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.
* @enum {string}
*/
format: CreateImportParametersFormat;
/** @description Set of key-value pairs you want to associate with this object. */
metadata?: {
[key: string]: string;
};
/** @description The size of the file in bytes. Maximum size is 50 MB. */
size: number;
/** @description The title of the import */
title?: string;
};
/** @description The response to a successful import. Includes the upload URL and the upload valid until date. */
CreateImportResponse: {
/** @description The number of entities in the import */
count: number;
/**
* Format: date-time
* @description When the import was created
*/
createdAt: string;
/** @description The type of entity the import contains. */
entity: components["schemas"]["Entity"];
/**
* Format: date-time
* @description When the import failed
*/
failedAt: string | null;
/** @description A human readable message of the import failure */
failedMessage: string | null;
/**
* @description The reason the import failed
* @enum {string|null}
*/
failedReason: CreateImportResponseFailedReason;
/**
* @description The format of the import.
* @enum {string}
*/
format: CreateImportResponseFormat;
/** @description The unique identifier for the Import */
id: string;
/** @description Set of key-value pairs you want to associate with this object. */
metadata: {
[key: string]: string;
};
/**
* @description The type of object
* @enum {string}
*/
object: CreateImportResponseObject;
/**
* @description The status of the Import
* @enum {string}
*/
status: CreateImportResponseStatus;
/** @description The title of the import */
title: string;
/**
* Format: date-time
* @description When the import was last updated
*/
updatedAt: string;
/** @description The URL to upload the file to */
uploadUrl: string;
/** @description The date and time until the upload URL is valid. The upload URL will be valid for 1 hour. */
uploadValidUntil: string;
};
CreateMonitorParameters: {
/** @description Behavior to perform when monitor runs */
behavior: {
/** @description Specify the search parameters for the Monitor.
*
* By default, the search parameters (query, entity and criteria) from the last search are used when no parameters are provided. */
config: {
/**
* @description The behaviour of the Search when it is added to a Webset.
* @default append
* @enum {string}
*/
behavior: WebsetSearchBehavior;
/** @description The maximum number of results to find */
count: number;
/** @description The criteria to search for. By default, the criteria from the last search is used. */
criteria?: {
description: string;
}[];
/**
* Entity
* @description The entity to search for. By default, the entity from the last search/import is used.
*/
entity?: components["schemas"]["Entity"];
/** @description The query to search for. By default, the query from the last search is used. */
query?: string;
};
/**
* @default search
* @constant
*/
type: "search";
};
/** @description How often the monitor will run */
cadence: {
/** @description Cron expression for monitor cadence (must be a valid Unix cron with 5 fields). The schedule must trigger at most once per day. */
cron: string;
/**
* @description IANA timezone (e.g., "America/New_York")
* @default Etc/UTC
*/
timezone: string;
};
metadata?: {
[key: string]: string;
};
/** @description The id of the Webset */
websetId: string;
};
CreateWebhookParameters: {
/** @description The events to trigger the webhook */
events: EventType[];
/** @description Set of key-value pairs you want to associate with this object. */
metadata?: {
[key: string]: string;
};
/**
* Format: uri
* @description The URL to send the webhook to
*/
url: string;
};
CreateWebsetParameters: {
/** @description Add enrichments to extract additional data from found items.
*
* Enrichments automatically search for and extract specific information (like contact details, funding data, employee counts, etc.) from each item added to your Webset. */
enrichments?: components["schemas"]["CreateEnrichmentParameters"][];
/** @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. */
exclude?: {
/** @description The ID of the source to exclude. */
id: string;
/** @enum {string} */
source: WebsetExcludeSource;
}[];
/** @description The external identifier for the webset.
*
* You can use this to reference the Webset by your own internal identifiers. */
externalId?: string;
/** @description Import data from existing Websets and Imports into this Webset. */
import?: {
/** @description The ID of the source to search. */
id: string;
/** @enum {string} */
source: WebsetImportSource;
}[];
/** @description Set of key-value pairs you want to associate with this object. */
metadata?: {
[key: string]: string;
};
/** @description Create initial search for the Webset. */
search?: {
/**
* @description Number of Items the Webset will attempt to find.
*
* The actual number of Items found may be less than this number depending on the search complexity.
* @default 10
*/
count: number;
/** @description Criteria every item is evaluated against.
*
* 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. */
criteria?: components["schemas"]["CreateCriterionParameters"][];
/** @description Entity the Webset will return results for.
*
* 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. */
entity?: components["schemas"]["Entity"];
/** @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. */
exclude?: {
/** @description The ID of the source to exclude. */
id: string;
/** @enum {string} */
source: WebsetExcludeSource;
}[];
/** @description Natural language search query describing what you are looking for.
*
* Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results.
*
* Any URLs provided will be crawled and used as additional context for the search. */
query: string;
/** @description Whether to provide an estimate of how many total relevant results could exist for this search.
* Result of the analysis will be available in the `recall` field within the search request. */
recall?: boolean;
/** @description Limit the search to specific sources (existing imports or websets). Any results found within these sources matching the search criteria will be included in the Webset. */
scope?: {
/** @description The ID of the source to search. */
id: string;
relationship?: {
/** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. */
definition: string;
limit: number;
};
/** @enum {string} */
source: WebsetSearchScopeSource;
}[];
};
};
CreateWebsetSearchParameters: {
/**
* @description How this search interacts with existing items in the Webset:
*
* - **override**: Replace existing items and evaluate all items against new criteria
* - **append**: Add new items to existing ones, keeping items that match the new criteria
* @default override
*/
behavior: WebsetSearchBehavior;
/** @description Number of Items the Search will attempt to find.
*
* The actual number of Items found may be less than this number depending on the query complexity. */
count: number;
/** @description Criteria every item is evaluated against.
*
* 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. */
criteria?: components["schemas"]["CreateCriterionParameters"][];
/** @description Entity the search will return results for.
*
* 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. */
entity?: components["schemas"]["Entity"];
/** @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. */
exclude?: {
/** @description The ID of the source to exclude. */
id: string;
/** @enum {string} */
source: WebsetExcludeSource;
}[];
/** @description Set of key-value pairs you want to associate with this object. */
metadata?: {
[key: string]: string;
};
/** @description Natural language search query describing what you are looking for.
*
* Be specific and descriptive about your requirements, characteristics, and any constraints that help narrow down the results.
*
* Any URLs provided will be crawled and used as additional context for the search. */
query: string;
/** @description Whether to provide an estimate of how many total relevant results could exist for this search.
* Result of the analysis will be available in the `recall` field within the search request. */
recall?: boolean;
/** @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. */
scope?: {
/** @description The ID of the source to search. */
id: string;
relationship?: {
/** @description What the relationship of the entities you hope to find is relative to the entities contained in the provided source. */
definition: string;
limit: number;
};
/** @enum {string} */
source: WebsetSearchScopeSource;
}[];
};
/** Custom */
CustomEntity: {
description: string;
/**
* @default custom
* @constant
*/
type: "custom";
};
EnrichmentResult: {
/** @description The id of the Enrichment that generated the result */
enrichmentId: string;
format: components["schemas"]["WebsetEnrichmentFormat"];
/**
* @default enrichment_result
* @constant
*/
object: "enrichment_result";
/** @description The reasoning for the result when an Agent is used. */
reasoning: string | null;
/** @description The references used to generate the result. */
references: {
/** @description The relevant snippet of the reference content */
snippet: string | null;
/** @description The title of the reference */
title: string | null;
/**
* Format: uri
* @description The URL of the reference
*/
url: string;
}[];
/** @description The result of the enrichment. */
result: string[] | null;
/**
* @description The status of the enrichment result.
* @enum {string}
*/
status: EnrichmentResultStatus;
};
Entity: components["schemas"]["CompanyEntity"] | components["schemas"]["PersonEntity"] | components["schemas"]["ArticleEntity"] | components["schemas"]["ResearchPaperEntity"] | components["schemas"]["CustomEntity"];
/** Event */
Event: {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["Webset"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.created
* @constant
*/
type: "webset.created";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["Webset"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.deleted
* @constant
*/
type: "webset.deleted";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["Webset"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.idle
* @constant
*/
type: "webset.idle";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["Webset"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.paused
* @constant
*/
type: "webset.paused";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["WebsetItem"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.item.created
* @constant
*/
type: "webset.item.created";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["WebsetItem"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.item.enriched
* @constant
*/
type: "webset.item.enriched";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["WebsetSearch"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.search.created
* @constant
*/
type: "webset.search.created";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["WebsetSearch"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.search.updated
* @constant
*/
type: "webset.search.updated";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["WebsetSearch"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.search.canceled
* @constant
*/
type: "webset.search.canceled";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["WebsetSearch"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default webset.search.completed
* @constant
*/
type: "webset.search.completed";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["Import"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default import.created
* @constant
*/
type: "import.created";
} | {
/**
* Format: date-time
* @description The date and time the event was created
*/
createdAt: string;
data: components["schemas"]["Import"];
/** @description The unique identifier for the event */
id: string;
/**
* @default event
* @constant
*/
object: "event";
/**
* @default import.completed
* @constant