docstr: Resolves the request and response objects for `openai.Completion`.
docstr_tok: ["Resolves","the","request","and","response","objects","for","`","openai.Completion","`","."]
code: def _resolve_chat_completion(
      self,
      request: Dict[str, Any],
      response: Response,
      time_elapsed: float,
  ) -> Dict[str, Any]:
      """Resolves the request and response objects for `openai.Completion`."""
      prompt = io.StringIO()
      for message in request["messages"]:
          prompt.write(
              f"\n\n**{message['role']}**: {message['content']}\n"
          )
      request_str = prompt.getvalue()
  
      choices = [
          f"\n\n**{choice['message']['role']}**: {choice['message']['content']}\n"
          for choice in response["choices"]
      ]
  
      return self._resolve_metrics(
          request=request,
          response=response,
          request_str=request_str,
          choices=choices,
          time_elapsed=time_elapsed,
      )
  
imports: import datetime
  import io
  import logging
  from dataclasses import asdict, dataclass
  from typing import Any, Dict, List, Optional, Sequence
  import wandb
  from wandb.sdk.data_types import trace_tree
  from wandb.sdk.integration_utils.auto_logging import Response
label_desc: Use image node_id 6 for calling the OpenAIRequestResponseResolver obj's underlying member method code with example usage: obj._resolve_chat_completion(request, response, time_elapsed) and returns: self