From 96544bfa43fe441be0423a835f8717119518d89b Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Mon, 3 Feb 2025 09:59:17 +0100 Subject: [PATCH 1/2] add `DOCUMENT_TEMPLATE_MAX_BYTES` to `allowed_sources_for_field` and `allowed_fields_for_source` --- crates/milli/src/vector/settings.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/milli/src/vector/settings.rs b/crates/milli/src/vector/settings.rs index 4a1b1882c..86028c1c4 100644 --- a/crates/milli/src/vector/settings.rs +++ b/crates/milli/src/vector/settings.rs @@ -455,7 +455,7 @@ impl EmbeddingSettings { EmbedderSource::Ollama, EmbedderSource::Rest, ], - Self::DOCUMENT_TEMPLATE => &[ + Self::DOCUMENT_TEMPLATE | Self::DOCUMENT_TEMPLATE_MAX_BYTES => &[ EmbedderSource::HuggingFace, EmbedderSource::OpenAi, EmbedderSource::Ollama, @@ -490,6 +490,7 @@ impl EmbeddingSettings { Self::MODEL, Self::API_KEY, Self::DOCUMENT_TEMPLATE, + Self::DOCUMENT_TEMPLATE_MAX_BYTES, Self::DIMENSIONS, Self::DISTRIBUTION, Self::URL, @@ -500,6 +501,7 @@ impl EmbeddingSettings { Self::MODEL, Self::REVISION, Self::DOCUMENT_TEMPLATE, + Self::DOCUMENT_TEMPLATE_MAX_BYTES, Self::DISTRIBUTION, Self::BINARY_QUANTIZED, ], @@ -507,6 +509,7 @@ impl EmbeddingSettings { Self::SOURCE, Self::MODEL, Self::DOCUMENT_TEMPLATE, + Self::DOCUMENT_TEMPLATE_MAX_BYTES, Self::URL, Self::API_KEY, Self::DIMENSIONS, @@ -521,6 +524,7 @@ impl EmbeddingSettings { Self::API_KEY, Self::DIMENSIONS, Self::DOCUMENT_TEMPLATE, + Self::DOCUMENT_TEMPLATE_MAX_BYTES, Self::URL, Self::REQUEST, Self::RESPONSE, From a4365345151d5bb9532209db37b704c777d2b41f Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Mon, 3 Feb 2025 10:36:34 +0100 Subject: [PATCH 2/2] Fix test --- crates/meilisearch/tests/vector/settings.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/meilisearch/tests/vector/settings.rs b/crates/meilisearch/tests/vector/settings.rs index 2aae67ebf..97fa496b4 100644 --- a/crates/meilisearch/tests/vector/settings.rs +++ b/crates/meilisearch/tests/vector/settings.rs @@ -32,7 +32,7 @@ async fn field_unavailable_for_source() { snapshot!(code, @"400 Bad Request"); snapshot!(response, @r###" { - "message": "`.embedders.default`: Field `revision` unavailable for source `openAi` (only available for sources: `huggingFace`). Available fields: `source`, `model`, `apiKey`, `documentTemplate`, `dimensions`, `distribution`, `url`, `binaryQuantized`", + "message": "`.embedders.default`: Field `revision` unavailable for source `openAi` (only available for sources: `huggingFace`). Available fields: `source`, `model`, `apiKey`, `documentTemplate`, `documentTemplateMaxBytes`, `dimensions`, `distribution`, `url`, `binaryQuantized`", "code": "invalid_settings_embedders", "type": "invalid_request", "link": "https://docs.meilisearch.com/errors#invalid_settings_embedders"