tavily-python 0.2.2__tar.gz → 0.2.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tavily-python
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Python wrapper for the Tavily API
5
5
  Home-page: https://github.com/assafelovic/tavily-python
6
6
  Author: Assaf Elovic
@@ -29,8 +29,8 @@ Usage
29
29
 
30
30
  .. code-block:: python
31
31
 
32
- from tavily import Client
33
- tavily = Client(api_key="YOUR_API_KEY")
32
+ from tavily import TavilyClient
33
+ tavily = TavilyClient(api_key="YOUR_API_KEY")
34
34
  # For basic search:
35
35
  tavily.search(query="Should I invest in Apple right now?")
36
36
  # For advanced search:
@@ -58,9 +58,8 @@ The ``Client`` class is the entry point to interacting with the Tavily API. Kick
58
58
  Methods
59
59
  ~~~~~~~
60
60
 
61
- - ``search(query, search_depth, **kwargs)``: Performs a search using the specified query. The depth of the search can be controlled by the `search_depth` parameter.
62
- - ``get_search_context(query, search_depth, max_tokens, **kwargs)``: Performs a search and returns a string of content and sources within token limit. Useful for getting only related content from retrieved websites
63
- without having to deal with context extraction and token management.
61
+ - ``search(query, search_depth, **kwargs)``: Performs a search using the specified query. The depth of the search can be controlled by the ``search_depth`` parameter.
62
+ - ``get_search_context(query, search_depth, max_tokens, **kwargs)``: Performs a search and returns a string of content and sources within token limit. Useful for getting only related content from retrieved websites without having to deal with context extraction and token management.
64
63
  - ``qna_search(query, **kwargs)``: Performs a search and returns a string containing an answer to the original query including relevant sources. Optimal to be used as a tool for AI agents.
65
64
 
66
65
  Keyword Arguments
@@ -72,6 +71,7 @@ Keyword Arguments
72
71
  - ``exclude_domains`` (list): A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains.
73
72
  - ``include_answer`` (bool): Whether or not to include answers in the search results. Default is False.
74
73
  - ``include_raw_content`` (bool): Whether or not to include raw content in the search results. Default is False.
74
+ - ``include_images`` (bool): Whether or not to include images in the search results. Default is False.
75
75
 
76
76
  Both methods internally call the ``_search`` method to communicate with the API.
77
77
 
@@ -16,8 +16,8 @@ Usage
16
16
 
17
17
  .. code-block:: python
18
18
 
19
- from tavily import Client
20
- tavily = Client(api_key="YOUR_API_KEY")
19
+ from tavily import TavilyClient
20
+ tavily = TavilyClient(api_key="YOUR_API_KEY")
21
21
  # For basic search:
22
22
  tavily.search(query="Should I invest in Apple right now?")
23
23
  # For advanced search:
@@ -45,9 +45,8 @@ The ``Client`` class is the entry point to interacting with the Tavily API. Kick
45
45
  Methods
46
46
  ~~~~~~~
47
47
 
48
- - ``search(query, search_depth, **kwargs)``: Performs a search using the specified query. The depth of the search can be controlled by the `search_depth` parameter.
49
- - ``get_search_context(query, search_depth, max_tokens, **kwargs)``: Performs a search and returns a string of content and sources within token limit. Useful for getting only related content from retrieved websites
50
- without having to deal with context extraction and token management.
48
+ - ``search(query, search_depth, **kwargs)``: Performs a search using the specified query. The depth of the search can be controlled by the ``search_depth`` parameter.
49
+ - ``get_search_context(query, search_depth, max_tokens, **kwargs)``: Performs a search and returns a string of content and sources within token limit. Useful for getting only related content from retrieved websites without having to deal with context extraction and token management.
51
50
  - ``qna_search(query, **kwargs)``: Performs a search and returns a string containing an answer to the original query including relevant sources. Optimal to be used as a tool for AI agents.
52
51
 
53
52
  Keyword Arguments
@@ -59,6 +58,7 @@ Keyword Arguments
59
58
  - ``exclude_domains`` (list): A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains.
60
59
  - ``include_answer`` (bool): Whether or not to include answers in the search results. Default is False.
61
60
  - ``include_raw_content`` (bool): Whether or not to include raw content in the search results. Default is False.
