mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-07-27 00:31:02 +00:00
Index::embeddings specifies if the embedder has fragments
This commit is contained in:
@ -1766,20 +1766,22 @@ impl Index {
|
|||||||
&self,
|
&self,
|
||||||
rtxn: &RoTxn<'_>,
|
rtxn: &RoTxn<'_>,
|
||||||
docid: DocumentId,
|
docid: DocumentId,
|
||||||
) -> Result<BTreeMap<String, (Vec<Embedding>, bool)>> {
|
) -> Result<BTreeMap<String, EmbeddingsWithMetadata>> {
|
||||||
let mut res = BTreeMap::new();
|
let mut res = BTreeMap::new();
|
||||||
let embedders = self.embedding_configs();
|
let embedders = self.embedding_configs();
|
||||||
for config in embedders.embedding_configs(rtxn)? {
|
for config in embedders.embedding_configs(rtxn)? {
|
||||||
let embedder_info = embedders.embedder_info(rtxn, &config.name)?.unwrap();
|
let embedder_info = embedders.embedder_info(rtxn, &config.name)?.unwrap();
|
||||||
|
let has_fragments = config.config.embedder_options.has_fragments();
|
||||||
let reader = ArroyWrapper::new(
|
let reader = ArroyWrapper::new(
|
||||||
self.vector_arroy,
|
self.vector_arroy,
|
||||||
embedder_info.embedder_id,
|
embedder_info.embedder_id,
|
||||||
config.config.quantized(),
|
config.config.quantized(),
|
||||||
);
|
);
|
||||||
let embeddings = reader.item_vectors(rtxn, docid)?;
|
let embeddings = reader.item_vectors(rtxn, docid)?;
|
||||||
|
let regenerate = embedder_info.embedding_status.must_regenerate(docid);
|
||||||
res.insert(
|
res.insert(
|
||||||
config.name.to_owned(),
|
config.name.to_owned(),
|
||||||
(embeddings, embedder_info.embedding_status.must_regenerate(docid)),
|
EmbeddingsWithMetadata { embeddings, regenerate, has_fragments },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Ok(res)
|
Ok(res)
|
||||||
@ -1919,6 +1921,12 @@ impl Index {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct EmbeddingsWithMetadata {
|
||||||
|
pub embeddings: Vec<Embedding>,
|
||||||
|
pub regenerate: bool,
|
||||||
|
pub has_fragments: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Deserialize, Serialize)]
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
||||||
pub struct ChatConfig {
|
pub struct ChatConfig {
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
Reference in New Issue
Block a user