Closed kattapug closed 2 weeks ago
Hey @kattapug ! You can simply use the search method like this:
from tavily import TavilyClient
tavily = TavilyClient(api_key="YOUR_API_KEY")
# Call the search method with your params:
tavily.search(query="your search query", search_depth="basic", include_answer=False, include_images=True, max_results=5)
In the example above I'm ignoring the last two params since they already default to empty list behind the scenes. Feel free to checkout the documentation here: https://docs.tavily.com/docs/tavily-api/introduction
Thanks @assafelovic , can you share an example to pass multiple include domains, we tried passing , multiple comma separated values but did not seem to work
Hi
Testing the below code.
from tavily import TavilyClient tavily = TavilyClient(api_key="tvly-xxxxxxxxxxxx")
tavily.search(query="Should I invest in Apple right now?", search_depth="basic", include_answer=False, include_images=True, max_results=5)
ImportError Traceback (most recent call last) c:\Dev\sima\tavily.py in line 1 ----> 1 from tavily import TavilyClient 2 tavily = TavilyClient(api_key="tvly-xxxxx") 3 # Call the search method with your params:
File c:\Dev\sima\tavily.py:1 ----> 1 from tavily import TavilyClient 2 tavily = TavilyClient(api_key="tvly-xxxx") 3 # Call the search method with your params:
ImportError: cannot import name 'TavilyClient' from partially initialized module 'tavily' (most likely due to a circular import) (c:\Dev\sima\tavily.py)
Any suggestion how to fix this.
Thanks @assafelovic , can you share an example to pass multiple include domains, we tried passing , multiple comma separated values but did not seem to work
@karrtikiyer-tw Hello, currently facing this issue as well, did you find a way to make it work? I have defined it as below, basing my code as showcased by LangChain
from langchain_community.tools.tavily_search import TavilySearchResults
tools = [TavilySearchResults(max_results=5, include_domains=["example.com"])]
tool_executor = ToolExecutor(tools)
model = ChatOpenAI(temperature=0, streaming=True)
Hi
Testing the below code.
from tavily import TavilyClient tavily = TavilyClient(api_key="tvly-xxxxxxxxxxxx")
Call the search method with your params:
tavily.search(query="Should I invest in Apple right now?", search_depth="basic", include_answer=False, include_images=True, max_results=5)
Error
ImportError Traceback (most recent call last) c:\Dev\sima\tavily.py in line 1 ----> 1 from tavily import TavilyClient 2 tavily = TavilyClient(api_key="tvly-xxxxx") 3 # Call the search method with your params:
File c:\Dev\sima\tavily.py:1 ----> 1 from tavily import TavilyClient 2 tavily = TavilyClient(api_key="tvly-xxxx") 3 # Call the search method with your params:
ImportError: cannot import name 'TavilyClient' from partially initialized module 'tavily' (most likely due to a circular import) (c:\Dev\sima\tavily.py)
Any suggestion how to fix this.
@kattapug The circular import error is being caused by your file name which is similar to the from tavily import TavilyClient
. Rename your python file name from tavily.py to something else like tavily_test.py.
Hi
This is interesting and just started playing around with it.
Quick question I am struggling to see which part of the code section to change to use the below parameters for the example files. Company Information.py and OpenAI Assistant.py. I would like to do some testing to understand how it works.
{ "api_key": "your api key", "query": "your search query", "search_depth": "basic", "include_answer": false, "include_images": true, "include_raw_content": false, "max_results": 5, "include_domains": [], "exclude_domains": [] }
Thanks