fix the missing embedder name in the error message when trying to disable the binary quantization

This commit is contained in:
Tamo 2024-09-19 10:58:45 +02:00
parent ca71b63ed1
commit 3f6301dbc9
3 changed files with 4 additions and 3 deletions

View File

@ -225,7 +225,7 @@ async fn try_to_disable_binary_quantization() {
} }
}, },
"error": { "error": {
"message": "`.embedders.todo.binaryQuantized`: Cannot disable the binary quantization", "message": "`.embedders.manual.binaryQuantized`: Cannot disable the binary quantization",
"code": "invalid_settings_embedders", "code": "invalid_settings_embedders",
"type": "invalid_request", "type": "invalid_request",
"link": "https://docs.meilisearch.com/errors#invalid_settings_embedders" "link": "https://docs.meilisearch.com/errors#invalid_settings_embedders"

View File

@ -1007,7 +1007,7 @@ impl<'a, 't, 'i> Settings<'a, 't, 'i> {
// updated config // updated config
EitherOrBoth::Both((name, (old, user_provided)), (_, new)) => { EitherOrBoth::Both((name, (old, user_provided)), (_, new)) => {
let was_quantized = old.binary_quantized.set().unwrap_or_default(); let was_quantized = old.binary_quantized.set().unwrap_or_default();
let settings_diff = SettingsDiff::from_settings(old, new)?; let settings_diff = SettingsDiff::from_settings(&name, old, new)?;
match settings_diff { match settings_diff {
SettingsDiff::Remove => { SettingsDiff::Remove => {
tracing::debug!( tracing::debug!(

View File

@ -140,6 +140,7 @@ pub struct WriteBackToDocuments {
impl SettingsDiff { impl SettingsDiff {
pub fn from_settings( pub fn from_settings(
embedder_name: &str,
old: EmbeddingSettings, old: EmbeddingSettings,
new: Setting<EmbeddingSettings>, new: Setting<EmbeddingSettings>,
) -> Result<Self, UserError> { ) -> Result<Self, UserError> {
@ -181,7 +182,7 @@ impl SettingsDiff {
&& matches!(new_binary_quantize, Setting::Set(false)) && matches!(new_binary_quantize, Setting::Set(false))
{ {
return Err(UserError::InvalidDisableBinaryQuantization { return Err(UserError::InvalidDisableBinaryQuantization {
embedder_name: String::from("todo"), embedder_name: embedder_name.to_string(),
}); });
} }