BM25Retriever.predict:v0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import weave
@weave.op()
def predict(self, query: str, k: int):
"""
Predicts the top-k results for the given query.
Args:
query (str): The search query.
k (int): The number of top results to return.
Returns:
list: A list of dictionaries containing the source, text, and score of the top-k results.
"""
return self.search(query, k)