tavily-python 0.7.17__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.17 → tavily_python-0.7.18}/PKG-INFO +1 -1
- {tavily_python-0.7.17 → tavily_python-0.7.18}/setup.py +1 -1
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/async_tavily.py +7 -2
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/tavily.py +6 -3
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily_python.egg-info/PKG-INFO +1 -1
- {tavily_python-0.7.17 → tavily_python-0.7.18}/LICENSE +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/README.md +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/setup.cfg +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/__init__.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/config.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/errors.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/hybrid_rag/__init__.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/hybrid_rag/hybrid_rag.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily/utils.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily_python.egg-info/SOURCES.txt +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily_python.egg-info/dependency_links.txt +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily_python.egg-info/requires.txt +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tavily_python.egg-info/top_level.txt +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tests/test_crawl.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tests/test_errors.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tests/test_map.py +0 -0
- {tavily_python-0.7.17 → tavily_python-0.7.18}/tests/test_research.py +0 -0
- {tavily_python-0.7.17 → 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
|
|
@@ -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,14 +25,17 @@ 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,
|
|
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
|