Fix tests

This commit is contained in:
Louis Dureuil 2023-12-20 17:06:50 +01:00
parent 2e4c9651df
commit 6ff81de401
No known key found for this signature in database
3 changed files with 24 additions and 14 deletions

View File

@ -21,9 +21,9 @@ async fn index_with_documents<'a>(server: &'a Server, documents: &Value) -> Inde
"###); "###);
let (response, code) = index let (response, code) = index
.update_settings( .update_settings(json!({ "embedders": {"default": {
json!({ "embedders": {"default": {"source": {"userProvided": {"dimensions": 2}}}} }), "source": "userProvided",
) "dimensions": 2}}} ))
.await; .await;
assert_eq!(202, code, "{:?}", response); assert_eq!(202, code, "{:?}", response);
index.wait_task(response.uid()).await; index.wait_task(response.uid()).await;

View File

@ -890,13 +890,21 @@ async fn experimental_feature_vector_store() {
let (response, code) = index let (response, code) = index
.update_settings(json!({"embedders": { .update_settings(json!({"embedders": {
"manual": { "manual": {
"source": { "source": "userProvided",
"userProvided": {"dimensions": 3} "dimensions": 3,
}
} }
}})) }}))
.await; .await;
meili_snap::snapshot!(response, @r###"
{
"taskUid": 1,
"indexUid": "test",
"status": "enqueued",
"type": "settingsUpdate",
"enqueuedAt": "[date]"
}
"###);
meili_snap::snapshot!(code, @"202 Accepted"); meili_snap::snapshot!(code, @"202 Accepted");
let response = index.wait_task(response.uid()).await; let response = index.wait_task(response.uid()).await;

View File

@ -2553,7 +2553,7 @@ mod tests {
/// Vectors must be of the same length. /// Vectors must be of the same length.
#[test] #[test]
fn test_multiple_vectors() { fn test_multiple_vectors() {
use crate::vector::settings::{EmbedderSettings, EmbeddingSettings}; use crate::vector::settings::EmbeddingSettings;
let index = TempIndex::new(); let index = TempIndex::new();
index index
@ -2562,9 +2562,11 @@ mod tests {
embedders.insert( embedders.insert(
"manual".to_string(), "manual".to_string(),
Setting::Set(EmbeddingSettings { Setting::Set(EmbeddingSettings {
embedder_options: Setting::Set(EmbedderSettings::UserProvided( source: Setting::Set(crate::vector::settings::EmbedderSource::UserProvided),
crate::vector::settings::UserProvidedSettings { dimensions: 3 }, model: Setting::NotSet,
)), revision: Setting::NotSet,
api_key: Setting::NotSet,
dimensions: Setting::Set(3),
document_template: Setting::NotSet, document_template: Setting::NotSet,
}), }),
); );
@ -2579,10 +2581,10 @@ mod tests {
.unwrap(); .unwrap();
index.add_documents(documents!([{"id": 1, "_vectors": { "manual": [6, 7, 8] }}])).unwrap(); index.add_documents(documents!([{"id": 1, "_vectors": { "manual": [6, 7, 8] }}])).unwrap();
index index
.add_documents( .add_documents(
documents!([{"id": 2, "_vectors": { "manual": [[9, 10, 11], [12, 13, 14], [15, 16, 17]] }}]), documents!([{"id": 2, "_vectors": { "manual": [[9, 10, 11], [12, 13, 14], [15, 16, 17]] }}]),
) )
.unwrap(); .unwrap();
let rtxn = index.read_txn().unwrap(); let rtxn = index.read_txn().unwrap();
let res = index.search(&rtxn).vector([0.0, 1.0, 2.0].to_vec()).execute().unwrap(); let res = index.search(&rtxn).vector([0.0, 1.0, 2.0].to_vec()).execute().unwrap();