File tree Expand file tree Collapse file tree
src/vectorcode/subcommands/query Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import heapq
2+ import logging
23from abc import abstractmethod
34from collections import defaultdict
45from typing import Any , DefaultDict
89
910from vectorcode .cli_utils import Config , QueryInclude
1011
12+ logger = logging .getLogger (name = __name__ )
13+
1114
1215class RerankerBase :
1316 def __init__ (self , configs : Config , ** kwargs : Any ):
@@ -42,7 +45,7 @@ def rerank(self, results: QueryResult) -> list[str]:
4245 # so that vectorcode doesn't break on old collections.
4346 continue
4447 documents [identifier ].append (distance )
45-
48+ logger . debug ( "Document scores: %s" , documents )
4649 top_k = int (numpy .mean (tuple (len (i ) for i in documents .values ())))
4750 for key in documents .keys ():
4851 documents [key ] = heapq .nsmallest (top_k , documents [key ])
@@ -80,7 +83,7 @@ def rerank(self, results: QueryResult) -> list[str]:
8083 documents [chunk_metas [rank ["corpus_id" ]]["path" ]].append (
8184 float (rank ["score" ])
8285 )
83-
86+ logger . debug ( "Document scores: %s" , documents )
8487 top_k = int (numpy .mean (tuple (len (i ) for i in documents .values ())))
8588 for key in documents .keys ():
8689 documents [key ] = heapq .nlargest (top_k , documents [key ])
You can’t perform that action at this time.
0 commit comments