tavily-python 0.7.8__tar.gz → 0.7.10__tar.gz

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.
Files changed (24) hide show
  1. {tavily_python-0.7.8 → tavily_python-0.7.10}/PKG-INFO +1 -1
  2. {tavily_python-0.7.8 → tavily_python-0.7.10}/setup.py +1 -1
  3. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/async_tavily.py +31 -3
  4. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/tavily.py +30 -5
  5. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily_python.egg-info/PKG-INFO +1 -1
  6. {tavily_python-0.7.8 → tavily_python-0.7.10}/LICENSE +0 -0
  7. {tavily_python-0.7.8 → tavily_python-0.7.10}/README.md +0 -0
  8. {tavily_python-0.7.8 → tavily_python-0.7.10}/setup.cfg +0 -0
  9. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/__init__.py +0 -0
  10. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/config.py +0 -0
  11. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/errors.py +0 -0
  12. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/hybrid_rag/__init__.py +0 -0
  13. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/hybrid_rag/hybrid_rag.py +0 -0
  14. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily/utils.py +0 -0
  15. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily_python.egg-info/SOURCES.txt +0 -0
  16. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily_python.egg-info/dependency_links.txt +0 -0
  17. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily_python.egg-info/requires.txt +0 -0
  18. {tavily_python-0.7.8 → tavily_python-0.7.10}/tavily_python.egg-info/top_level.txt +0 -0
  19. {tavily_python-0.7.8 → tavily_python-0.7.10}/tests/test_async_search.py +0 -0
  20. {tavily_python-0.7.8 → tavily_python-0.7.10}/tests/test_crawl.py +0 -0
  21. {tavily_python-0.7.8 → tavily_python-0.7.10}/tests/test_errors.py +0 -0
  22. {tavily_python-0.7.8 → tavily_python-0.7.10}/tests/test_map.py +0 -0
  23. {tavily_python-0.7.8 → tavily_python-0.7.10}/tests/test_search.py +0 -0
  24. {tavily_python-0.7.8 → tavily_python-0.7.10}/tests/test_sync_search.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tavily-python
3
- Version: 0.7.8
3
+ Version: 0.7.10
4
4
  Summary: Python wrapper for the Tavily API
5
5
  Home-page: https://github.com/tavily-ai/tavily-python
6
6
  Author: Tavily AI
@@ -5,7 +5,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
5
5
 
6
6
  setup(
7
7
  name='tavily-python',
8
- version='0.7.8',
8
+ version='0.7.10',
9
9
  url='https://github.com/tavily-ai/tavily-python',
10
10
  author='Tavily AI',
11
11
  author_email='support@tavily.com',
@@ -17,7 +17,8 @@ class AsyncTavilyClient:
17
17
 
18
18
  def __init__(self, api_key: Optional[str] = None,
19
19
  company_info_tags: Sequence[str] = ("news", "general", "finance"),
20
- proxies: Optional[dict[str, str]] = None):
20
+ proxies: Optional[dict[str, str]] = None,
21
+ api_base_url: Optional[str] = None):
21
22
  if api_key is None:
22
23
  api_key = os.getenv("TAVILY_API_KEY")
23
24
 
@@ -39,13 +40,14 @@ class AsyncTavilyClient:
39
40
  else None
40
41
  )
41
42
 
43
+ self._api_base_url = api_base_url or "https://api.tavily.com"
42
44
  self._client_creator = lambda: httpx.AsyncClient(
43
45
  headers={
44
46
  "Content-Type": "application/json",
45
47
  "Authorization": f"Bearer {api_key}",
46
48
  "X-Client-Source": "tavily-python"
47
49
  },
48
- base_url="https://api.tavily.com",
50
+ base_url=self._api_base_url,
49
51
  mounts=proxy_mounts
50
52
  )
51
53
  self._company_info_tags = company_info_tags