61
+ - ``include_images`` (bool): Whether or not to include images in the search results. Default is False.
62
62
 
63
63
  Both methods internally call the ``_search`` method to communicate with the API.
64
64
 
@@ -5,7 +5,7 @@ with open('README.rst', 'r', encoding='utf-8') as f:
5
5
 
6
6
  setup(
7
7
  name='tavily-python',
8
- version='0.2.2',
8
+ version='0.2.4',
9
9
  url='https://github.com/assafelovic/tavily-python',
10
10
  author='Assaf Elovic',
11
11
  author_email='assaf.elovic@gmail.com',
@@ -0,0 +1,2 @@
1
+ from .tavily import TavilyClient
2
+ from .tavily import Client
@@ -1,14 +1,14 @@
1
1
  import requests
2
2
  import json
3
+ import warnings
3
4
  from .utils import get_max_items_from_list
4
5
 
5
- class Client:
6
+ class TavilyClient:
6
7
  def __init__(self, api_key):
7
8
  self.base_url = "https://api.tavily.com/search"
8
9
  self.api_key = api_key
9
10
  self.headers = {
10
11
  "Content-Type": "application/json",
11
- # any other headers you want
12
12
  }
13
13
 
14
14
  def _search(self, query, search_depth="basic", max_results=10,
@@ -61,3 +61,8 @@ class Client:
61
61
  """
62
62
  search_result = self._search(query, search_depth=search_depth, include_answer=True, **kwargs)
63
63
  return search_result.get("answer", "")
64
+
65
+ class Client(TavilyClient):
66
+ def __init__(self, *args, **kwargs):
67
+ warnings.warn("Client is deprecated, please use TavilyClient instead", DeprecationWarning, stacklevel=2)
68
+ super().__init__(*args, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tavily-python
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Python wrapper for the Tavily API
5
5
  Home-page: https://github.com/assafelovic/tavily-python
6
6
  Author: Assaf Elovic
@@ -29,8 +29,8 @@ Usage
29
29
 
30
30
  .. code-block:: python
31
31
 
32
- from tavily import Client
33
- tavily = Client(api_key="YOUR_API_KEY")
32
+ from tavily import TavilyClient
33
+ tavily = TavilyClient(api_key="YOUR_API_KEY")
34
34
  # For basic search:
35
35
  tavily.search(query="Should I invest in Apple right now?")
36
36
  # For advanced search:
@@ -58,9 +58,8 @@ The ``Client`` class is the entry point to interacting with the Tavily API. Kick
58
58
  Methods
59
59
  ~~~~~~~
60
60
 
61
- - ``search(query, search_depth, **kwargs)``: Performs a search using the specified query. The depth of the search can be controlled by the `search_depth` parameter.
62
- - ``get_search_context(query, search_depth, max_tokens, **kwargs)``: Performs a search and returns a string of content and sources within token limit. Useful for getting only related content from retrieved websites
63
- without having to deal with context extraction and token management.
61
+ - ``search(query, search_depth, **kwargs)``: Performs a search using the specified query. The depth of the search can be controlled by the ``search_depth`` parameter.
62
+ - ``get_search_context(query, search_depth, max_tokens, **kwargs)``: Performs a search and returns a string of content and sources within token limit. Useful for getting only related content from retrieved websites without having to deal with context extraction and token management.
64
63
  - ``qna_search(query, **kwargs)``: Performs a search and returns a string containing an answer to the original query including relevant sources. Optimal to be used as a tool for AI agents.
65
64
 
66
65
  Keyword Arguments
@@ -72,6 +71,7 @@ Keyword Arguments
72
71
  - ``exclude_domains`` (list): A list of domains to specifically exclude from the search results. Default is None, which doesn't exclude any domains.
73
72
  - ``include_answer`` (bool): Whether or not to include answers in the search results. Default is False.
74
73
  - ``include_raw_content`` (bool): Whether or not to include raw content in the search results. Default is False.
74
+ - ``include_images`` (bool): Whether or not to include images in the search results. Default is False.
75
75
 
76
76
  Both methods internally call the ``_search`` method to communicate with the API.
77
77
 
@@ -1 +0,0 @@
1
- from .tavily import Client
File without changes