a
    f	g                     @   sD   d dl Z d dlmZmZ d dlmZ d dlmZ G dd deZdS )    N)utilerror)EngineAPIResource)TryAgainc                       s4   e Zd ZdZe fddZe fddZ  ZS )EditZeditsc              
      s   t   }|dd}|dd}| j|dd }|tjjtjjfv rNtdzt	 j
|i |W S  ty } z4|durt   || kr tjd|d W Y d}~qNd}~0 0 qNdS 	zY
        Creates a new edit for the provided input, instruction, and parameters.
        timeoutNapi_type)r	   r   z<This operation is not supported by the Azure OpenAI API yet.zWaiting for model to warm up)r   )timepop_get_api_type_and_versionr   ApiTypeAZUREAZURE_ADr   InvalidAPITypesupercreater   log_infoclsargskwargsstartr   r	   Ztyped_api_typee	__class__ \/var/www/html/llm_bihealth/app/venv/lib/python3.9/site-packages/openai/api_resources/edit.pyr      s    zEdit.createc              
      s   t   }|dd}|dd}| j|dd }|tjjtjjfv rNtdzt	 j
|i |I dH W S  ty } z4|durt   || kr tjd|d W Y d}~qNd}~0 0 qNdS r   )r
   r   r   r   r   r   r   r   r   r   acreater   r   r   r   r   r   r   #   s    zEdit.acreate)__name__
__module____qualname__ZOBJECT_NAMEclassmethodr   r   __classcell__r   r   r   r   r      s
   r   )	r
   Zopenair   r   Z1openai.api_resources.abstract.engine_api_resourcer   Zopenai.errorr   r   r   r   r   r   <module>   s   