LiteLLMReranker.predict:v0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import weave
@weave.op()
def predict(self, query, docs, top_n=None):
"""
Predicts the relevance of documents to the query by reranking them.
Args:
query (str): The query string.
docs (List[Dict[str, Any]]): A list of documents to be reranked.
top_n (int, optional): The number of top documents to return. Defaults to None.
Returns:
List[Dict[str, Any]]: A list of reranked documents with relevance scores.
"""
return self.rerank(query, docs, top_n)