mirror of
https://github.com/katanemo/plano.git
synced 2026-04-29 10:56:35 +02:00
log improvements and some code refactor (#379)
This commit is contained in:
parent
e79d16ec81
commit
39266b5084
10 changed files with 160 additions and 134 deletions
|
|
@ -2,7 +2,6 @@ use std::rc::Rc;
|
|||
|
||||
use crate::{configuration, llm_providers::LlmProviders};
|
||||
use configuration::LlmProvider;
|
||||
use log::debug;
|
||||
use rand::{seq::IteratorRandom, thread_rng};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -35,11 +34,9 @@ pub fn get_llm_provider(
|
|||
}
|
||||
|
||||
if llm_providers.default().is_some() {
|
||||
debug!("no llm provider found for hint, using default llm provider");
|
||||
return llm_providers.default().unwrap();
|
||||
}
|
||||
|
||||
debug!("no default llm found, using random llm provider");
|
||||
let mut rng = thread_rng();
|
||||
llm_providers
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use log::debug;
|
||||
use log::trace;
|
||||
|
||||
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
|
||||
#[allow(dead_code)]
|
||||
|
|
@ -9,7 +9,7 @@ pub enum Error {
|
|||
|
||||
#[allow(dead_code)]
|
||||
pub fn token_count(model_name: &str, text: &str) -> Result<usize, Error> {
|
||||
debug!("getting token count model={}", model_name);
|
||||
trace!("getting token count model={}", model_name);
|
||||
// Consideration: is it more expensive to instantiate the BPE object every time, or to contend the singleton?
|
||||
let bpe = tiktoken_rs::get_bpe_from_model(model_name).map_err(|_| Error::UnknownModel {
|
||||
model_name: model_name.to_string(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue