Skip to content

Commit

Permalink
Larger rate limit integers (#16047)
Browse files Browse the repository at this point in the history
Tokens per day may exceed the range of Postgres's 32-bit `integer` data
type.

Release Notes:

- N/A

Co-authored-by: Marshall <marshall@zed.dev>
  • Loading branch information
maxbrunsfeld and maxdeviant authored Aug 9, 2024
1 parent 0932818 commit 423c7b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE models
ALTER COLUMN max_requests_per_minute TYPE bigint,
ALTER COLUMN max_tokens_per_minute TYPE bigint,
ALTER COLUMN max_tokens_per_day TYPE bigint;
6 changes: 3 additions & 3 deletions crates/collab/src/llm/db/queries/providers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use std::str::FromStr;
use strum::IntoEnumIterator as _;

pub struct ModelRateLimits {
pub max_requests_per_minute: i32,
pub max_tokens_per_minute: i32,
pub max_tokens_per_day: i32,
pub max_requests_per_minute: i64,
pub max_tokens_per_minute: i64,
pub max_tokens_per_day: i64,
}

impl LlmDatabase {
Expand Down
6 changes: 3 additions & 3 deletions crates/collab/src/llm/db/tables/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ pub struct Model {
pub id: ModelId,
pub provider_id: ProviderId,
pub name: String,
pub max_requests_per_minute: i32,
pub max_tokens_per_minute: i32,
pub max_tokens_per_day: i32,
pub max_requests_per_minute: i64,
pub max_tokens_per_minute: i64,
pub max_tokens_per_day: i64,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
Expand Down

0 comments on commit 423c7b9

Please sign in to comment.