use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ChromaConfig {
#[serde(default = "default_collection_name")]
pub collection_name: String,
pub path: Option<String>,
pub host: Option<String>,
pub port: Option<u16>,
pub api_key: Option<String>,
pub tenant: Option<String>,
}
fn default_collection_name() -> String {
"neomemx".to_string()
}
impl Default for ChromaConfig {
fn default() -> Self {
Self {
collection_name: default_collection_name(),
path: Some("/tmp/chroma".to_string()),
host: None,
port: None,
api_key: None,
tenant: None,
}
}
}
impl ChromaConfig {
pub fn get_base_url(&self) -> Option<String> {
if let (Some(host), Some(port)) = (&self.host, &self.port) {
Some(format!("http://{}:{}", host, port))
} else {
None
}
}
}