@tavily/ai-sdk 0.1.1 → 0.3.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 CHANGED
@@ -76,6 +76,7 @@ const result = await generateText({
76
76
  - `autoParameters?: boolean` - Enable automatic parameter optimization
77
77
  - `timeout?: number` - Request timeout in milliseconds
78
78
  - `includeFavicon?: boolean` - Include favicon URLs in results
79
+ - `includeUsage?: boolean` - Whether to include credit usage information in the response.
79
80
  - `proxies?: { http?: string, https?: string }` - HTTP/HTTPS proxy configuration
80
81
  - `apiBaseURL?: string` - Custom API base URL
81
82
 
@@ -104,6 +105,7 @@ const result = await generateText({
104
105
  - `format?: "markdown" | "text"` - Output format (default: "markdown")
105
106
  - `timeout?: number` - Request timeout in milliseconds
106
107
  - `includeFavicon?: boolean` - Include favicon URLs in results
108
+ - `includeUsage?: boolean` - Whether to include credit usage information in the response. NOTE:The value may be 0 if the total successful URL extractions has not yet reached 5 calls. See our [Credits & Pricing documentation]("https://docs.tavily.com/documentation/api-credits") for details.
107
109
  - `proxies?: { http?: string, https?: string }` - HTTP/HTTPS proxy configuration
108
110
  - `apiBaseURL?: string` - Custom API base URL
109
111
 
@@ -145,6 +147,7 @@ const result = await generateText({
145
147
  - `format?: "markdown" | "text"` - Output format (default: "markdown")
146
148
  - `timeout?: number` - Request timeout in milliseconds
147
149
  - `includeFavicon?: boolean` - Include favicon URLs in results
150
+ - `includeUsage?: boolean` - Whether to include credit usage information in the response. NOTE:The value may be 0 if the total use of /extract and /map have not yet reached minimum requirements. See our [Credits & Pricing documentation]("https://docs.tavily.com/documentation/api-credits") for details.
148
151
  - `proxies?: { http?: string, https?: string }` - HTTP/HTTPS proxy configuration
149
152
  - `apiBaseURL?: string` - Custom API base URL
150
153
 
@@ -187,6 +190,7 @@ const result = await generateText({
187
190
  - `timeout?: number` - Request timeout in milliseconds
188
191
  - `proxies?: { http?: string, https?: string }` - HTTP/HTTPS proxy configuration
189
192
  - `apiBaseURL?: string` - Custom API base URL
193
+ - `includeUsage?: boolean` - Whether to include credit usage information in the response.NOTE:The value may be 0 if the total successful pages mapped has not yet reached 10 calls. See our [Credits & Pricing documentation]("https://docs.tavily.com/documentation/api-credits") for details.
190
194
 
191
195
  **Input Parameters (for AI agent):**
192
196
  - `url: string` - Base URL to start mapping from (required)
package/dist/index.d.ts CHANGED
@@ -21,6 +21,7 @@ type TavilyExtractOptions = TavilyClientOptions & Partial<TavilyExtractOptions$1
21
21
  declare const tavilyExtract: (options?: TavilyExtractOptions) => ai.Tool<{
22
22
  urls: string[];
23
23
  extractDepth?: "basic" | "advanced" | undefined;
24
+ query?: string | undefined;
24
25
  }, _tavily_core.TavilyExtractResponse>;
25
26
 
26
27
  type TavilyCrawlOptions = TavilyClientOptions & Partial<TavilyCrawlOptions$1>;
package/dist/index.js CHANGED
@@ -38,18 +38,21 @@ var tavilyExtract = (options = {}) => {
38
38
  urls: z2.array(z2.string()).describe("Array of URLs to extract content from"),
39
39
  extractDepth: z2.enum(["basic", "advanced"]).optional().describe(
40
40
  "Extraction depth - 'basic' for main content, 'advanced' for comprehensive extraction (default: 'basic')"
41
- )
41
+ ),
42
+ query: z2.string().optional().describe("User intent query for reranking extracted content chunks")
42
43
  });
43
44
  return tool2({
44
45
  description: "Extract clean, structured content from one or more URLs. Returns parsed content in markdown or text format, optimized for AI consumption.",
45
46
  inputSchema,
46
47
  execute: async ({
47
48
  urls,
48
- extractDepth: inputExtractDepth
49
+ extractDepth: inputExtractDepth,
50
+ query: inputQuery
49
51
  }) => {
50
52
  return await client.extract(urls, {
51
53
  ...options,
52
- extractDepth: inputExtractDepth ?? options.extractDepth
54
+ extractDepth: inputExtractDepth ?? options.extractDepth,
55
+ query: inputQuery ?? options.query
53
56
  });
54
57
  }
55
58
  });
@@ -87,7 +90,8 @@ var tavilyCrawl = (options = {}) => {
87
90
  maxDepth: inputMaxDepth ?? options.maxDepth,
88
91
  extractDepth: inputExtractDepth ?? options.extractDepth,
89
92
  instructions: inputInstructions ?? options.instructions,
90
- allowExternal: inputAllowExternal ?? options.allowExternal
93
+ allowExternal: inputAllowExternal ?? options.allowExternal,
94
+ chunksPerSource: 3
91
95
  });
92
96
  }
93
97
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tavily/ai-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Tavily AI SDK tools - Search, Extract, Crawl, and Map",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",