class_docstr: Uses the GPT model to validate the similarities between pairs of related words.
class_docstr_tok: ["Uses","the","GPT","model","to","validate","the","similarities","between","pairs","of","related","words","."]
docstr: Uses the GPT model to generate a completion based on a given prompt.
  
  Args:
      related_words_pair: The pair of related words to generate a completion for.
      correlation_prompt: An optional specific prompt for the correlation task.
      answer_prompt: An optional specific prompt for the answer format. If not provided, a default is used.
  
  Returns:
      The content of the message from the GPT model's response.
docstr_tok: ["Uses","the","GPT","model","to","generate","a","completion","based","on","a","given","prompt",".","Args",":","related_words_pair",":","The","pair","of","related","words","to","generate","a","completion","for",".","correlation_prompt",":","An","optional","specific","prompt","for","the","correlation","task",".","answer_prompt",":","An","optional","specific","prompt","for","the","answer","format",".","If","not","provided",",","a","default","is","used",".","Returns",":","The","content","of","the","message","from","the","GPT","model","'s","response","."]
code: def get_chat_completion(
      self,
      related_words_pair: RelatedWordsPair,
      correlation_prompt: str = None,
      answer_prompt: str = None,
  ) -> List[SimilarityTuple]:
      """
      Uses the GPT model to generate a completion based on a given prompt.
  
      Args:
          related_words_pair: The pair of related words to generate a completion for.
          correlation_prompt: An optional specific prompt for the correlation task.
          answer_prompt: An optional specific prompt for the answer format. If not provided, a default is used.
  
      Returns:
          The content of the message from the GPT model's response.
      """
      if correlation_prompt is None:
          correlation_prompt = CORRELATION_PROMPT_TEMPLATE.format(
              word=related_words_pair.word,
              related_words=related_words_pair.related_words,
          )
      if answer_prompt is None:
          answer_prompt = ANSWER_PROMPT_TEMPLATE
      prompt = correlation_prompt + answer_prompt
  
      messages = [{"role": "user", "content": prompt}]
      logger.debug(
          f"Getting chat_completion using {self._model}.\nPrompting messages: {messages}"
      )
      response = client.chat.completions.create(
          model=self._model, messages=messages, temperature=0.0
      )
      logger.debug(f"response_message: {response}")
      response_message = response["choices"][0]["message"]["content"]
      logger.info(f"response_message: {response_message}")
      return response_message
  
imports: import os
  import re
  from abc import ABC, abstractmethod
  from collections.abc import Callable
  from typing import Dict, List, NamedTuple, Tuple, Union
  import numpy
  from logger_config import logger
  from openai import OpenAI
label_desc: Use image node_id 3 for calling the GPTValidator obj's underlying member method code with example usage: obj.get_chat_completion(related_words_pair, correlation_prompt, answer_prompt) and returns: response_message