mirror of
https://github.com/katanemo/plano.git
synced 2026-04-25 00:36:34 +02:00
When using ollama token count was not coming in (#375)
When using ollama token count was not coming in resulting in token count and other metrics to show up as zero. This was not causing tracing to break.
This commit is contained in:
parent
fcd8cfb9fc
commit
6887d52750
1 changed files with 7 additions and 4 deletions
|
|
@ -483,11 +483,14 @@ impl HttpContext for StreamContext {
|
|||
let tokens_str = chat_completions_chunk_response_events.to_string();
|
||||
//HACK: add support for tokenizing mistral and other models
|
||||
//filed issue https://github.com/katanemo/arch/issues/222
|
||||
if model.as_ref().unwrap().starts_with("mistral")
|
||||
|| model.as_ref().unwrap().starts_with("ministral")
|
||||
{
|
||||
model = Some("gpt-4".to_string());
|
||||
if !model.as_ref().unwrap().starts_with("gpt") {
|
||||
warn!(
|
||||
"tiktoken_rs: unsupported model: {}, using gpt-4 to compute token count",
|
||||
model.as_ref().unwrap()
|
||||
);
|
||||
}
|
||||
model = Some("gpt-4".to_string());
|
||||
|
||||
let token_count =
|
||||
match tokenizer::token_count(model.as_ref().unwrap().as_str(), tokens_str.as_str())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue