Merge pull request #5886 from meilisearch/fix-decoding-error

Allow missing `search_fragments` and `indexing_fragments`
This commit is contained in:
Tamo
2025-09-11 14:13:57 +00:00
committed by GitHub
8 changed files with 60 additions and 0 deletions

View File

@ -12,6 +12,12 @@ use crate::vector::settings::RemoveFragments;
use crate::vector::EmbeddingConfig;
use crate::{CboRoaringBitmapCodec, DocumentId, UserError};
/// DB representation of an embedder configuration.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Deserialize, Serialize)]
pub struct IndexEmbeddingConfig {
pub name: String,

View File

@ -24,6 +24,12 @@ pub enum SubEmbedder {
Rest(rest::Embedder),
}
/// Options of a subembedder, specific to each kind of embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum SubEmbedderOptions {
HuggingFace(hf::EmbedderOptions),
@ -51,6 +57,12 @@ pub struct Embedder {
pub(super) index: SubEmbedder,
}
/// Options of a composite embedder, specific to each kind of embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct EmbedderOptions {
pub search: SubEmbedderOptions,

View File

@ -30,6 +30,12 @@ enum WeightSource {
Pytorch,
}
/// Inert embedder options for a hf embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct EmbedderOptions {
pub model: String,

View File

@ -7,6 +7,12 @@ pub struct Embedder {
distribution: Option<DistributionShift>,
}
/// Inert embedder options for a manual embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct EmbedderOptions {
pub dimensions: usize,

View File

@ -35,6 +35,11 @@ pub enum Embedder {
}
/// Configuration for an embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Default, serde::Deserialize, serde::Serialize)]
pub struct EmbeddingConfig {
/// Options of the embedder, specific to each kind of embedder
@ -53,6 +58,11 @@ impl EmbeddingConfig {
}
/// Options of an embedder, specific to each kind of embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub enum EmbedderOptions {
HuggingFace(hf::EmbedderOptions),

View File

@ -16,6 +16,12 @@ pub struct Embedder {
rest_embedder: RestEmbedder,
}
/// Inert embedder options for an ollama embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct EmbedderOptions {
pub embedding_model: String,

View File

@ -13,6 +13,12 @@ use crate::vector::error::{EmbedError, EmbedErrorKind, NewEmbedderError};
use crate::vector::{Embedding, REQUEST_PARALLELISM};
use crate::ThreadPoolNoAbort;
/// Inert embedder options for an openai embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, Hash, PartialEq, Eq, serde::Deserialize, serde::Serialize)]
pub struct EmbedderOptions {
pub url: Option<String>,

View File

@ -133,6 +133,12 @@ impl RequestData {
}
}
/// Inert embedder options for a rest embedder.
///
/// # Warning
///
/// This type is serialized in and deserialized from the DB, any modification should either go
/// through dumpless upgrade or be backward-compatible
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize)]
pub struct EmbedderOptions {
pub api_key: Option<String>,
@ -140,7 +146,9 @@ pub struct EmbedderOptions {
pub dimensions: Option<usize>,
pub url: String,
pub request: Value,
#[serde(default)] // backward compatibility
pub search_fragments: BTreeMap<String, Value>,
#[serde(default)] // backward compatibility
pub indexing_fragments: BTreeMap<String, Value>,
pub response: Value,
pub headers: BTreeMap<String, String>,