a
    !fy                     @  s   d dl mZ d dlZd dlmZmZmZ d dlmZ d dlZddl	m
Z
mZ ddlmZmZmZmZmZ ddlmZ dd	lmZmZ dd
lmZmZ ddlmZ erddlmZmZ ddgZG dd deZ G dd deZ!G dd dZ"G dd dZ#dS )    )annotationsN)TYPE_CHECKINGUnionOptional)Literal   )Editedit_create_params)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)make_request_options)OpenAIAsyncOpenAIEdits
AsyncEditsc                      sn   e Zd ZU ded< ddd fddZedeeeed	d	d	ed
ddddddddddddddZ  Z	S )r   EditsWithRawResponsewith_raw_responser   Noneclientreturnc                   s   t  | t| | _d S N)super__init__r   r   selfr   	__class__ W/var/www/html/python-backend/venv/lib/python3.9/site-packages/openai/resources/edits.pyr!      s    zEdits.__init__The Edits API is deprecated; please use Chat Completions instead.

https://openai.com/blog/gpt-4-api-general-availability#deprecation-of-the-edits-api
Ninputntemperaturetop_pextra_headersextra_query
extra_bodytimeoutstrEUnion[str, Literal['text-davinci-edit-001', 'code-davinci-edit-001']]Optional[str] | NotGivenOptional[int] | NotGivenOptional[float] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr   instructionmodelr*   r+   r,   r-   r.   r/   r0   r1   r   c       
      
   C  s4   | j dt||||||dtjt|||	|
dtdS )  
        Creates a new edit for the provided input, instruction, and parameters.

        Args:
          instruction: The instruction that tells the model how to edit the prompt.

          model: ID of the model to use. You can use the `text-davinci-edit-001` or
              `code-davinci-edit-001` model with this endpoint.

          input: The input text to use as a starting point for the edit.

          n: How many edits to generate for the input and instruction.

          temperature: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will
              make the output more random, while lower values like 0.2 will make it more
              focused and deterministic.

              We generally recommend altering this or `top_p` but not both.

          top_p: An alternative to sampling with temperature, called nucleus sampling, where the
              model considers the results of the tokens with top_p probability mass. So 0.1
              means only the tokens comprising the top 10% probability mass are considered.

              We generally recommend altering this or `temperature` but not both.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        /editsr<   r=   r*   r+   r,   r-   r.   r/   r0   r1   bodyoptionsZcast_to_postr   r	   ZEditCreateParamsr   r   r#   r<   r=   r*   r+   r,   r-   r.   r/   r0   r1   r&   r&   r'   create   s"    4zEdits.create
__name__
__module____qualname____annotations__r!   typing_extensions
deprecatedr
   rH   __classcell__r&   r&   r$   r'   r      s   
c                      sn   e Zd ZU ded< ddd fddZedeeeed	d	d	ed
ddddddddddddddZ  Z	S )r   AsyncEditsWithRawResponser   r   r   r   c                   s   t  | t| | _d S r   )r    r!   rQ   r   r"   r$   r&   r'   r!   j   s    zAsyncEdits.__init__r(   Nr)   r2   r3   r4   r5   r6   r7   r8   r9   r:   r   r;   c       
      
     s:   | j dt||||||dtjt|||	|
dtdI dH S )r>   r?   r@   rA   rB   NrE   rG   r&   r&   r'   rH   n   s"    4zAsyncEdits.createrI   r&   r&   r$   r'   r   g   s   
c                   @  s   e Zd ZdddddZdS )r   r   r   editsr   c                 C  s   t |j| _d S r   )r   rH   r#   rS   r&   r&   r'   r!      s    zEditsWithRawResponse.__init__NrJ   rK   rL   r!   r&   r&   r&   r'   r      s   r   c                   @  s   e Zd ZdddddZdS )rQ   r   r   rR   c                 C  s   t |j| _d S r   )r   rH   rT   r&   r&   r'   r!      s    z"AsyncEditsWithRawResponse.__init__NrU   r&   r&   r&   r'   rQ      s   rQ   )$
__future__r   rN   typingr   r   r   r   Zhttpxtypesr   r	   _typesr
   r   r   r   r   _utilsr   Z	_resourcer   r   	_responser   r   Z_base_clientr   Z_clientr   r   __all__r   r   r   rQ   r&   r&   r&   r'   <module>   s"   OO