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

ChatRateLimiterWithRedis hangs with request_limit=1 #4

Open
Youssefbenhammouda opened this issue Jun 13, 2023 · 1 comment
Open

ChatRateLimiterWithRedis hangs with request_limit=1 #4

Youssefbenhammouda opened this issue Jun 13, 2023 · 1 comment

Comments

@Youssefbenhammouda
Copy link

rate_limiter = ChatRateLimiterWithRedis(
    request_limit=1, token_limit=40000, redis_url="redis://localhost:6379"
)
chat_params = {
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hello!"}],
}
with rate_limiter.limit(**chat_params):
    response = openai.ChatCompletion.create(**chat_params)

The code above is hanging at the context manager.
The Redis server is running and everything is okay, I am setting the number of requests to 1, this has to allow to me execute the openai.ChatCompletion.create because the code is synchronous so it means I am only doing one request, but it hangs waiting indefinitely.

@shobrook
Copy link
Owner

shobrook commented Sep 8, 2023

This should be fixed now with v0.3.0, but please let me know if it's not.

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

2 participants