refactor(rag): drop the hardcoded embedding model hint from attach
The attach wizard mapped a collection's vector dimension to a hardcoded list of model names and printed them as likely candidates. The list was never checked against the models the user actually has configured, so it could recommend a model they cannot select, and one entry was a parenthetical note rather than a model id and so could never match anything. Any list like this rots as models are released. The dimension itself comes from the server and is worth stating, so it is still printed, as is the warning that a mismatched embedding model returns bad results. Deriving real candidates would need a dimension recorded against each configured model, which the model config does not carry today.
This commit is contained in:
+1
-22
@@ -491,13 +491,7 @@ impl Rag {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if dim > 0 {
|
if dim > 0 {
|
||||||
let candidates = embedding_model_candidates_for_dimension(dim);
|
println!("Collection uses {dim}-dim vectors.");
|
||||||
if !candidates.is_empty() {
|
|
||||||
println!(
|
|
||||||
"Collection uses {dim}-dim vectors. Likely models: {}",
|
|
||||||
candidates.join(", ")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
println!(
|
println!(
|
||||||
"⚠️ If the embedding model doesn't match what built this collection, \
|
"⚠️ If the embedding model doesn't match what built this collection, \
|
||||||
@@ -1834,21 +1828,6 @@ fn driver_auth_header(driver: &str) -> (&'static str, &'static str) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Embedding models known to produce a given vector dimension, used to hint the
|
|
||||||
/// user toward a model compatible with the collection they just picked.
|
|
||||||
fn embedding_model_candidates_for_dimension(dim: u64) -> Vec<&'static str> {
|
|
||||||
match dim {
|
|
||||||
1536 => vec!["text-embedding-3-small", "text-embedding-ada-002"],
|
|
||||||
3072 => vec!["text-embedding-3-large"],
|
|
||||||
768 => vec!["nomic-embed-text", "all-minilm-l6-v2"],
|
|
||||||
1024 => vec![
|
|
||||||
"text-embedding-3-small (matryoshka-1024)",
|
|
||||||
"jina-embeddings-v2-base",
|
|
||||||
],
|
|
||||||
_ => vec![],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn select_embedding_model(models: &[&Model]) -> Result<String> {
|
fn select_embedding_model(models: &[&Model]) -> Result<String> {
|
||||||
let max_width = models.iter().map(|v| v.id().len()).max().unwrap_or(0);
|
let max_width = models.iter().map(|v| v.id().len()).max().unwrap_or(0);
|
||||||
let models: Vec<_> = models
|
let models: Vec<_> = models
|
||||||
|
|||||||
Reference in New Issue
Block a user