lm_studio_api_extended/embedding/embed_model.rs
1/// EmbeddingModel represents supported embedding models for generating embeddings.
2/// It includes predefined models and allows specifying a custom model by name.
3use crate::prelude::*;
4
5#[derive(Debug, Clone, From, Eq, PartialEq, Serialize, Deserialize)]
6pub enum EmbeddingModel {
7 /// Predefined model: all-MiniLM-L6. This is a commonly used
8 // model for text embeddings.
9 #[serde(rename = "text-embedding-all-minilm-l6-v2-embedding")]
10 AllMiniLmL6,
11
12 /// Custom model name as String. Allows users to specify any
13 /// model available in LM Studio.
14 #[from]
15 Custom(String)
16}
17
18/// Now we can .to_string() a model cleanly, e.g. for CLI arguments,
19/// logging, or diagnostics.
20impl std::fmt::Display for EmbeddingModel {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 Self::AllMiniLmL6 => write!(f, "text-embedding-all-minilm-l6-v2-embedding"),
24 Self::Custom(s) => write!(f, "{s}")
25 }
26 }
27}