Apply rate limits in LLM service (#15997)
Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
2bc503771b
commit
06625bfe94
21 changed files with 983 additions and 227 deletions
|
@ -1,17 +1,15 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use pretty_assertions::assert_eq;
|
||||
use rpc::LanguageModelProvider;
|
||||
|
||||
use crate::llm::db::LlmDatabase;
|
||||
use crate::test_both_llm_dbs;
|
||||
use crate::test_llm_db;
|
||||
|
||||
test_both_llm_dbs!(
|
||||
test_llm_db!(
|
||||
test_initialize_providers,
|
||||
test_initialize_providers_postgres,
|
||||
test_initialize_providers_sqlite
|
||||
test_initialize_providers_postgres
|
||||
);
|
||||
|
||||
async fn test_initialize_providers(db: &Arc<LlmDatabase>) {
|
||||
async fn test_initialize_providers(db: &mut LlmDatabase) {
|
||||
let initial_providers = db.list_providers().await.unwrap();
|
||||
assert_eq!(initial_providers, vec![]);
|
||||
|
||||
|
@ -22,9 +20,13 @@ async fn test_initialize_providers(db: &Arc<LlmDatabase>) {
|
|||
|
||||
let providers = db.list_providers().await.unwrap();
|
||||
|
||||
let provider_names = providers
|
||||
.into_iter()
|
||||
.map(|provider| provider.name)
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(provider_names, vec!["anthropic".to_string()]);
|
||||
assert_eq!(
|
||||
providers,
|
||||
&[
|
||||
LanguageModelProvider::Anthropic,
|
||||
LanguageModelProvider::Google,
|
||||
LanguageModelProvider::OpenAi,
|
||||
LanguageModelProvider::Zed
|
||||
]
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue