mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-06 20:44:58 +00:00
change Reranker to WeightedInMemoryAggregator
This commit is contained in:
parent
60318b659d
commit
897be1376e
6 changed files with 22 additions and 142 deletions
|
@ -31,7 +31,7 @@ from llama_stack.providers.utils.memory.vector_store import (
|
|||
EmbeddingIndex,
|
||||
VectorDBWithIndex,
|
||||
)
|
||||
from llama_stack.providers.utils.vector_io.vector_utils import Reranker
|
||||
from llama_stack.providers.utils.vector_io.vector_utils import WeightedInMemoryAggregator
|
||||
|
||||
from .config import ChromaVectorIOConfig as RemoteChromaVectorIOConfig
|
||||
|
||||
|
@ -192,7 +192,9 @@ class ChromaIndex(EmbeddingIndex):
|
|||
}
|
||||
|
||||
# Combine scores using the reranking utility
|
||||
combined_scores = Reranker.combine_search_results(vector_scores, keyword_scores, reranker_type, reranker_params)
|
||||
combined_scores = WeightedInMemoryAggregator.combine_search_results(
|
||||
vector_scores, keyword_scores, reranker_type, reranker_params
|
||||
)
|
||||
|
||||
# Efficient top-k selection because it only tracks the k best candidates it's seen so far
|
||||
top_k_items = heapq.nlargest(k, combined_scores.items(), key=lambda x: x[1])
|
||||
|
|
|
@ -39,7 +39,6 @@ def sanitize_collection_name(name: str, weaviate_format=False) -> str:
|
|||
return s
|
||||
|
||||
|
||||
|
||||
class WeightedInMemoryAggregator:
|
||||
@staticmethod
|
||||
def _normalize_scores(scores: dict[str, float]) -> dict[str, float]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue