Skip to content

Commit 056790f

Browse files
committed
Add TypeScript definitions for '@tavily/core' module
This new file defines interfaces and types for using the '@tavily/core' library. It includes options for search parameters, image and search result structures, and the main client interface and function. This improves type safety and development experience when integrating Tavily into TypeScript projects. Took 59 seconds
1 parent 043b47b commit 056790f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

types/tavily.d.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
declare module '@tavily/core' {
2+
export interface TavilySearchOptions {
3+
searchDepth?: "basic" | "advanced";
4+
topic?: "general" | "news" | "finance";
5+
days?: number;
6+
maxResults?: number;
7+
includeImages?: boolean;
8+
includeImageDescriptions?: boolean;
9+
includeAnswer?: boolean;
10+
includeRawContent?: boolean;
11+
includeDomains?: Array<string>;
12+
excludeDomains?: Array<string>;
13+
maxTokens?: number;
14+
}
15+
16+
export interface TavilyImage {
17+
url: string;
18+
description?: string;
19+
}
20+
21+
export interface TavilySearchResult {
22+
title: string;
23+
url: string;
24+
content: string;
25+
rawContent?: string;
26+
score: number;
27+
publishedDate: string;
28+
}
29+
30+
export interface TavilySearchResponse {
31+
answer?: string;
32+
query: string;
33+
responseTime: number;
34+
images: Array<TavilyImage>;
35+
results: Array<TavilySearchResult>;
36+
}
37+
38+
export interface TavilyClient {
39+
search: (query: string, options: TavilySearchOptions) => Promise<TavilySearchResponse>;
40+
}
41+
42+
export function tavily(options?: { apiKey?: string }): TavilyClient;
43+
}

0 commit comments

Comments
 (0)