Skip to content

Commit

Permalink
fix: tokenize OpenAI encode exception #1250 (#1253)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikbry authored Sep 16, 2024
1 parent bf3f1b6 commit 4f5cc4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/tokenizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn encode_gpt(text: String) -> Result<Vec<Rank>, String> {
}

pub fn encode(text: String, model: String, encoding: Option<String>) -> Result<Vec<Rank>, String> {
if model.starts_with("gpt") {
if model.to_lowercase().starts_with("gpt") {
return encode_gpt(text);
}
if encoding.is_some() {
Expand Down
2 changes: 1 addition & 1 deletion webapp/native/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ impl ProvidersManager {
let encoded = match encode(text, model, None) {
Ok(e) => { e }
Err(err) => {
return Err(format!("LLM encode error: {:?}", err));
return Err(format!("LLM OpenAI encode error: {:?}", err));
}
};
let tokens: Vec<u64> = encoded
Expand Down

0 comments on commit 4f5cc4c

Please sign in to comment.