@@ -56,6 +58,8 @@ class AsyncTavilyClient:
56
58
  search_depth: Literal["basic", "advanced"] = None,
57
59
  topic: Literal["general", "news", "finance"] = None,
58
60
  time_range: Literal["day", "week", "month", "year"] = None,
61
+ start_date: str = None,
62
+ end_date: str = None,
59
63
  days: int = None,
60
64
  max_results: int = None,
61
65
  include_domains: Sequence[str] = None,
@@ -66,6 +70,7 @@ class AsyncTavilyClient:
66
70
  timeout: int = 60,
67
71
  country: str = None,
68
72
  auto_parameters: bool = None,
73
+ include_favicon: bool = None,
69
74
  **kwargs,
70
75
  ) -> dict:
71
76
  """
@@ -76,6 +81,8 @@ class AsyncTavilyClient:
76
81
  "search_depth": search_depth,
77
82
  "topic": topic,
78
83
  "time_range": time_range,
84
+ "start_date": start_date,
85
+ "end_date": end_date,
79
86
  "days": days,
80
87
  "include_answer": include_answer,
81
88
  "include_raw_content": include_raw_content,
@@ -85,6 +92,7 @@ class AsyncTavilyClient:
85
92
  "include_images": include_images,
86
93
  "country": country,
87
94
  "auto_parameters": auto_parameters,
95
+ "include_favicon": include_favicon,
88
96
  }
89
97
 
90
98
  data = {k: v for k, v in data.items() if v is not None}
@@ -125,6 +133,8 @@ class AsyncTavilyClient:
125
133
  search_depth: Literal["basic", "advanced"] = None,
126
134
  topic: Literal["general", "news", "finance"] = None,
127
135
  time_range: Literal["day", "week", "month", "year"] = None,
136
+ start_date: str = None,
137
+ end_date: str = None,
128
138
  days: int = None,
129
139
  max_results: int = None,
130
140
  include_domains: Sequence[str] = None,
@@ -135,6 +145,7 @@ class AsyncTavilyClient:
135
145
  timeout: int = 60,
136
146
  country: str = None,
137
147
  auto_parameters: bool = None,
148
+ include_favicon: bool = None,
138
149
  **kwargs, # Accept custom arguments
139
150
  ) -> dict:
140
151
  """
@@ -145,6 +156,8 @@ class AsyncTavilyClient:
145
156
  search_depth=search_depth,
146
157
  topic=topic,
147
158
  time_range=time_range,
159
+ start_date=start_date,
160
+ end_date=end_date,
148
161
  days=days,
149
162
  max_results=max_results,
150
163
  include_domains=include_domains,
@@ -155,6 +168,7 @@ class AsyncTavilyClient:
155
168
  timeout=timeout,
156
169
  country=country,
157
170
  auto_parameters=auto_parameters,
171
+ include_favicon=include_favicon,
158
172
  **kwargs,
159
173
  )
160
174
 
@@ -171,16 +185,19 @@ class AsyncTavilyClient:
171
185
  extract_depth: Literal["basic", "advanced"] = None,
172
186
  format: Literal["markdown", "text"] = None,
173
187
  timeout: int = 60,
188
+ include_favicon: bool = None,
174
189
  **kwargs
175
190
  ) -> dict:
176
191
  """
177
192
  Internal extract method to send the request to the API.
193
+ include_favicon: If True, include the favicon in the extraction results.
178
194
  """
179
195
  data = {
180
196
  "urls": urls,
181
197
  "include_images": include_images,
182
198
  "extract_depth": extract_depth,
183
199
  "format": format,
200
+ "include_favicon": include_favicon,
184
201
  }
185
202
 
186
203
  data = {k: v for k, v in data.items() if v is not None}
@@ -223,10 +240,12 @@ class AsyncTavilyClient:
223
240
  extract_depth: Literal["basic", "advanced"] = None,
224
241
  format: Literal["markdown", "text"] = None,
225
242
  timeout: int = 60,
243
+ include_favicon: bool = None,
226
244
  **kwargs, # Accept custom arguments
227
245
  ) -> dict:
228
246
  """
229
247
  Combined extract method.
248
+ include_favicon: If True, include the favicon in the extraction results.
230
249
  """
231
250
  timeout = min(timeout, 120)
232
251
  response_dict = await self._extract(urls,
@@ -234,6 +253,7 @@ class AsyncTavilyClient:
234
253
  extract_depth,
235
254
  format,
236
255
  timeout,
256
+ include_favicon=include_favicon,
237
257
  **kwargs,
238
258
  )
239
259
 
@@ -261,6 +281,7 @@ class AsyncTavilyClient:
261
281
  extract_depth: Literal["basic", "advanced"] = None,
262
282
  format: Literal["markdown", "text"] = None,
263
283
  timeout: int = 60,
284
+ include_favicon: bool = None,
264
285
  **kwargs
265
286
  ) -> dict:
266
287
  """
@@ -280,7 +301,8 @@ class AsyncTavilyClient:
280
301
  "categories": categories,
281
302
  "include_images": include_images,
282
303
  "extract_depth": extract_depth,
283
- "format": format
304
+ "format": format,
305
+ "include_favicon": include_favicon,
284
306
  }
285
307
 
286
308
  if kwargs:
@@ -332,6 +354,7 @@ class AsyncTavilyClient:
332
354
  include_images: bool = None,
333
355
  format: Literal["markdown", "text"] = None,
334
356
  timeout: int = 60,
357
+ include_favicon: bool = None,
335
358
  **kwargs
336
359
  ) -> dict:
337
360
  """
@@ -354,6 +377,7 @@ class AsyncTavilyClient:
354
377
  include_images=include_images,
355
378
  format=format,
356
379
  timeout=timeout,
380
+ include_favicon=include_favicon,
357
381
  **kwargs)
358
382
 
359
383
  return response_dict
@@ -474,6 +498,7 @@ class AsyncTavilyClient:
474
498
  max_tokens: int = 4000,
475
499
  timeout: int = 60,
476
500
  country: str = None,
501
+ include_favicon: bool = None,
477
502
  **kwargs, # Accept custom arguments
478
503
  ) -> str:
479
504
  """
@@ -497,6 +522,7 @@ class AsyncTavilyClient:
497
522
  include_images=False,
498
523
  timeout = timeout,
499
524
  country=country,
525
+ include_favicon=include_favicon,
500
526
  **kwargs,
501
527
  )
502
528
  sources = response_dict.get("results", [])
@@ -513,6 +539,7 @@ class AsyncTavilyClient:
513
539
  exclude_domains: Sequence[str] = None,
514
540
  timeout: int = 60,
515
541
  country: str = None,
542
+ include_favicon: bool = None,
516
543
  **kwargs, # Accept custom arguments
517
544
  ) -> str:
518
545
  """
@@ -531,6 +558,7 @@ class AsyncTavilyClient:
531
558
  include_answer=True,
532
559
  timeout = timeout,
533
560
  country=country,
561
+ include_favicon=include_favicon,
534
562
  **kwargs,
535
563
  )
536
564
  return response_dict.get("answer", "")
@@ -13,7 +13,7 @@ class TavilyClient:
13
13
  Tavily API client class.
14
14
  """
15
15
 
16
- def __init__(self, api_key: Optional[str] = None, proxies: Optional[dict[str, str]] = None):
16
+ def __init__(self, api_key: Optional[str] = None, proxies: Optional[dict[str, str]] = None, api_base_url: Optional[str] = None):
17
17
  if api_key is None:
18
18
  api_key = os.getenv("TAVILY_API_KEY")
19
19
 
@@ -27,7 +27,7 @@ class TavilyClient:
27
27
 
28
28
  resolved_proxies = {k: v for k, v in resolved_proxies.items() if v} or None
29
29
 
30
- self.base_url = "https://api.tavily.com"
30
+ self.base_url = api_base_url or "https://api.tavily.com"
31
31
  self.api_key = api_key
32
32
  self.proxies = resolved_proxies
33
33
  self.headers = {
@@ -41,6 +41,8 @@ class TavilyClient:
41
41
  search_depth: Literal["basic", "advanced"] = None,
42
42
  topic: Literal["general", "news", "finance"] = None,
43
43
  time_range: Literal["day", "week", "month", "year"] = None,
44
+ start_date: str = None,
45
+ end_date: str = None,
44
46
  days: int = None,
45
47
  max_results: int = None,
46
48
  include_domains: Sequence[str] = None,
@@ -51,6 +53,7 @@ class TavilyClient:
51
53
  timeout: int = 60,
52
54
  country: str = None,
53
55
  auto_parameters: bool = None,
56
+ include_favicon: bool = None,
54
57
  **kwargs
55
58
  ) -> dict:
56
59
  """
@@ -62,6 +65,8 @@ class TavilyClient:
62
65
  "search_depth": search_depth,
63
66
  "topic": topic,
64
67
  "time_range": time_range,
68
+ "start_date": start_date,
69
+ "end_date": end_date,
65
70
  "days": days,
66
71
  "include_answer": include_answer,
67
72
  "include_raw_content": include_raw_content,
@@ -71,6 +76,7 @@ class TavilyClient:
71
76
  "include_images": include_images,
72
77
  "country": country,
73
78
  "auto_parameters": auto_parameters,
79
+ "include_favicon": include_favicon,
74
80
  }
75
81
 
76
82
  data = {k: v for k, v in data.items() if v is not None}
@@ -112,6 +118,8 @@ class TavilyClient:
112
118
  search_depth: Literal["basic", "advanced"] = None,
113
119
  topic: Literal["general", "news", "finance" ] = None,
114
120
  time_range: Literal["day", "week", "month", "year"] = None,
121
+ start_date: str = None,
122
+ end_date: str = None,
115
123
  days: int = None,
116
124
  max_results: int = None,
117
125
  include_domains: Sequence[str] = None,
@@ -122,6 +130,7 @@ class TavilyClient:
122
130
  timeout: int = 60,
123
131
  country: str = None,
124
132
  auto_parameters: bool = None,
133
+ include_favicon: bool = None,
125
134
  **kwargs, # Accept custom arguments
126
135
  ) -> dict:
127
136
  """
@@ -132,6 +141,8 @@ class TavilyClient:
132
141
  search_depth=search_depth,
133
142
  topic=topic,
134
143
  time_range=time_range,
144
+ start_date=start_date,
145
+ end_date=end_date,
135
146
  days=days,
136
147
  max_results=max_results,
137
148
  include_domains=include_domains,
@@ -142,6 +153,7 @@ class TavilyClient:
142
153
  timeout=timeout,
143
154
  country=country,
144
155
  auto_parameters=auto_parameters,
156
+ include_favicon=include_favicon,
145
157
  **kwargs,
146
158
  )
147
159
 
@@ -157,16 +169,18 @@ class TavilyClient:
157
169
  extract_depth: Literal["basic", "advanced"] = None,
158
170
  format: Literal["markdown", "text"] = None,
159
171
  timeout: int = 60,
172
+ include_favicon: bool = None,
160
173
  **kwargs
161
174
  ) -> dict:
162
175
  """
163
- Internal extract method to send the request to the API.
176
+ Internal extract method to send the request to the API.
164
177
  """
165
178
  data = {
166
179
  "urls": urls,
167
180
  "include_images": include_images,
168
181
  "extract_depth": extract_depth,
169
182
  "format": format,
183
+ "include_favicon": include_favicon,
170
184
  }
171
185
 
172
186
  data = {k: v for k, v in data.items() if v is not None}
@@ -207,6 +221,7 @@ class TavilyClient:
207
221
  extract_depth: Literal["basic", "advanced"] = None,
208
222
  format: Literal["markdown", "text"] = None,
209
223
  timeout: int = 60,
224
+ include_favicon: bool = None,
210
225
  **kwargs, # Accept custom arguments
211
226
  ) -> dict:
212
227
  """
