lmkit 0.1.1

Multi-provider AI API client (OpenAI, Anthropic, Google Gemini, Aliyun, Ollama, Zhipu; chat, embed incl. Gemini, rerank, image, audio stubs)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! 小工具函数

#[cfg(any(test, feature = "embed"))]
pub(crate) fn normalize_for_embedding(text: &str) -> String {
    text.split_whitespace().collect::<Vec<_>>().join(" ")
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn normalize_trims_and_collapses_whitespace() {
        assert_eq!(normalize_for_embedding("  a \n\t b  "), "a b");
    }
}