mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
multimodal
experimental feature
This commit is contained in:
parent
e54fc59248
commit
c1a132fa06
6 changed files with 39 additions and 0 deletions
|
@ -144,6 +144,19 @@ impl RoFeatures {
|
||||||
.into())
|
.into())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn check_multimodal(&self, disabled_action: &'static str) -> Result<()> {
|
||||||
|
if self.runtime.multimodal {
|
||||||
|
Ok(())
|
||||||
|
} else {
|
||||||
|
Err(FeatureNotEnabledError {
|
||||||
|
disabled_action,
|
||||||
|
feature: "multimodal",
|
||||||
|
issue_link: "https://github.com/orgs/meilisearch/discussions/846",
|
||||||
|
}
|
||||||
|
.into())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FeatureData {
|
impl FeatureData {
|
||||||
|
|
|
@ -21,6 +21,7 @@ pub struct RuntimeTogglableFeatures {
|
||||||
pub get_task_documents_route: bool,
|
pub get_task_documents_route: bool,
|
||||||
pub composite_embedders: bool,
|
pub composite_embedders: bool,
|
||||||
pub chat_completions: bool,
|
pub chat_completions: bool,
|
||||||
|
pub multimodal: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Debug, Clone, Copy)]
|
#[derive(Default, Debug, Clone, Copy)]
|
||||||
|
|
|
@ -197,6 +197,7 @@ struct Infos {
|
||||||
experimental_max_number_of_batched_tasks: usize,
|
experimental_max_number_of_batched_tasks: usize,
|
||||||
experimental_limit_batched_tasks_total_size: u64,
|
experimental_limit_batched_tasks_total_size: u64,
|
||||||
experimental_network: bool,
|
experimental_network: bool,
|
||||||
|
experimental_multimodal: bool,
|
||||||
experimental_chat_completions: bool,
|
experimental_chat_completions: bool,
|
||||||
experimental_get_task_documents_route: bool,
|
experimental_get_task_documents_route: bool,
|
||||||
experimental_composite_embedders: bool,
|
experimental_composite_embedders: bool,
|
||||||
|
@ -303,6 +304,7 @@ impl Infos {
|
||||||
get_task_documents_route,
|
get_task_documents_route,
|
||||||
composite_embedders,
|
composite_embedders,
|
||||||
chat_completions,
|
chat_completions,
|
||||||
|
multimodal,
|
||||||
} = features;
|
} = features;
|
||||||
|
|
||||||
// We're going to override every sensible information.
|
// We're going to override every sensible information.
|
||||||
|
@ -322,6 +324,7 @@ impl Infos {
|
||||||
experimental_reduce_indexing_memory_usage,
|
experimental_reduce_indexing_memory_usage,
|
||||||
experimental_network: network,
|
experimental_network: network,
|
||||||
experimental_chat_completions: chat_completions,
|
experimental_chat_completions: chat_completions,
|
||||||
|
experimental_multimodal: multimodal,
|
||||||
experimental_get_task_documents_route: get_task_documents_route,
|
experimental_get_task_documents_route: get_task_documents_route,
|
||||||
experimental_composite_embedders: composite_embedders,
|
experimental_composite_embedders: composite_embedders,
|
||||||
experimental_embedding_cache_entries,
|
experimental_embedding_cache_entries,
|
||||||
|
|
|
@ -54,6 +54,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
|
||||||
get_task_documents_route: Some(false),
|
get_task_documents_route: Some(false),
|
||||||
composite_embedders: Some(false),
|
composite_embedders: Some(false),
|
||||||
chat_completions: Some(false),
|
chat_completions: Some(false),
|
||||||
|
multimodal: Some(false),
|
||||||
})),
|
})),
|
||||||
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
||||||
{
|
{
|
||||||
|
@ -100,6 +101,8 @@ pub struct RuntimeTogglableFeatures {
|
||||||
pub composite_embedders: Option<bool>,
|
pub composite_embedders: Option<bool>,
|
||||||
#[deserr(default)]
|
#[deserr(default)]
|
||||||
pub chat_completions: Option<bool>,
|
pub chat_completions: Option<bool>,
|
||||||
|
#[deserr(default)]
|
||||||
|
pub multimodal: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogglableFeatures {
|
impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogglableFeatures {
|
||||||
|
@ -113,6 +116,7 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
|
||||||
get_task_documents_route,
|
get_task_documents_route,
|
||||||
composite_embedders,
|
composite_embedders,
|
||||||
chat_completions,
|
chat_completions,
|
||||||
|
multimodal,
|
||||||
} = value;
|
} = value;
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
@ -124,6 +128,7 @@ impl From<meilisearch_types::features::RuntimeTogglableFeatures> for RuntimeTogg
|
||||||
get_task_documents_route: Some(get_task_documents_route),
|
get_task_documents_route: Some(get_task_documents_route),
|
||||||
composite_embedders: Some(composite_embedders),
|
composite_embedders: Some(composite_embedders),
|
||||||
chat_completions: Some(chat_completions),
|
chat_completions: Some(chat_completions),
|
||||||
|
multimodal: Some(multimodal),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +143,7 @@ pub struct PatchExperimentalFeatureAnalytics {
|
||||||
get_task_documents_route: bool,
|
get_task_documents_route: bool,
|
||||||
composite_embedders: bool,
|
composite_embedders: bool,
|
||||||
chat_completions: bool,
|
chat_completions: bool,
|
||||||
|
multimodal: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Aggregate for PatchExperimentalFeatureAnalytics {
|
impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||||
|
@ -155,6 +161,7 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||||
get_task_documents_route: new.get_task_documents_route,
|
get_task_documents_route: new.get_task_documents_route,
|
||||||
composite_embedders: new.composite_embedders,
|
composite_embedders: new.composite_embedders,
|
||||||
chat_completions: new.chat_completions,
|
chat_completions: new.chat_completions,
|
||||||
|
multimodal: new.multimodal,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +188,7 @@ impl Aggregate for PatchExperimentalFeatureAnalytics {
|
||||||
get_task_documents_route: Some(false),
|
get_task_documents_route: Some(false),
|
||||||
composite_embedders: Some(false),
|
composite_embedders: Some(false),
|
||||||
chat_completions: Some(false),
|
chat_completions: Some(false),
|
||||||
|
multimodal: Some(false),
|
||||||
})),
|
})),
|
||||||
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
(status = 401, description = "The authorization header is missing", body = ResponseError, content_type = "application/json", example = json!(
|
||||||
{
|
{
|
||||||
|
@ -223,6 +231,7 @@ async fn patch_features(
|
||||||
.composite_embedders
|
.composite_embedders
|
||||||
.unwrap_or(old_features.composite_embedders),
|
.unwrap_or(old_features.composite_embedders),
|
||||||
chat_completions: new_features.0.chat_completions.unwrap_or(old_features.chat_completions),
|
chat_completions: new_features.0.chat_completions.unwrap_or(old_features.chat_completions),
|
||||||
|
multimodal: new_features.0.multimodal.unwrap_or(old_features.multimodal),
|
||||||
};
|
};
|
||||||
|
|
||||||
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
|
// explicitly destructure for analytics rather than using the `Serialize` implementation, because
|
||||||
|
@ -237,6 +246,7 @@ async fn patch_features(
|
||||||
get_task_documents_route,
|
get_task_documents_route,
|
||||||
composite_embedders,
|
composite_embedders,
|
||||||
chat_completions,
|
chat_completions,
|
||||||
|
multimodal,
|
||||||
} = new_features;
|
} = new_features;
|
||||||
|
|
||||||
analytics.publish(
|
analytics.publish(
|
||||||
|
@ -249,6 +259,7 @@ async fn patch_features(
|
||||||
get_task_documents_route,
|
get_task_documents_route,
|
||||||
composite_embedders,
|
composite_embedders,
|
||||||
chat_completions,
|
chat_completions,
|
||||||
|
multimodal,
|
||||||
},
|
},
|
||||||
&req,
|
&req,
|
||||||
);
|
);
|
||||||
|
|
|
@ -755,6 +755,14 @@ fn validate_settings(
|
||||||
if matches!(embedder.indexing_embedder, Setting::Set(_)) {
|
if matches!(embedder.indexing_embedder, Setting::Set(_)) {
|
||||||
features.check_composite_embedders("setting `indexingEmbedder`")?;
|
features.check_composite_embedders("setting `indexingEmbedder`")?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if matches!(embedder.indexing_fragments, Setting::Set(_)) {
|
||||||
|
features.check_multimodal("setting `indexingFragments`")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
if matches!(embedder.search_fragments, Setting::Set(_)) {
|
||||||
|
features.check_multimodal("setting `searchFragments`")?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -972,6 +972,9 @@ pub fn prepare_search<'t>(
|
||||||
time_budget: TimeBudget,
|
time_budget: TimeBudget,
|
||||||
features: RoFeatures,
|
features: RoFeatures,
|
||||||
) -> Result<(milli::Search<'t>, bool, usize, usize), ResponseError> {
|
) -> Result<(milli::Search<'t>, bool, usize, usize), ResponseError> {
|
||||||
|
if query.media.is_some() {
|
||||||
|
features.check_multimodal("passing `media` in a search query")?;
|
||||||
|
}
|
||||||
let mut search = index.search(rtxn);
|
let mut search = index.search(rtxn);
|
||||||
search.time_budget(time_budget);
|
search.time_budget(time_budget);
|
||||||
if let Some(ranking_score_threshold) = query.ranking_score_threshold {
|
if let Some(ranking_score_threshold) = query.ranking_score_threshold {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue