class_docstr: A wrapper class for openai client.
docstr: Args:
      config_list: a list of config dicts to override the base_config.
          They can contain additional kwargs as allowed in the [create](/docs/reference/oai/client#create) method. E.g.,
  
  ```python
  config_list=[
      {
          "model": "gpt-4",
          "api_key": os.environ.get("AZURE_OPENAI_API_KEY"),
          "api_type": "azure",
          "base_url": os.environ.get("AZURE_OPENAI_API_BASE"),
          "api_version": "2023-03-15-preview",
      },
      {
          "model": "gpt-3.5-turbo",
          "api_key": os.environ.get("OPENAI_API_KEY"),
          "api_type": "open_ai",
          "base_url": "https://api.openai.com/v1",
      },
      {
          "model": "llama-7B",
          "base_url": "http://127.0.0.1:8080",
          "api_type": "open_ai",
      }
  ]
  ```
  
      base_config: base config. It can contain both keyword arguments for openai client
          and additional kwargs.
docstr_tok: ["Args",":","config_list",":","a","list","of","config","dicts","to","override","the","base_config",".","They","can","contain","additional","kwargs","as","allowed","in","the","[","create","]","(","\/docs\/reference\/oai\/client","#","create",")","method",".","E.g.",",","``","`","python","config_list=","[","{","``","model","''",":","``","gpt-4","''",",","``","api_key","''",":","os.environ.get","(","``","AZURE_OPENAI_API_KEY","''",")",",","``","api_type","''",":","``","azure","''",",","``","base_url","''",":","os.environ.get","(","``","AZURE_OPENAI_API_BASE","''",")",",","``","api_version","''",":","``","2023-03-15-preview","''",",","}",",","{","``","model","''",":","``","gpt-3.5-turbo","''",",","``","api_key","''",":","os.environ.get","(","``","OPENAI_API_KEY","''",")",",","``","api_type","''",":","``","open_ai","''",",","``","base_url","''",":","``","https",":","\/\/api.openai.com\/v1","''",",","}",",","{","``","model","''",":","``","llama-7B","''",",","``","base_url","''",":","``","http",":","\/\/127.0.0.1:8080","''",",","``","api_type","''",":","``","open_ai","''",",","}","]","``","`","base_config",":","base","config",".","It","can","contain","both","keyword","arguments","for","openai","client","and","additional","kwargs","."]
code: def __init__(
      self,
      *,
      config_list: Optional[List[Dict[str, Any]]] = None,
      **base_config: Any,
  ):
      """
      Args:
          config_list: a list of config dicts to override the base_config.
              They can contain additional kwargs as allowed in the [create](/docs/reference/oai/client#create) method. E.g.,
  
      ```python
      config_list=[
          {
              "model": "gpt-4",
              "api_key": os.environ.get("AZURE_OPENAI_API_KEY"),
              "api_type": "azure",
              "base_url": os.environ.get("AZURE_OPENAI_API_BASE"),
              "api_version": "2023-03-15-preview",
          },
          {
              "model": "gpt-3.5-turbo",
              "api_key": os.environ.get("OPENAI_API_KEY"),
              "api_type": "open_ai",
              "base_url": "https://api.openai.com/v1",
          },
          {
              "model": "llama-7B",
              "base_url": "http://127.0.0.1:8080",
              "api_type": "open_ai",
          }
      ]
      ```
  
          base_config: base config. It can contain both keyword arguments for openai client
              and additional kwargs.
      """
      openai_config, extra_kwargs = self._separate_openai_config(
          base_config
      )
      if type(config_list) is list and len(config_list) == 0:
          logger.warning(
              "openai client was provided with an empty config_list, which may not be intended."
          )
      if config_list:
          config_list = [
              config.copy() for config in config_list
          ]  # make a copy before modifying
          self._clients: List[OpenAI] = [
              self._client(config, openai_config)
              for config in config_list
          ]  # could modify the config
          self._config_list = [
              {
                  **extra_kwargs,
                  **{
                      k: v
                      for k, v in config.items()
                      if k not in self.openai_kwargs
                  },
              }
              for config in config_list
          ]
      else:
          self._clients = [self._client(extra_kwargs, openai_config)]
          self._config_list = [extra_kwargs]
  
imports: from __future__ import annotations
  import os
  import sys
  from typing import Any, List, Optional, Dict, Callable, Tuple, Union
  import logging
  import inspect
  from flaml.automl.logger import logger_formatter
  from pydantic import BaseModel
  from autogen.oai import completion
  from autogen.oai.openai_utils import DEFAULT_AZURE_API_VERSION, get_key, OAI_PRICE1K
  from autogen.token_count_utils import count_token
  from autogen._pydantic import model_dump
label_desc: Use image node_id 1 to create a new OpenAIWrapper object  with example: obj = OpenAIWrapper()