queries = [INSTRUCTION + query for query in queries]
scores = [rerank(query, docs) for query, docs in zip(queries, passages)]
return np.array(scores)
def main():
# Example use cases
response_4B = MiniCPM3_4B_inference("推荐5个北京的景点。")
print(f"MiniCPM3-4B Response: {response_4B}")
instruction = "Q: What is the name of the lead character in the novel 'The Silent Watcher'?\nA:"
passages_list = [
"In the novel 'The Silent Watcher,' the lead character is named Alex Carter. Alex is a private detective who uncovers a series of mysterious events in a small town.",
"Set in a quiet town, 'The Silent Watcher' follows Alex Carter, a former police officer turned private investigator, as he unravels the town's dark secrets.",
"'The Silent Watcher' revolves around Alex Carter's journey as he confronts his past while solving complex cases in his hometown."