fix model warning and use openwebui for preference based router demo

This commit is contained in:
Adil Hafeez 2025-05-30 12:29:56 -07:00
parent fffa837a06
commit 176f039bbc
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
4 changed files with 18 additions and 16 deletions

View file

@ -12,10 +12,15 @@ pub fn token_count(model_name: &str, text: &str) -> Result<usize, String> {
"tiktoken_rs: unsupported model: {}, using gpt-4 to compute token count",
model_name
);
"gpt-4"
}
true => model_name,
true => {
if model_name.starts_with("gpt-4.1") {
"gpt-4o"
} else {
model_name
}
}
};
// Consideration: is it more expensive to instantiate the BPE object every time, or to contend the singleton?