@@ -218,6 +233,7 @@ class TavilyClient:
218
233
  extract_depth,
219
234
  format,
220
235
  timeout,
236
+ include_favicon=include_favicon,
221
237
  **kwargs)
222
238
 
223
239
  tavily_results = response_dict.get("results", [])
@@ -244,10 +260,12 @@ class TavilyClient:
244
260
  extract_depth: Literal["basic", "advanced"] = None,
245
261
  format: Literal["markdown", "text"] = None,
246
262
  timeout: int = 60,
263
+ include_favicon: bool = None,
247
264
  **kwargs
248
265
  ) -> dict:
249
266
  """
250
267
  Internal crawl method to send the request to the API.
268
+ include_favicon: If True, include the favicon in the crawl results.
251
269
  """
252
270
  data = {
253
271
  "url": url,
@@ -263,7 +281,8 @@ class TavilyClient:
263
281
  "include_images": include_images,
264
282
  "categories": categories,
265
283
  "extract_depth": extract_depth,
266
- "format": format
284
+ "format": format,
285
+ "include_favicon": include_favicon,
267
286
  }
268
287
 
269
288
  if kwargs:
@@ -315,11 +334,12 @@ class TavilyClient:
315
334
  extract_depth: Literal["basic", "advanced"] = None,
316
335
  format: Literal["markdown", "text"] = None,
317
336
  timeout: int = 60,
337
+ include_favicon: bool = None,
318
338
  **kwargs
319
339
  ) -> dict:
320
340
  """
321
341
  Combined crawl method.
322
-
342
+ include_favicon: If True, include the favicon in the crawl results.
323
343
  """
324
344
  timeout = min(timeout, 120)
325
345
  response_dict = self._crawl(url,
@@ -337,6 +357,7 @@ class TavilyClient:
337
357
  extract_depth=extract_depth,
338
358
  format=format,
339
359
  timeout=timeout,
360
+ include_favicon=include_favicon,
340
361
  **kwargs)
341
362
 
342
363
  return response_dict
@@ -457,6 +478,7 @@ class TavilyClient:
457
478
  max_tokens: int = 4000,
458
479
  timeout: int = 60,
459
480
  country: str = None,
481
+ include_favicon: bool = None,
460
482
  **kwargs, # Accept custom arguments
461
483
  ) -> str:
462
484
  """
@@ -480,6 +502,7 @@ class TavilyClient:
480
502
  include_images=False,
481
503
  timeout=timeout,
482
504
  country=country,
505
+ include_favicon=include_favicon,
483
506
  **kwargs,
484
507
  )
485
508
  sources = response_dict.get("results", [])
@@ -497,6 +520,7 @@ class TavilyClient:
497
520
  exclude_domains: Sequence[str] = None,
498
521
  timeout: int = 60,
499
522
  country: str = None,
523
+ include_favicon: bool = None,
500
524
  **kwargs, # Accept custom arguments
501
525
  ) -> str:
502
526
  """
@@ -515,6 +539,7 @@ class TavilyClient:
515
539
  include_answer=True,
516
540
  timeout=timeout,
517
541
  country=country,
542
+ include_favicon=include_favicon,
518
543
  **kwargs,
519
544
  )
520
545
  return response_dict.get("answer", "")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tavily-python
3
- Version: 0.7.8
3
+ Version: 0.7.10
4
4
  Summary: Python wrapper for the Tavily API
5
5
  Home-page: https://github.com/tavily-ai/tavily-python
6
6
  Author: Tavily AI
File without changes
File without changes
File without changes