@howells/fieldwork-sdk 0.2.0 → 0.3.1
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 +104 -38
- package/dist/adapter-CEAQuT7F.js +3 -0
- package/dist/adapter-DGehHCMo.d.ts +470 -0
- package/dist/brave.d.ts +164 -0
- package/dist/brave.js +399 -0
- package/dist/browserbase.d.ts +128 -0
- package/dist/browserbase.js +180 -0
- package/dist/{errors-pzPMh82H.js → errors-BiIBG9zN.js} +14 -18
- package/dist/exa.d.ts +150 -24
- package/dist/exa.js +427 -119
- package/dist/{fieldwork-nPzWEelg.d.ts → fieldwork-B3x3cxDJ.d.ts} +5 -5
- package/dist/firecrawl.d.ts +220 -28
- package/dist/firecrawl.js +855 -233
- package/dist/index.d.ts +11 -5
- package/dist/index.js +53 -35
- package/dist/parallel.d.ts +188 -19
- package/dist/parallel.js +644 -113
- package/dist/perplexity.d.ts +78 -22
- package/dist/perplexity.js +318 -92
- package/dist/serpapi.d.ts +172 -0
- package/dist/serpapi.js +517 -0
- package/dist/tavily.d.ts +104 -31
- package/dist/tavily.js +347 -102
- package/dist/tools.d.ts +42 -14
- package/dist/tools.js +1274 -484
- package/dist/types-CnomnF-6.js +27 -0
- package/dist/util-YaZYZDSk.js +287 -0
- package/package.json +19 -3
- package/dist/adapter-C_kRm6TT.d.ts +0 -178
- package/dist/adapter-D-6-GFhJ.js +0 -5
- package/dist/util-D0PLE6Rl.d.ts +0 -2
- package/dist/util-DgcIZI2K.js +0 -214
package/dist/tavily.d.ts
CHANGED
|
@@ -1,71 +1,140 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { A as JsonSchema, G as Research, I as Page, L as PageBatch, W as Recency, X as SiteMap, a as RawClient, f as CallOptions, g as Crawl, k as ImageSearch, l as Answer, q as SearchResponse, s as AccountUsage, t as Adapter } from "./adapter-DGehHCMo.js";
|
|
2
|
+
interface TavilyConfig {
|
|
3
3
|
/** Defaults to the TAVILY_API_KEY environment variable. */
|
|
4
4
|
apiKey?: string;
|
|
5
|
+
/** Sent as the X-Project-ID header, so Tavily groups usage and logs by project. */
|
|
6
|
+
projectId?: string;
|
|
5
7
|
baseUrl?: string;
|
|
6
8
|
fetch?: typeof fetch;
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
type TavilySearchDepth = "ultra-fast" | "fast" | "basic" | "advanced";
|
|
11
|
+
interface TavilySearchOptions extends CallOptions {
|
|
12
|
+
/** Results to return; Tavily allows 0 to 20. */
|
|
10
13
|
limit?: number;
|
|
11
|
-
|
|
14
|
+
/**
|
|
15
|
+
* `advanced` costs 2 credits and is the most relevant. `ultra-fast` returns
|
|
16
|
+
* one summary per page instead of several passages.
|
|
17
|
+
*/
|
|
18
|
+
searchDepth?: TavilySearchDepth;
|
|
12
19
|
topic?: "general" | "news" | "finance";
|
|
13
|
-
|
|
20
|
+
/** Only results from this far back. Tavily has no `hour` window. */
|
|
21
|
+
recency?: Exclude<Recency, "hour">;
|
|
14
22
|
/** YYYY-MM-DD. */
|
|
15
23
|
publishedAfter?: string;
|
|
16
24
|
/** YYYY-MM-DD. */
|
|
17
25
|
publishedBefore?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Drop results outside the date window, and results with no detectable date.
|
|
28
|
+
* Without it Tavily keeps undated results when a window is set.
|
|
29
|
+
*/
|
|
30
|
+
filterByPublishedDate?: boolean;
|
|
31
|
+
/** Passages to return per page, 1 to 3. Not available with `ultra-fast`. */
|
|
32
|
+
chunksPerSource?: number;
|
|
18
33
|
includeDomains?: string[];
|
|
19
34
|
excludeDomains?: string[];
|
|
20
35
|
/** "restrict" keeps to includeDomains; "prefer" only ranks them higher. */
|
|
21
36
|
includeDomainsMode?: "restrict" | "prefer";
|
|
22
|
-
/**
|
|
37
|
+
/** ISO 3166-1 alpha-2 code such as "GB". Ranks that country higher; general topic only. */
|
|
23
38
|
country?: string;
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
39
|
+
/** ISO 639-1 code. Ranks pages in that language higher. */
|
|
40
|
+
language?: string;
|
|
41
|
+
/** Remove pages that are not in `language`, instead of only ranking them lower. */
|
|
42
|
+
filterByLanguage?: boolean;
|
|
43
|
+
/** Remove adult and unsafe pages. Not available with `fast` or `ultra-fast`. */
|
|
44
|
+
safeSearch?: boolean;
|
|
45
|
+
/** Let Tavily choose parameters from the query; it may switch to `advanced` (2 credits). */
|
|
46
|
+
autoParameters?: boolean;
|
|
47
|
+
/** Only pages containing the quoted phrases in the query. */
|
|
28
48
|
exactMatch?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
|
|
49
|
+
/** Seconds a cached copy may be old; 0 always fetches live, a negative number never does. Tavily counts hours, up to 720. */
|
|
50
|
+
maxAge?: number;
|
|
51
|
+
/** Include each result's page text; `true` means Markdown. */
|
|
52
|
+
content?: boolean | "markdown" | "text";
|
|
53
|
+
/** Return images found for the query in `images`. */
|
|
54
|
+
includeImages?: boolean;
|
|
55
|
+
/** Add a description to each image. Needs `includeImages`. */
|
|
56
|
+
imageDescriptions?: boolean;
|
|
57
|
+
/** Return each result's favicon. */
|
|
58
|
+
favicon?: boolean;
|
|
31
59
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
60
|
+
interface TavilyImagesOptions extends CallOptions {
|
|
61
|
+
searchDepth?: TavilySearchDepth;
|
|
62
|
+
topic?: "general" | "news" | "finance";
|
|
63
|
+
includeDomains?: string[];
|
|
64
|
+
excludeDomains?: string[];
|
|
65
|
+
safeSearch?: boolean;
|
|
66
|
+
/** Describe each image. Defaults to true. */
|
|
67
|
+
descriptions?: boolean;
|
|
68
|
+
}
|
|
69
|
+
interface TavilyAnswerOptions extends Omit<TavilySearchOptions, "content" | "includeImages" | "imageDescriptions" | "favicon"> {
|
|
70
|
+
/** `advanced` writes a more detailed answer. Defaults to `basic`. */
|
|
71
|
+
answerDepth?: "basic" | "advanced";
|
|
72
|
+
}
|
|
73
|
+
interface TavilyExtractOptions extends CallOptions {
|
|
74
|
+
/** `advanced` also reads tables and embedded content, and costs 2 credits per 5 pages. */
|
|
75
|
+
extractDepth?: "basic" | "advanced";
|
|
76
|
+
/** Return only the passages that answer this, as `excerpts`, instead of the whole page. */
|
|
36
77
|
query?: string;
|
|
78
|
+
/** Passages to return per page, 1 to 5. Needs `query`. */
|
|
37
79
|
chunksPerSource?: number;
|
|
80
|
+
/** `text` returns plain text, in `markdown`. */
|
|
38
81
|
format?: "markdown" | "text";
|
|
39
82
|
includeImages?: boolean;
|
|
83
|
+
favicon?: boolean;
|
|
84
|
+
/** Seconds Tavily waits for the page, 1 to 60. Not the same as `timeout`, which is milliseconds on our side. */
|
|
85
|
+
serverTimeout?: number;
|
|
40
86
|
}
|
|
87
|
+
type TavilyReadOptions = TavilyExtractOptions;
|
|
88
|
+
type TavilyReadManyOptions = TavilyExtractOptions;
|
|
41
89
|
interface TavilyTraversal {
|
|
42
|
-
/** Plain-words instructions that focus the walk. */
|
|
90
|
+
/** Plain-words instructions that focus the walk. Raises the cost. */
|
|
43
91
|
instructions?: string;
|
|
44
92
|
maxDepth?: number;
|
|
45
93
|
maxBreadth?: number;
|
|
94
|
+
/** Links to process before stopping. */
|
|
46
95
|
limit?: number;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/**
|
|
96
|
+
/** Regular expressions; a URL's path must match one. */
|
|
97
|
+
selectPathPatterns?: string[];
|
|
98
|
+
/** Regular expressions; a URL whose path matches one is skipped. */
|
|
99
|
+
excludePathPatterns?: string[];
|
|
100
|
+
/** Regular expressions such as `^docs\\.example\\.com$`; a URL's host must match one. */
|
|
101
|
+
selectDomainPatterns?: string[];
|
|
102
|
+
/** Regular expressions; a URL whose host matches one is skipped. */
|
|
103
|
+
excludeDomainPatterns?: string[];
|
|
104
|
+
/** Include links to other domains. Tavily defaults to true. */
|
|
52
105
|
allowExternal?: boolean;
|
|
106
|
+
/** Seconds Tavily works before stopping, 10 to 150. Not the same as `timeout`, which is milliseconds on our side. */
|
|
107
|
+
serverTimeout?: number;
|
|
53
108
|
}
|
|
54
|
-
|
|
55
|
-
|
|
109
|
+
interface TavilyMapOptions extends CallOptions, TavilyTraversal {}
|
|
110
|
+
interface TavilyCrawlOptions extends CallOptions, TavilyTraversal {
|
|
56
111
|
extractDepth?: "basic" | "advanced";
|
|
57
112
|
format?: "markdown" | "text";
|
|
113
|
+
/** Passages to return per page, 1 to 5. Needs `instructions`. */
|
|
114
|
+
chunksPerSource?: number;
|
|
58
115
|
includeImages?: boolean;
|
|
116
|
+
favicon?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/** A file the research agent reads as a source and cites. */
|
|
119
|
+
interface TavilyResearchFile {
|
|
120
|
+
/** With an extension of `.txt`, `.md` or `.json`. */
|
|
121
|
+
name: string;
|
|
122
|
+
/** The file's text, or its bytes. Sent base64-encoded. */
|
|
123
|
+
data: string | Uint8Array;
|
|
59
124
|
}
|
|
60
|
-
|
|
61
|
-
/** Tavily accepts object, string, integer, number and array types only. */
|
|
125
|
+
interface TavilyResearchOptions extends CallOptions {
|
|
126
|
+
/** Tavily accepts object, string, integer, number and array types only, and each property needs a description. */
|
|
62
127
|
schema?: JsonSchema;
|
|
63
128
|
model?: "mini" | "pro" | "auto";
|
|
64
129
|
citationFormat?: "numbered" | "mla" | "apa" | "chicago";
|
|
65
130
|
outputLength?: "short" | "standard" | "long";
|
|
66
|
-
/** A preference, not a restriction. */
|
|
131
|
+
/** A preference, not a restriction. Up to 20. */
|
|
67
132
|
includeDomains?: string[];
|
|
133
|
+
/** Never cited, subdomains included. Up to 20. */
|
|
68
134
|
excludeDomains?: string[];
|
|
135
|
+
/** Up to 5 files, 80,000 words in all. */
|
|
136
|
+
files?: TavilyResearchFile[];
|
|
137
|
+
/** Milliseconds between checks. */
|
|
69
138
|
interval?: number;
|
|
70
139
|
/**
|
|
71
140
|
* The id of a job that timed out or was cancelled, from the error's
|
|
@@ -73,12 +142,16 @@ export interface TavilyResearchOptions extends CallOptions {
|
|
|
73
142
|
*/
|
|
74
143
|
resume?: string;
|
|
75
144
|
}
|
|
76
|
-
|
|
145
|
+
interface TavilyOperations {
|
|
77
146
|
search(query: string, options?: TavilySearchOptions): Promise<SearchResponse>;
|
|
147
|
+
images(query: string, options?: TavilyImagesOptions): Promise<ImageSearch>;
|
|
78
148
|
read(url: string, options?: TavilyReadOptions): Promise<Page>;
|
|
149
|
+
readMany(urls: string[], options?: TavilyReadManyOptions): Promise<PageBatch>;
|
|
79
150
|
map(url: string, options?: TavilyMapOptions): Promise<SiteMap>;
|
|
80
151
|
crawl(url: string, options?: TavilyCrawlOptions): Promise<Crawl>;
|
|
152
|
+
answer(question: string, options?: TavilyAnswerOptions): Promise<Answer<unknown>>;
|
|
81
153
|
research<T = unknown>(question: string, options?: TavilyResearchOptions): Promise<Research<T>>;
|
|
154
|
+
usage(options?: CallOptions): Promise<AccountUsage>;
|
|
82
155
|
}
|
|
83
|
-
export declare
|
|
84
|
-
export {};
|
|
156
|
+
export declare const tavily: (config?: TavilyConfig) => Adapter<"tavily", TavilyOperations, RawClient>;
|
|
157
|
+
export type { TavilyAnswerOptions, TavilyConfig, TavilyCrawlOptions, TavilyImagesOptions, TavilyMapOptions, TavilyOperations, TavilyReadManyOptions, TavilyReadOptions, TavilyResearchFile, TavilyResearchOptions, TavilySearchDepth, TavilySearchOptions };
|