docstr: Converts metrics to a dict.
docstr_tok: ["Converts","metrics","to","a","dict","."]
code: def _convert_metrics_to_dict(metrics: Metrics) -> Dict[str, Any]:
      """Converts metrics to a dict."""
      metrics_dict = {
          "stats": metrics.stats,
          "trace": metrics.trace,
      }
      usage_stats = {
          f"usage/{k}": v for k, v in asdict(metrics.usage).items()
      }
      metrics_dict.update(usage_stats)
      return metrics_dict
  
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 10 for calling the OpenAIRequestResponseResolver obj's underlying member method code with example usage: obj._convert_metrics_to_dict(metrics) and returns: metrics_dict