fix: arc-share retrieved chunks, centralize entity embeddings, and trim hot-path clones.

This commit is contained in:
Per Stark
2026-06-06 23:05:53 +02:00
parent 60cf63292a
commit c53ec8c0a1
41 changed files with 368 additions and 289 deletions
@@ -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")?
}
+4 -4
View File
@@ -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