phidatahq / phidata

Build AI Assistants with memory, knowledge and tools.
https://docs.phidata.com
Mozilla Public License 2.0
11.03k stars 1.63k forks source link

Error in Tavily API #180

Closed Kyros5 closed 4 months ago

Kyros5 commented 4 months ago

HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.tavily.com/search

Traceback: File "C:\Users\LENOVO\Documents\Python\Test\source\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 584, in _run_script exec(code, module.dict) File "C:\Users\LENOVO\Documents\Python\Test\phidata\cookbook\llms\groq\research\app.py", line 79, in main() File "C:\Users\LENOVO\Documents\Python\Test\phidata\cookbook\llms\groq\research\app.py", line 58, in main tavily_search_results = TavilyTools().web_search_using_tavily(report_topic) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\Documents\Python\Test\source\Lib\site-packages\phi\tools\tavily.py", line 55, in web_search_using_tavily response = self.client.search( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\Documents\Python\Test\source\Lib\site-packages\tavily\tavily.py", line 48, in search return self._search(query, search_depth=search_depth, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\Documents\Python\Test\source\Lib\site-packages\tavily\tavily.py", line 42, in _search response.raise_for_status() # Raises a HTTPError if the HTTP request returned an unsuccessful status code ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\Documents\Python\Test\source\Lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self)

ysolanky commented 4 months ago

Make sure you are exporting the Tavily API key correctly

export TAVILY_API_KEY="tvly-***"

ashpreetbedi commented 4 months ago

@Kyros5 ^

Kyros5 commented 4 months ago

thank you for your response @ashpreetbedi export it doesn't work so i used set but it still don't working

set TAVILY_API_KEY="tvly-**********"

ysolanky commented 4 months ago

@Kyros5 on windows I'd recommend using Powershell. Checkout how to set an environment variable here

byTbyPy commented 4 months ago

$env:TAVILY_API_KEY ="tvly-" use this in WindowsPOWERSHELL!!! @Kyros5

ashpreetbedi commented 4 months ago

@Kyros5 is this fixed?

Kyros5 commented 4 months ago

@ashpreetbedi No, i don't know how.

ashpreetbedi commented 4 months ago

@Kyros5 for now can you do TavilyTools(api_key=<api_key>) just to test it works this way?

ashpreetbedi commented 4 months ago

@Kyros5 shall we close this?

Kyros5 commented 4 months ago

@ashpreetbedi yes i am installing wsl on windows