diff --git a/meilisearch-types/src/settings.rs b/meilisearch-types/src/settings.rs index b0dee69a3..244fbffa2 100644 --- a/meilisearch-types/src/settings.rs +++ b/meilisearch-types/src/settings.rs @@ -318,6 +318,21 @@ impl Settings { _kind: PhantomData, } } + + pub fn validate(self) -> Result { + self.validate_embedding_settings() + } + + fn validate_embedding_settings(mut self) -> Result { + let Setting::Set(mut configs) = self.embedders else { return Ok(self) }; + for (name, config) in configs.iter_mut() { + let config_to_check = std::mem::take(config); + let checked_config = milli::update::validate_embedding_settings(config_to_check, name)?; + *config = checked_config + } + self.embedders = Setting::Set(configs); + Ok(self) + } } #[derive(Debug, Clone, Serialize, Deserialize)]