code: def test_semantic_answer_similarity(bert_base_squad2):
      bert_base_squad2.model.prediction_heads[0].n_best = 2
      result = bert_base_squad2.inference_from_file(
          file="samples/qa/eval-sample.json", return_json=False
      )
  
      top1_sim, topn_sim, r, d = semantic_answer_similarity(
          result=result,
          sts_model_path_or_string="paraphrase-MiniLM-L6-v2",
          debug=True,
      )
  
      assert np.isclose(top1_sim, 0.7405298)
      assert np.isclose(topn_sim, 0.7405298)
      assert len(d) == 1
      assert "semantic_answer_score" in r[0].prediction[0].meta
  
imports: import pytest
  import math
  import numpy
  from farm.evaluation.metrics import compute_metrics
  from farm.evaluation.semantic_answer_similarity_evaluation import semantic_answer_similarity
label_desc: Use image node_id 2 for calling a global function with example usage: test_semantic_answer_similarity(bert_base_squad2) without return types