make ratelimit section optional (#168)

This commit is contained in:
Adil Hafeez 2024-10-09 19:53:00 -07:00 committed by GitHub
parent f9e3a052fc
commit 6b70768170
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 20 deletions

View file

@ -944,7 +944,7 @@ impl StreamContext {
) -> Result<(), ratelimit::Error> {
if let Some(selector) = self.ratelimit_selector.take() {
// Tokenize and Ratelimit.
if let Ok(token_count) = tokenizer::token_count(model, &json_string) {
if let Ok(token_count) = tokenizer::token_count(model, json_string) {
ratelimit::ratelimits(None).read().unwrap().check_limit(
model.to_owned(),
selector,