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

Rate Limit problem while running python ingest.py #7

Open
pedrohdemedeiros opened this issue Feb 24, 2023 · 3 comments
Open

Rate Limit problem while running python ingest.py #7

pedrohdemedeiros opened this issue Feb 24, 2023 · 3 comments

Comments

@pedrohdemedeiros
Copy link

Hi!

When trying to include my own notion page I am facing a ratelimit problem. I know that i can deal with it outside the system, but is there a way to limit the rate inside the ingest.py in order to solve it internally?

@hacksman
Copy link

hacksman commented Mar 6, 2023

same error

@g-adamante
Copy link

g-adamante commented Mar 15, 2023

I also got this error - a simple fix is using the RateLimiter lib on the OpenAIEmbeddings class, it looked like this:

@RateLimiter(max_calls=20, period=60)
def _embedding_func(self, text: str, *, engine: str) -> List[float]:
        """Call out to OpenAI's embedding endpoint."""
        # replace newlines, which can negatively affect performance.
        text = text.replace("\n", " ")
        return self.client.create(input=[text], engine=engine)["data"][0]["embedding"]

You can find open ai's rate limits here and adjust accordingly. For the free trial, it's 20 calls/minute, which makes things sloooow.

@qcgm1978
Copy link

qcgm1978 commented May 6, 2023

It doesn't work even adding @RateLimiter(max_calls=20, period=60)

The error message

Rate limit reached for default-global-with-image-limits in organization org-EwRRwtrDgN3yDxZ9dBI4r3eT on requests per min. Limit: 60 / min. Please try again in 1s. Contact us through our help center at help.openai.com 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.

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

4 participants