class_docstr: Enables text generation using OpenAI's large language models (LLMs) on Azure. It supports gpt-4 and gpt-3.5-turbo
  family of models.
  
  Users can pass any text generation parameters valid for the `openai.ChatCompletion.create` method
  directly to this component via the `**generation_kwargs` parameter in __init__ or the `**generation_kwargs`
  parameter in `run` method.
  
  For more details on OpenAI models deployed on Azure, refer to the Microsoft
  [documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/).
  
  
  ```python
  from haystack.components.generators import AzureOpenAIGenerator
  client = AzureOpenAIGenerator(azure_endpoint="<Your Azure endpoint e.g. `https://your-company.azure.openai.com/>",
                          api_key="<you api key>",
                          azure_deployment="<this a model name, e.g. gpt-35-turbo>")
  response = client.run("What's Natural Language Processing? Be brief.")
  print(response)
  
  >> {'replies': ['Natural Language Processing (NLP) is a branch of artificial intelligence that focuses on
  >> the interaction between computers and human language. It involves enabling computers to understand, interpret,
  >> and respond to natural human language in a way that is both meaningful and useful.'], 'meta': [{'model':
  >> 'gpt-3.5-turbo-0613', 'index': 0, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 16,
  >> 'completion_tokens': 49, 'total_tokens': 65}}]}
  ```
  
   Key Features and Compatibility:
       - **Primary Compatibility**: Designed to work seamlessly with gpt-4, gpt-3.5-turbo family of models.
       - **Streaming Support**: Supports streaming responses from the OpenAI API.
       - **Customizability**: Supports all parameters supported by the OpenAI API.
  
   Input and Output Format:
       - **String Format**: This component uses the strings for both input and output.
class_docstr_tok: ["Enables","text","generation","using","OpenAI","'s","large","language","models","(","LLMs",")","on","Azure",".","It","supports","gpt-4","and","gpt-3.5-turbo","family","of","models",".","Users","can","pass","any","text","generation","parameters","valid","for","the","`","openai.ChatCompletion.create","`","method","directly","to","this","component","via","the","`","*","*","generation_kwargs","`","parameter","in","__init__","or","the","`","*","*","generation_kwargs","`","parameter","in","`","run","`","method",".","For","more","details","on","OpenAI","models","deployed","on","Azure",",","refer","to","the","Microsoft","[","documentation","]","(","https",":","\/\/learn.microsoft.com\/en-us\/azure\/ai-services\/openai\/",")",".","``","`","python","from","haystack.components.generators","import","AzureOpenAIGenerator","client","=","AzureOpenAIGenerator","(","azure_endpoint=","''","<","Your","Azure","endpoint","e.g",".","`","https",":","\/\/your-company.azure.openai.com\/",">","''",",","api_key=","''","<","you","api","key",">","''",",","azure_deployment=","''","<","this","a","model","name",",","e.g",".","gpt-35-turbo",">","''",")","response","=","client.run","(","``","What","'s","Natural","Language","Processing","?","Be","brief",".","''",")","print","(","response",")",">",">","{","'replies","'",":","[","'Natural","Language","Processing","(","NLP",")","is","a","branch","of","artificial","intelligence","that","focuses","on",">",">","the","interaction","between","computers","and","human","language",".","It","involves","enabling","computers","to","understand",",","interpret",",",">",">","and","respond","to","natural","human","language","in","a","way","that","is","both","meaningful","and","useful",".","'","]",",","'meta","'",":","[","{","'model","'",":",">",">","'gpt-3.5-turbo-0613","'",",","'index","'",":","0",",","'finish_reason","'",":","'stop","'",",","'usage","'",":","{","'prompt_tokens","'",":","16",",",">",">","'completion_tokens","'",":","49",",","'total_tokens","'",":","65","}","}","]","}","``","`","Key","Features","and","Compatibility",":","-","*","*","Primary","Compatibility","*","*",":","Designed","to","work","seamlessly","with","gpt-4",",","gpt-3.5-turbo","family","of","models",".","-","*","*","Streaming","Support","*","*",":","Supports","streaming","responses","from","the","OpenAI","API",".","-","*","*","Customizability","*","*",":","Supports","all","parameters","supported","by","the","OpenAI","API",".","Input","and","Output","Format",":","-","*","*","String","Format","*","*",":","This","component","uses","the","strings","for","both","input","and","output","."]
docstr: Serialize this component to a dictionary.
  :return: The serialized component as a dictionary.
docstr_tok: ["Serialize","this","component","to","a","dictionary",".",":","return",":","The","serialized","component","as","a","dictionary","."]
code: def to_dict(self) -> Dict[str, Any]:
      """
      Serialize this component to a dictionary.
      :return: The serialized component as a dictionary.
      """
      callback_name = (
          serialize_callback_handler(self.streaming_callback)
          if self.streaming_callback
          else None
      )
      return default_to_dict(
          self,
          azure_endpoint=self.azure_endpoint,
          azure_deployment=self.azure_deployment,
          organization=self.organization,
          api_version=self.api_version,
          streaming_callback=callback_name,
          generation_kwargs=self.generation_kwargs,
          system_prompt=self.system_prompt,
      )
  
file_path: haystack/haystack/components/generators/azure.py
imports: import logging
  import os
  from typing import Optional, Callable, Dict, Any
  from openai.lib.azure import AzureADTokenProvider, AzureOpenAI
  from haystack import default_to_dict, default_from_dict
  from haystack.components.generators import OpenAIGenerator
  from haystack.components.generators.utils import serialize_callback_handler, deserialize_callback_handler
  from haystack.dataclasses import StreamingChunk
label_desc: Use image node_id 2 for calling the AzureOpenAIGenerator obj's underlying member method code with example usage: obj.to_dict() and returns: default_to_dict