mirror of
https://github.com/perstarkse/minne.git
synced 2026-06-27 12:26:21 +02:00
fix: arc-share retrieved chunks, centralize entity embeddings, and trim hot-path clones.
This commit is contained in:
@@ -42,14 +42,12 @@ pub(crate) async fn prepare_db(
|
||||
|
||||
// Create embedding provider directly from config (eval only supports FastEmbed and Hashed)
|
||||
let embedding_provider = match config.embedding_backend {
|
||||
crate::args::EmbeddingBackend::FastEmbed => {
|
||||
EmbeddingProvider::new_fastembed(
|
||||
config.embedding_model.clone(),
|
||||
default_embedding_pool_size(),
|
||||
)
|
||||
.await
|
||||
.context("creating FastEmbed provider")?
|
||||
}
|
||||
crate::args::EmbeddingBackend::FastEmbed => EmbeddingProvider::new_fastembed(
|
||||
config.embedding_model.clone(),
|
||||
default_embedding_pool_size(),
|
||||
)
|
||||
.await
|
||||
.context("creating FastEmbed provider")?,
|
||||
crate::args::EmbeddingBackend::Hashed => {
|
||||
EmbeddingProvider::new_hashed(1536).context("creating Hashed provider")?
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ pub struct EvaluationCandidate {
|
||||
}
|
||||
|
||||
impl EvaluationCandidate {
|
||||
fn from_entity(entity: RetrievedEntity) -> Self {
|
||||
fn from_entity(entity: &RetrievedEntity) -> Self {
|
||||
let entity_category = Some(format!("{:?}", entity.entity.entity_type));
|
||||
Self {
|
||||
entity_id: entity.entity.id().to_string(),
|
||||
@@ -223,9 +223,9 @@ impl EvaluationCandidate {
|
||||
}
|
||||
}
|
||||
|
||||
fn candidates_from_entities(entities: Vec<RetrievedEntity>) -> Vec<EvaluationCandidate> {
|
||||
fn candidates_from_entities(entities: &[RetrievedEntity]) -> Vec<EvaluationCandidate> {
|
||||
entities
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(EvaluationCandidate::from_entity)
|
||||
.collect()
|
||||
}
|
||||
@@ -241,7 +241,7 @@ pub fn adapt_retrieval_output(output: RetrievalOutput) -> Vec<EvaluationCandidat
|
||||
match output {
|
||||
RetrievalOutput::Chunks(chunks) => candidates_from_chunks(chunks),
|
||||
RetrievalOutput::WithEntities { chunks, entities } => {
|
||||
let mut candidates = candidates_from_entities(entities);
|
||||
let mut candidates = candidates_from_entities(&entities);
|
||||
candidates.extend(candidates_from_chunks(chunks));
|
||||
candidates.sort_by(|a, b| b.score.total_cmp(&a.score));
|
||||
candidates
|
||||
|
||||
Reference in New Issue
Block a user