Openai
            zenml.integrations.openai
    Initialization of the OpenAI integration.
Attributes
            OPEN_AI = 'openai'
  
      module-attribute
  
    Classes
            Integration
    Base class for integration in ZenML.
Functions
            activate() -> None
  
      classmethod
  
    Abstract method to activate the integration.
Source code in src/zenml/integrations/integration.py
              140 141 142  |  | 
            check_installation() -> bool
  
      classmethod
  
    Method to check whether the required packages are installed.
Returns:
| Type | Description | 
|---|---|
                  bool
             | 
            
               True if all required packages are installed, False otherwise.  | 
          
Source code in src/zenml/integrations/integration.py
              63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98  |  | 
            flavors() -> List[Type[Flavor]]
  
      classmethod
  
    Abstract method to declare new stack component flavors.
Returns:
| Type | Description | 
|---|---|
                  List[Type[Flavor]]
             | 
            
               A list of new stack component flavors.  | 
          
Source code in src/zenml/integrations/integration.py
              144 145 146 147 148 149 150 151  |  | 
            get_requirements(target_os: Optional[str] = None, python_version: Optional[str] = None) -> List[str]
  
      classmethod
  
    Method to get the requirements for the integration.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                target_os
             | 
            
                  Optional[str]
             | 
            
               The target operating system to get the requirements for.  | 
            
                  None
             | 
          
                python_version
             | 
            
                  Optional[str]
             | 
            
               The Python version to use for the requirements.  | 
            
                  None
             | 
          
Returns:
| Type | Description | 
|---|---|
                  List[str]
             | 
            
               A list of requirements.  | 
          
Source code in src/zenml/integrations/integration.py
              100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115  |  | 
            get_uninstall_requirements(target_os: Optional[str] = None) -> List[str]
  
      classmethod
  
    Method to get the uninstall requirements for the integration.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                target_os
             | 
            
                  Optional[str]
             | 
            
               The target operating system to get the requirements for.  | 
            
                  None
             | 
          
Returns:
| Type | Description | 
|---|---|
                  List[str]
             | 
            
               A list of requirements.  | 
          
Source code in src/zenml/integrations/integration.py
              117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138  |  | 
            plugin_flavors() -> List[Type[BasePluginFlavor]]
  
      classmethod
  
    Abstract method to declare new plugin flavors.
Returns:
| Type | Description | 
|---|---|
                  List[Type[BasePluginFlavor]]
             | 
            
               A list of new plugin flavors.  | 
          
Source code in src/zenml/integrations/integration.py
              153 154 155 156 157 158 159 160  |  | 
            OpenAIIntegration
    
Modules
            hooks
    Initialization of the OpenAI hooks module.
Functions
Modules
            open_ai_failure_hook
    Functionality for OpenAI standard hooks.
openai_alerter_failure_hook_helper(exception: BaseException, model_name: str) -> None
Standard failure hook that sends a message to an Alerter.
Your OpenAI API key must be stored in the secret store under the name "openai" and with the key "api_key".
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                exception
             | 
            
                  BaseException
             | 
            
               The exception that was raised.  | 
            required | 
                model_name
             | 
            
                  str
             | 
            
               The OpenAI model to use for the chatbot.  | 
            required | 
This implementation uses the OpenAI v1 SDK with automatic retries and backoff.
Source code in src/zenml/integrations/openai/hooks/open_ai_failure_hook.py
              30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117  |  | 
openai_chatgpt_alerter_failure_hook(exception: BaseException) -> None
Alerter hook that uses the OpenAI ChatGPT model.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                exception
             | 
            
                  BaseException
             | 
            
               The exception that was raised.  | 
            required | 
Source code in src/zenml/integrations/openai/hooks/open_ai_failure_hook.py
              120 121 122 123 124 125 126 127 128  |  | 
openai_gpt4_alerter_failure_hook(exception: BaseException) -> None
Alerter hook that uses the OpenAI GPT-4 model.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                exception
             | 
            
                  BaseException
             | 
            
               The exception that was raised.  | 
            required | 
Source code in src/zenml/integrations/openai/hooks/open_ai_failure_hook.py
              131 132 133 134 135 136 137 138 139  |  |