-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply rate limits in LLM service (#15997)
Release Notes: - N/A --------- Co-authored-by: Marshall <[email protected]> Co-authored-by: Marshall Bowers <[email protected]>
- Loading branch information
1 parent
2bc5037
commit 06625bf
Showing
21 changed files
with
976 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
crates/collab/migrations_llm.sqlite/20240806182921_test_schema.sql
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 11 additions & 7 deletions
18
crates/collab/migrations_llm/20240806213401_create_usages.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
create table usage_measures ( | ||
id serial primary key, | ||
name text not null | ||
); | ||
|
||
create unique index uix_usage_measures_on_name on usage_measures (name); | ||
|
||
create table if not exists usages ( | ||
id serial primary key, | ||
user_id integer not null, | ||
model_id integer not null references models (id) on delete cascade, | ||
requests_this_minute integer not null default 0, | ||
tokens_this_minute bigint not null default 0, | ||
requests_this_day integer not null default 0, | ||
tokens_this_day bigint not null default 0, | ||
requests_this_month integer not null default 0, | ||
tokens_this_month bigint not null default 0 | ||
measure_id integer not null references usage_measures (id) on delete cascade, | ||
timestamp timestamp without time zone not null, | ||
buckets bigint[] not null | ||
); | ||
|
||
create index ix_usages_on_user_id on usages (user_id); | ||
create index ix_usages_on_model_id on usages (model_id); | ||
create unique index uix_usages_on_user_id_model_id on usages (user_id, model_id); | ||
create unique index uix_usages_on_user_id_model_id_measure_id on usages (user_id, model_id, measure_id); |
Oops, something went wrong.