rotemweiss57 / gpt-newspaper

GPT based autonomous agent designed to create personalized newspapers tailored to user preferences.
https://tavily.com
MIT License
1.19k stars 166 forks source link

400 Client Error: Bad Request for url: https://api.tavily.com/search #6

Closed robertcedwards closed 9 months ago

robertcedwards commented 10 months ago

Just cloned and started the creation process, get that error and it hangs. MacOS: 14.2.1 (23C71) Python3.9

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.tavily.com/search 127.0.0.1 - - [25/Jan/2024 11:03:57] "POST /generate_newspaper HTTP/1.1" 500 -

rotemweiss57 commented 10 months ago

Hi @robertcedwards just shooting in the dark, was one of your topics les then 4 characters? I will need to fix it on our end in the news api, but as for now tavily take a minimum of 4 chars.

robertcedwards commented 10 months ago

Interesting, just Web3 was a 4-char. Let me make sure I properly exported the API keys too, but I think it already made an auth'd call.

rotemweiss57 commented 10 months ago

perfect. lmk know it works with greater than 4 char topics and I'll update you once fixed.

robertcedwards commented 10 months ago

I tried it with just a single topic that had more chars and it worked. Thanks for the help and persistence!

robertcedwards commented 10 months ago

Also, running into some rate limits, not sure if there are some error handling issues here, don't think it will try again.

File "/Users/robertedwards/Documents/Projects/gpt-newspaper/gpt-newspaper/lib/python3.9/site-packages/openai/_base_client.py", line 959, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.RateLimitError: Error code: 429 - {'error': {'message': 'Rate limit reached for gpt-4 in organization org-4do9SrRAEt8fzaKFeoFMaM1A on tokens per min (TPM): Limit 10000, Used 9979, Requested 2920. Please try again in 17.394s. Visit https://platform.openai.com/account/rate-limits to learn more.', 'type': 'tokens', 'param': None, 'code': 'rate_limit_exceeded'}}
shaojun commented 10 months ago

I've seen this error as well, confirmed the cause is the chinese characters: image

had some web search, have not get solution yet.

badcom commented 10 months ago

I got the same error. I had 3 words in the search. 2 with 6 letters and 1 with 4. None of them had any special characters. Removing the word with 4 letters resolved it.

flyspirit99 commented 10 months ago

I got a similar error. After double checked api keys and restarted my computer, everything is fine.