Answer endpoint and score return

using the answer endpoint, a score is being returned for each document like

      "document": 3,
      "object": "search_result",
      "score": -13.005,
      "text": "Used shrimp species has the Latin name Litopenaeus vannamei also known as Pacific white shrimp or King prawn"

I thought the return value with the highest score is used for the answer ,
which is also kinda listed as true in the docs
from my observation this is not always true
Im a little bit confused how to use /interpret the score value

The answer endpoint gives you a list of possible answers, each with there own score. I suggest you iterate through the list and append the [“score”] value to a separate list. Then, return the max() value and get its respective “text” value.

Here is some code that achieves this, using the Answers endpoint response in the variable response

response = response["selected_documents"]
score = {}
for i in response:
    response = i["text"]
    score[response] = i["score"]
maxval = max(score.values())
if maxval >= 100:
    prompt = [prompt for prompt, response in score.items() if response == maxval]
    return prompt[0]

Note: the maxval if statement takes the max score and sees if it is less than 100. If it is, it returns the text. If not, it returns nothing. This parameter can be deleted, but I found this is a good threshold to determine if you actually found any relevant answers

thanks for the reply, I have already gone through the response object but dont get
the purpose of the score property

What I want to know is from what response object the model has taken the answer

when I ask simple facts questions with the curie model → what is the name of the used shrimp species | answer → Litopenaeus vannamei
the correct answer is taken from the return object with the highest score

if the question structure gets more complicated → why … can I use …
the curie model does not provide the correct answer,
When switching to davinci the response object with the highest score is not allways used for the answer