code: def get_gpt_evaluation_with_logprobs(
      prompt: Dict[str, Any],
      inst: Dict[str, Any],
      metrics: List[str],
      max_tokens: int = 2048,
  ) -> Dict[str, Any]:
      """
      Use completion model(text-davinci-003) to evaluate one model answer.
      Only completion models can return log probabilities.
  
      Temprature is set to 0 to make the model more deterministic.
  
      Args:
          prompt: a dictionary including prompt template, CoT and metrics.
          inst: the instruction that is needed to be evaluated.
          metrics: the metrics for evaluation.
          max_tokens: the maximum number of tokens to generate in the completion.
  
      Returns:
          An evaluation of one answer.
      """
  
      MAX_API_RETRY = 3
  
      question = (
          inst["instruction"]
          if inst["input"] == ""
          else inst["instruction"] + "\n" + inst["input"]
      )
      answer = inst["output"]
      inst["evaluation"] = {}
  
      for metric in metrics:
          if prompt["metrics"].get(metric, None) is None:
              raise Exception(
                  f"Unsupported metric {metric} for category {inst['category']}! You should add this metric in the prompt file!"
              )
          for i in range(MAX_API_RETRY):
              try:
                  response = openai.Completion.create(
                      model="text-davinci-003",
                      prompt=prompt["prompt"].format(
                          question=question,
                          answer=answer,
                          metric=prompt["metrics"][metric],
                          steps=prompt["CoT"][metric],
                      ),
                      logprobs=5,
                      temperature=0,
                      max_tokens=max_tokens,
                  )
                  inst["evaluation"][metric] = {
                      "response": response["choices"][0]["text"],
                      "logprobs": response["choices"][0]["logprobs"][
                          "top_logprobs"
                      ],
                  }
  
                  # Prevent exceeding rate limits because we have multiple workers.
                  # But this will slow down the evaluation process.
                  # You can comment this line if your request doesn't contain many tokens.
                  time.sleep(len(metrics) * 0.5)
  
                  break
              except Exception as e:
                  print(e)
                  time.sleep(1)
          if metric not in inst["evaluation"]:
              print(
                  f"Evaluation {inst['id']} for metric {metric} failed after {MAX_API_RETRY} retries."
              )
              inst["evaluation"][metric] = {}
      return inst
  
imports: import concurrent.futures
  import os
  import re
  import time
  from copy import deepcopy
  from typing import Any, Dict, List
  import matplotlib.pyplot
  import numpy
  import openai
  import pandas
  import seaborn
  import tqdm
  from colossal_eval.utils import jdump, jload
label_desc: Use image node_id 9 for calling a global function with example usage: get_gpt_evaluation_with_logprobs(prompt, inst, metrics, max_tokens) and returns: inst