UNPKG

@tavily/core

Version:

Official JavaScript library for Tavily.

132 lines (129 loc) 4.55 kB
type TavilySearchFuncton = (query: string, options: TavilySearchOptions) => Promise<TavilySearchResponse>; type TavilyQNASearchFuncton = (query: string, options: TavilySearchOptions) => Promise<string>; type TavilyContextSearchFuncton = (query: string, options: TavilySearchOptions) => Promise<string>; type TavilyExtractFunction = (urls: Array<string>, options: TavilyExtractOptions) => Promise<TavilyExtractResponse>; type TavilyCrawlFunction = (url: string, options: TavilyCrawlOptions) => Promise<TavilyCrawlResponse>; type TavilyMapFunction = (url: string, options: TavilyMapOptions) => Promise<TavilyMapResponse>; type TavilyClient = { search: TavilySearchFuncton; searchQNA: TavilyQNASearchFuncton; searchContext: TavilyContextSearchFuncton; extract: TavilyExtractFunction; crawl: TavilyCrawlFunction; map: TavilyMapFunction; }; type TavilyProxyOptions = { http?: string; https?: string; }; type TavilyClientOptions = { apiKey?: string; proxies?: TavilyProxyOptions; }; type TavilySearchOptions = { searchDepth?: "basic" | "advanced"; topic?: "general" | "news" | "finance"; days?: number; maxResults?: number; includeImages?: boolean; includeImageDescriptions?: boolean; includeAnswer?: boolean; includeRawContent?: false | "markdown" | "text"; includeDomains?: string[]; excludeDomains?: string[]; maxTokens?: number; timeRange?: "year" | "month" | "week" | "day" | "y" | "m" | "w" | "d"; chunksPerSource?: number; country?: string; timeout?: number; [key: string]: any; }; type TavilyImage = { url: string; description?: string; }; type TavilySearchResult = { title: string; url: string; content: string; rawContent?: string; score: number; publishedDate: string; }; type TavilySearchResponse = { answer?: string; query: string; responseTime: number; images: Array<TavilyImage>; results: Array<TavilySearchResult>; }; type TavilyExtractOptions = { includeImages?: boolean; extractDepth?: "basic" | "advanced"; format?: "markdown" | "text"; timeout?: number; [key: string]: any; }; type TavilyExtractResult = { url: string; rawContent: string; images?: Array<string>; }; type TavilyExtractFailedResult = { url: string; error: string; }; type TavilyCrawlCategory = "Documentation" | "Blog" | "Blogs" | "Community" | "About" | "Contact" | "Privacy" | "Terms" | "Status" | "Pricing" | "Enterprise" | "Careers" | "E-Commerce" | "Authentication" | "Developer" | "Developers" | "Solutions" | "Partners" | "Downloads" | "Media" | "Events" | "People"; type TavilyCrawlCategories = Set<TavilyCrawlCategory>; type TavilyExtractResponse = { results: Array<TavilyExtractResult>; failedResults: Array<TavilyExtractFailedResult>; responseTime: number; }; type TavilyCrawlOptions = { maxDepth?: number; maxBreadth?: number; limit?: number; instructions?: string; extractDepth?: "basic" | "advanced"; selectPaths?: string[]; selectDomains?: string[]; excludePaths?: string[]; excludeDomains?: string[]; allowExternal?: boolean; includeImages?: boolean; categories?: TavilyCrawlCategory[]; format?: "markdown" | "text"; timeout?: number; [key: string]: any; }; type TavilyCrawlResponse = { responseTime: number; baseUrl: string; results: Array<{ url: string; rawContent: string; images: Array<string>; }>; }; type TavilyMapOptions = { limit?: number; maxDepth?: number; maxBreadth?: number; selectPaths?: string[]; selectDomains?: string[]; excludePaths?: string[]; excludeDomains?: string[]; categories?: TavilyCrawlCategory[]; allowExternal?: boolean; instructions?: string; timeout?: number; [key: string]: any; }; type TavilyMapResponse = { responseTime: number; baseUrl: string; results: string[]; }; declare function tavily(options?: TavilyClientOptions): TavilyClient; export { type TavilyClient, type TavilyClientOptions, type TavilyContextSearchFuncton, type TavilyCrawlCategories, type TavilyCrawlCategory, type TavilyCrawlFunction, type TavilyCrawlOptions, type TavilyCrawlResponse, type TavilyExtractFunction, type TavilyExtractOptions, type TavilyExtractResponse, type TavilyMapFunction, type TavilyMapOptions, type TavilyMapResponse, type TavilyProxyOptions, type TavilyQNASearchFuncton, type TavilySearchFuncton, type TavilySearchOptions, type TavilySearchResponse, tavily };