tavily-python 0.7.16__tar.gz → 0.7.18__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.
- {tavily_python-0.7.16 → tavily_python-0.7.18}/PKG-INFO +1 -1
- {tavily_python-0.7.16 → tavily_python-0.7.18}/setup.py +1 -1
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/async_tavily.py +9 -4
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/tavily.py +8 -5
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily_python.egg-info/PKG-INFO +1 -1
- {tavily_python-0.7.16 → tavily_python-0.7.18}/LICENSE +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/README.md +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/setup.cfg +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/__init__.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/config.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/errors.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/hybrid_rag/__init__.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/hybrid_rag/hybrid_rag.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily/utils.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily_python.egg-info/SOURCES.txt +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily_python.egg-info/dependency_links.txt +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily_python.egg-info/requires.txt +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tavily_python.egg-info/top_level.txt +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tests/test_crawl.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tests/test_errors.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tests/test_map.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tests/test_research.py +0 -0
- {tavily_python-0.7.16 → tavily_python-0.7.18}/tests/test_search.py +0 -0
|
@@ -18,7 +18,8 @@ class AsyncTavilyClient:
|
|
|
18
18
|
company_info_tags: Sequence[str] = ("news", "general", "finance"),
|
|
19
19
|
proxies: Optional[dict[str, str]] = None,
|
|
20
20
|
api_base_url: Optional[str] = None,
|
|
21
|
-
client_source: Optional[str] = None
|
|
21
|
+
client_source: Optional[str] = None,
|
|
22
|
+
project_id: Optional[str] = None):
|
|
22
23
|
if api_key is None:
|
|
23
24
|
api_key = os.getenv("TAVILY_API_KEY")
|
|
24
25
|
|
|
@@ -40,12 +41,16 @@ class AsyncTavilyClient:
|
|
|
40
41
|
else None
|
|
41
42
|
)
|
|
42
43
|
|
|
44
|
+
tavily_project = project_id or os.getenv("TAVILY_PROJECT")
|
|
45
|
+
|
|
43
46
|
self._api_base_url = api_base_url or "https://api.tavily.com"
|
|
47
|
+
|
|
44
48
|
self._client_creator = lambda: httpx.AsyncClient(
|
|
45
49
|
headers={
|
|
46
50
|
"Content-Type": "application/json",
|
|
47
51
|
"Authorization": f"Bearer {api_key}",
|
|
48
|
-
"X-Client-Source": client_source or "tavily-python"
|
|
52
|
+
"X-Client-Source": client_source or "tavily-python",
|
|
53
|
+
**({"X-Project-ID": tavily_project} if tavily_project else {})
|
|
49
54
|
},
|
|
50
55
|
base_url=self._api_base_url,
|
|
51
56
|
mounts=proxy_mounts
|
|
@@ -55,7 +60,7 @@ class AsyncTavilyClient:
|
|
|
55
60
|
async def _search(
|
|
56
61
|
self,
|
|
57
62
|
query: str,
|
|
58
|
-
search_depth: Literal["basic", "advanced"] = None,
|
|
63
|
+
search_depth: Literal["basic", "advanced", "fast", "ultra-fast"] = None,
|
|
59
64
|
topic: Literal["general", "news", "finance"] = None,
|
|
60
65
|
time_range: Literal["day", "week", "month", "year"] = None,
|
|
61
66
|
start_date: str = None,
|
|
@@ -132,7 +137,7 @@ class AsyncTavilyClient:
|
|
|
132
137
|
|
|
133
138
|
async def search(self,
|
|
134
139
|
query: str,
|
|
135
|
-
search_depth: Literal["basic", "advanced"] = None,
|
|
140
|
+
search_depth: Literal["basic", "advanced", "fast", "ultra-fast"] = None,
|
|
136
141
|
topic: Literal["general", "news", "finance"] = None,
|
|
137
142
|
time_range: Literal["day", "week", "month", "year"] = None,
|
|
138
143
|
start_date: str = None,
|
|
@@ -12,7 +12,7 @@ class TavilyClient:
|
|
|
12
12
|
Tavily API client class.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
-
def __init__(self, api_key: Optional[str] = None, proxies: Optional[dict[str, str]] = None, api_base_url: Optional[str] = None, client_source: Optional[str] = None):
|
|
15
|
+
def __init__(self, api_key: Optional[str] = None, proxies: Optional[dict[str, str]] = None, api_base_url: Optional[str] = None, client_source: Optional[str] = None, project_id: Optional[str] = None):
|
|
16
16
|
if api_key is None:
|
|
17
17
|
api_key = os.getenv("TAVILY_API_KEY")
|
|
18
18
|
|
|
@@ -25,19 +25,22 @@ class TavilyClient:
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
resolved_proxies = {k: v for k, v in resolved_proxies.items() if v} or None
|
|
28
|
-
|
|
28
|
+
tavily_project = project_id or os.getenv("TAVILY_PROJECT")
|
|
29
|
+
|
|
29
30
|
self.base_url = api_base_url or "https://api.tavily.com"
|
|
30
31
|
self.api_key = api_key
|
|
31
32
|
self.proxies = resolved_proxies
|
|
33
|
+
|
|
32
34
|
self.headers = {
|
|
33
35
|
"Content-Type": "application/json",
|
|
34
36
|
"Authorization": f"Bearer {self.api_key}",
|
|
35
|
-
"X-Client-Source": client_source or "tavily-python"
|
|
37
|
+
"X-Client-Source": client_source or "tavily-python",
|
|
38
|
+
**({"X-Project-ID": tavily_project} if tavily_project else {})
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
def _search(self,
|
|
39
42
|
query: str,
|
|
40
|
-
search_depth: Literal["basic", "advanced"] = None,
|
|
43
|
+
search_depth: Literal["basic", "advanced", "fast", "ultra-fast"] = None,
|
|
41
44
|
topic: Literal["general", "news", "finance"] = None,
|
|
42
45
|
time_range: Literal["day", "week", "month", "year"] = None,
|
|
43
46
|
start_date: str = None,
|
|
@@ -116,7 +119,7 @@ class TavilyClient:
|
|
|
116
119
|
|
|
117
120
|
def search(self,
|
|
118
121
|
query: str,
|
|
119
|
-
search_depth: Literal["basic", "advanced"] = None,
|
|
122
|
+
search_depth: Literal["basic", "advanced", "fast", "ultra-fast"] = None,
|
|
120
123
|
topic: Literal["general", "news", "finance" ] = None,
|
|
121
124
|
time_range: Literal["day", "week", "month", "year"] = None,
|
|
122
125
|
start_date: str = None,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|