Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: Failed to fetch data from API: 429 #18

Open
ammaraziz opened this issue Apr 17, 2023 · 12 comments
Open

Exception: Failed to fetch data from API: 429 #18

ammaraziz opened this issue Apr 17, 2023 · 12 comments

Comments

@ammaraziz
Copy link

Cool package!

I am receiving this error:

Research question: What mutations in the N gene of sars cov 2 are involved in rapid antigen test failurre?
Auto Researcher initiated!
Generating keyword combinations...
Keyword combinations generated!
Fetching top 20 papers...

Traceback (most recent call last):
File "", line 1, in
File "/home/amar/miniconda3/envs/write-the/lib/python3.9/site-packages/autoresearcher/workflows/literature_review/literature_review.py", line 85, in literature_review
top_papers = SemanticScholar.fetch_and_sort_papers(search_query, keyword_combinations=keyword_combinations, year_range="2000-2023")
File "/home/amar/miniconda3/envs/write-the/lib/python3.9/site-packages/autoresearcher/data_sources/web_apis/semantic_scholar_loader.py", line 27, in fetch_and_sort_papers
papers.extend(self.fetch_data(combination, limit, year_range))
File "/home/amar/miniconda3/envs/write-the/lib/python3.9/site-packages/autoresearcher/data_sources/web_apis/semantic_scholar_loader.py", line 18, in fetch_data
data = self.make_request("", params=params)
File "/home/amar/miniconda3/envs/write-the/lib/python3.9/site-packages/autoresearcher/data_sources/web_apis/base_web_api_data_loader.py", line 20, in make_request
raise Exception(f"Failed to fetch data from API: {response.status_code}")
Exception: Failed to fetch data from API: 429

My code:

from autoresearcher import literature_review

research_question = "What mutations in the N gene of sars cov 2 are involved in rapid antigen test failurre?"
researcher = literature_review(research_question)
researcher = literature_review(research_question, output_file="my_literature_review.txt")

429 response suggests too many queries.

@ammaraziz
Copy link
Author

This is an issue on my end with SSL certs that I think was resulting in the above 429 error. Closing :)

@ammaraziz
Copy link
Author

Sorry opening again. I have a new error:

openai.error.RateLimitError: Rate limit reached for default-gpt-3.5-turbo in organization org-sKBYXnh22DxRDpCw42jRYT2E on requests per min. Limit: 3 / min. Please try again in 20s. Contact [email protected] if you continue to have issues. Please add a payment method to your account to increase your rate limit. Visit https://platform.openai.com/account/billing to add a payment method.

@ammaraziz ammaraziz reopened this Apr 17, 2023
@eimenhmdt
Copy link
Owner

Hey @ammaraziz! Are you the owner of the OpenAI organization you're using the API key from?

@ammaraziz
Copy link
Author

It's a personal account with no org attached.

@GilbertHan1011
Copy link

I encountered the same two problems. Please let me know if there are any solutions。

@eimenhmdt
Copy link
Owner

Try adding a payment method to your account to increase your rate limit, as the error suggests. Let me know if this solves the issue.

@GilbertHan1011
Copy link

I am not a US resident and it is a bit difficult to provide payment methods that are recognized by open ai. It would be nice if it could be done by changing the code (e.g. offering the option to limit to 3 times per minute)

@eimenhmdt
Copy link
Owner

I'm working on adding the option to use an open source model that is free!

@GilbertHan1011
Copy link

Thank you for your efforts!

@sjssmits
Copy link

sjssmits commented Apr 27, 2023

I have the same problem, other API requests work normally.

@adamengberg
Copy link

This is an issue on my end with SSL certs that I think was resulting in the above 429 error. Closing :)

I have this problem as well. how did you solve it?

@sjssmits
Copy link

It's working again, reason unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants