class_docstr: Base class for reranker models
class_docstr_tok: ["Base","class","for","reranker","models"]
code: def on_response(
      self, response: ResponseDelegate, db_row: DatabaseRow
  ):
      if response.request.rerank_cids:
          db_row.server_mrr = calculate_mrr(
              correct=response.request.rerank_cids.list,
              guesses=response.cids,
          )
  
      start_time = time.perf_counter()
  
      ranks, scores = self.rank(
          query=response.request.query,
          choices=response.cvalues,
          filter_results=response.request.filter_results,
      )
      db_row.rerank_time = time.perf_counter() - start_time
  
      # remove ranks which are higher than total choices
      ranks = [rank for rank in ranks if rank < len(response.choices)]
      reranked_choices = [response.choices[rank] for rank in ranks]
  
      response.choices = reranked_choices
      response.set_path(
          "body.nboost.scores", list([float(score) for score in scores])
      )
  
      if response.request.rerank_cids:
          db_row.model_mrr = calculate_mrr(
              correct=response.request.rerank_cids.list,
              guesses=response.cids,
          )
  
      response.choices = response.choices[: db_row.topk]
  
file_path: nboost/nboost/plugins/rerank/base.py
imports: from typing import List, Tuple
  import time
  from nboost.plugins import Plugin
  from nboost.delegates import RequestDelegate, ResponseDelegate
  from nboost.helpers import calculate_mrr
  from nboost.database import DatabaseRow
  from nboost import defaults
  import numpy
label_desc: Use image node_id 2 for calling the RerankModelPlugin obj's underlying member method code with example usage: obj.on_response(response, db_row) without return types