class_docstr: A component for computing Document embeddings using OpenAI models.
  The embedding of each Document is stored in the `embedding` field of the Document.
  
  Usage example:
  ```python
  from haystack import Document
  from haystack.components.embedders import OpenAIDocumentEmbedder
  
  doc = Document(content="I love pizza!")
  
  document_embedder = OpenAIDocumentEmbedder()
  
  result = document_embedder.run([doc])
  print(result['documents'][0].embedding)
  
  # [0.017020374536514282, -0.023255806416273117, ...]
  ```
docstr: Create a OpenAIDocumentEmbedder component.
  :param api_key: The OpenAI API key. It can be explicitly provided or automatically read from the
                  environment variable OPENAI_API_KEY (recommended).
  :param model: The name of the model to use.
  :param api_base_url: The OpenAI API Base url, defaults to None. For more details, see OpenAI [docs](https://platform.openai.com/docs/api-reference/audio).
  :param organization: The Organization ID, defaults to `None`. See
  [production best practices](https://platform.openai.com/docs/guides/production-best-practices/setting-up-your-organization).
  :param prefix: A string to add to the beginning of each text.
  :param suffix: A string to add to the end of each text.
  :param batch_size: Number of Documents to encode at once.
  :param progress_bar: Whether to show a progress bar or not. Can be helpful to disable in production deployments
                       to keep the logs clean.
  :param meta_fields_to_embed: List of meta fields that should be embedded along with the Document text.
  :param embedding_separator: Separator used to concatenate the meta fields to the Document text.
docstr_tok: ["Create","a","OpenAIDocumentEmbedder","component",".",":","param","api_key",":","The","OpenAI","API","key",".","It","can","be","explicitly","provided","or","automatically","read","from","the","environment","variable","OPENAI_API_KEY","(","recommended",")",".",":","param","model",":","The","name","of","the","model","to","use",".",":","param","api_base_url",":","The","OpenAI","API","Base","url",",","defaults","to","None",".","For","more","details",",","see","OpenAI","[","docs","]","(","https",":","\/\/platform.openai.com\/docs\/api-reference\/audio",")",".",":","param","organization",":","The","Organization","ID",",","defaults","to","`","None","`",".","See","[","production","best","practices","]","(","https",":","\/\/platform.openai.com\/docs\/guides\/production-best-practices\/setting-up-your-organization",")",".",":","param","prefix",":","A","string","to","add","to","the","beginning","of","each","text",".",":","param","suffix",":","A","string","to","add","to","the","end","of","each","text",".",":","param","batch_size",":","Number","of","Documents","to","encode","at","once",".",":","param","progress_bar",":","Whether","to","show","a","progress","bar","or","not",".","Can","be","helpful","to","disable","in","production","deployments","to","keep","the","logs","clean",".",":","param","meta_fields_to_embed",":","List","of","meta","fields","that","should","be","embedded","along","with","the","Document","text",".",":","param","embedding_separator",":","Separator","used","to","concatenate","the","meta","fields","to","the","Document","text","."]
code: def __init__(
      self,
      api_key: Optional[str] = None,
      model: str = "text-embedding-ada-002",
      api_base_url: Optional[str] = None,
      organization: Optional[str] = None,
      prefix: str = "",
      suffix: str = "",
      batch_size: int = 32,
      progress_bar: bool = True,
      meta_fields_to_embed: Optional[List[str]] = None,
      embedding_separator: str = "\n",
  ):
      """
      Create a OpenAIDocumentEmbedder component.
      :param api_key: The OpenAI API key. It can be explicitly provided or automatically read from the
                      environment variable OPENAI_API_KEY (recommended).
      :param model: The name of the model to use.
      :param api_base_url: The OpenAI API Base url, defaults to None. For more details, see OpenAI [docs](https://platform.openai.com/docs/api-reference/audio).
      :param organization: The Organization ID, defaults to `None`. See
      [production best practices](https://platform.openai.com/docs/guides/production-best-practices/setting-up-your-organization).
      :param prefix: A string to add to the beginning of each text.
      :param suffix: A string to add to the end of each text.
      :param batch_size: Number of Documents to encode at once.
      :param progress_bar: Whether to show a progress bar or not. Can be helpful to disable in production deployments
                           to keep the logs clean.
      :param meta_fields_to_embed: List of meta fields that should be embedded along with the Document text.
      :param embedding_separator: Separator used to concatenate the meta fields to the Document text.
      """
      self.model = model
      self.api_base_url = api_base_url
      self.organization = organization
      self.prefix = prefix
      self.suffix = suffix
      self.batch_size = batch_size
      self.progress_bar = progress_bar
      self.meta_fields_to_embed = meta_fields_to_embed or []
      self.embedding_separator = embedding_separator
  
      self.client = OpenAI(
          api_key=api_key,
          organization=organization,
          base_url=api_base_url,
      )
  
file_path: haystack/haystack/components/embedders/openai_document_embedder.py
imports: from typing import List, Optional, Dict, Any, Tuple
  from openai import OpenAI
  from tqdm import tqdm
  from haystack import component, Document, default_to_dict
label_desc: Use image node_id 1 to create a new OpenAIDocumentEmbedder object  with example: obj = OpenAIDocumentEmbedder(api_key, model, api_base_url, organization, prefix, suffix, batch_size, progress_bar, meta_fields_to_embed, embedding_separator)