mirror of
https://github.com/NovaOSS/nova-python.git
synced 2024-11-25 18:23:59 +01:00
did a little refactoring
This commit is contained in:
parent
ccbaa4e247
commit
3a210d7b5b
21
src/lib.rs
21
src/lib.rs
|
@ -231,25 +231,16 @@ impl ChatResponse {
|
|||
}
|
||||
|
||||
fn model_is_compatible(endpoint: &Endpoints, model: &Models) -> bool {
|
||||
if endpoint == &Endpoints::ChatCompletion {
|
||||
if [Models::Gpt3, Models::Gpt4].contains(model) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
let chat_models = [Models::Gpt3, Models::Gpt4];
|
||||
let moderation_models = [Models::ModerationStable, Models::ModerationLatest];
|
||||
|
||||
else if endpoint == &Endpoints::Moderation {
|
||||
if [Models::ModerationStable, Models::ModerationLatest].contains(model) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
match endpoint {
|
||||
Endpoints::ChatCompletion => chat_models.contains(model),
|
||||
Endpoints::Moderation => moderation_models.contains(model),
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
fn key_is_valid(api_key: &str) -> bool {
|
||||
if !api_key.starts_with("nv-") {
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue