From a0d421ffc83ba97a1f99f1ba9f85a1689941d171 Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 30 Jul 2024 15:04:50 +0800 Subject: feat: export agent variable as `LLM_AGENT_VAR_*` (#766) --- src/utils/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/utils/mod.rs') diff --git a/src/utils/mod.rs b/src/utils/mod.rs index a3aef22..6f89fbe 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -38,6 +38,10 @@ pub fn get_env_name(key: &str) -> String { format!("{}_{key}", env!("CARGO_CRATE_NAME"),).to_ascii_uppercase() } +pub fn normalize_env_name(value: &str) -> String { + value.replace('-', "_").to_ascii_uppercase() +} + pub fn estimate_token_length(text: &str) -> usize { let words: Vec<&str> = text.unicode_words().collect(); let mut output: f32 = 0.0; -- cgit v1.2.3