File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,13 @@ export type TavilySearchAPIRetrieverFields = ToolParams & {
86
86
* @default 3
87
87
*/
88
88
days ?: number ;
89
+
90
+ /**
91
+ * The base API url used for the Tavily Search API.
92
+ *
93
+ * @default "https://api.tavily.com"
94
+ */
95
+ apiUrl ?: string ;
89
96
} ;
90
97
91
98
/**
@@ -188,6 +195,8 @@ export class TavilySearchResults extends Tool {
188
195
189
196
protected days ?: number ;
190
197
198
+ protected apiUrl ?: string ;
199
+
191
200
constructor ( fields ?: TavilySearchAPIRetrieverFields ) {
192
201
super ( fields ) ;
193
202
this . maxResults = fields ?. maxResults ?? this . maxResults ;
@@ -204,6 +213,7 @@ export class TavilySearchResults extends Tool {
204
213
this . searchDepth = fields ?. searchDepth ?? this . searchDepth ;
205
214
this . topic = fields ?. topic ?? this . topic ;
206
215
this . days = fields ?. days ?? this . days ;
216
+ this . apiUrl = fields ?. apiUrl ?? "https://api.tavily.com" ;
207
217
208
218
if ( this . apiKey === undefined ) {
209
219
throw new Error (
@@ -231,7 +241,7 @@ export class TavilySearchResults extends Tool {
231
241
days : this . days ,
232
242
} ;
233
243
234
- const response = await fetch ( "https://api.tavily.com /search" , {
244
+ const response = await fetch ( ` ${ this . apiUrl } /search` , {
235
245
method : "POST" ,
236
246
headers : {
237
247
"content-type" : "application/json" ,
You can’t perform that action at this time.
0 commit comments