o
    CjiY                     @  s  d dl mZ d dlmZmZmZmZmZ d dlm	Z	 d dl
Z
ddlmZmZmZmZ ddlmZmZmZmZmZmZ ddlmZmZmZ dd	lmZmZ dd
lmZm Z  ddl!m"Z" erdd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 )    )annotations)TYPE_CHECKINGUnionMappingOptionalcast)LiteralN   )ImagesResponseimage_edit_paramsimage_generate_paramsimage_create_variation_params)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimal)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)make_request_options)OpenAIAsyncOpenAIImagesAsyncImagesc                         e Zd ZU ded< d2 fddZeeeeed	d	d	ed
	d3d d!Zeeeeeed	d	d	ed"
d4d'd(Zeeeeeeed	d	d	ed)d5d0d1Z  Z	S )6r   ImagesWithRawResponsewith_raw_responseclientr   returnNonec                      t  | t| | _d S N)super__init__r!   r"   selfr#   	__class__ n/var/www/html/Resume-Parser/resume-parser-inhouse/venv/lib/python3.10/site-packages/openai/resources/images.pyr)         zImages.__init__N	modelnresponse_formatsizeuserextra_headersextra_query
extra_bodytimeoutimager   r2   0Union[str, Literal['dall-e-2'], None] | NotGivenr3   Optional[int] | NotGivenr4   /Optional[Literal['url', 'b64_json']] | NotGivenr5   ?Optional[Literal['256x256', '512x512', '1024x1024']] | NotGivenr6   str | NotGivenr7   Headers | Noner8   Query | Noner9   Body | Noner:   'float | httpx.Timeout | None | NotGivenr
   c       
      
   C  sp   t ||||||d}tttttf |dggd}|r$ddi|p"i }| jdt|tj	|t
|||	|
dtdS )	  
        Creates a variation of a given image.

        Args:
          image: The image to use as the basis for the variation(s). Must be a valid PNG file,
              less than 4MB, and square.

          model: The model to use for image generation. Only `dall-e-2` is supported at this
              time.

          n: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
              `n=1` is supported.

          response_format: The format in which the generated images are returned. Must be one of `url` or
              `b64_json`.

          size: The size of the generated images. Must be one of `256x256`, `512x512`, or
              `1024x1024`.

          user: A unique identifier representing your end-user, which can help OpenAI to monitor
              and detect abuse.
              [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).

          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
        r;   r2   r3   r4   r5   r6   r;   pathsContent-Typemultipart/form-data/images/variationsr7   r8   r9   r:   bodyfilesoptionscast_tor   r   r   r   strobject_postr   r   ImageCreateVariationParamsr   r
   r+   r;   r2   r3   r4   r5   r6   r7   r8   r9   r:   rN   rO   r.   r.   r/   create_variation#   s*   /

zImages.create_variation
maskr2   r3   r4   r5   r6   r7   r8   r9   r:   promptrS   rZ   FileTypes | NotGivenc             
   C  sx   t ||||||||d}tttttf |dgdggd}|r(ddi|	p&i }	| jdt|tj	|t
|	|
||dtd	S )
F  
        Creates an edited or extended image given an original image and a prompt.

        Args:
          image: The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask
              is not provided, image must have transparency, which will be used as the mask.

          prompt: A text description of the desired image(s). The maximum length is 1000
              characters.

          mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
              indicate where `image` should be edited. Must be a valid PNG file, less than
              4MB, and have the same dimensions as `image`.

          model: The model to use for image generation. Only `dall-e-2` is supported at this
              time.

          n: The number of images to generate. Must be between 1 and 10.

          response_format: The format in which the generated images are returned. Must be one of `url` or
              `b64_json`.

          size: The size of the generated images. Must be one of `256x256`, `512x512`, or
              `1024x1024`.

          user: A unique identifier representing your end-user, which can help OpenAI to monitor
              and detect abuse.
              [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).

          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
        r;   r[   rZ   r2   r3   r4   r5   r6   r;   rZ   rG   rI   rJ   /images/editsrL   rM   r   r   r   r   rS   rT   rU   r   r   ImageEditParamsr   r
   r+   r;   r[   rZ   r2   r3   r4   r5   r6   r7   r8   r9   r:   rN   rO   r.   r.   r/   editm   s.   7"
zImages.editr2   r3   qualityr4   r5   styler6   r7   r8   r9   r:   <Union[str, Literal['dall-e-2', 'dall-e-3'], None] | NotGivenre   $Literal['standard', 'hd'] | NotGivenYOptional[Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792']] | NotGivenrf   0Optional[Literal['vivid', 'natural']] | NotGivenc                C  s8   | j dt||||||||dtjt|	|
||dtdS )9  
        Creates an image given a prompt.

        Args:
          prompt: A text description of the desired image(s). The maximum length is 1000
              characters for `dall-e-2` and 4000 characters for `dall-e-3`.

          model: The model to use for image generation.

          n: The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only
              `n=1` is supported.

          quality: The quality of the image that will be generated. `hd` creates images with finer
              details and greater consistency across the image. This param is only supported
              for `dall-e-3`.

          response_format: The format in which the generated images are returned. Must be one of `url` or
              `b64_json`.

          size: The size of the generated images. Must be one of `256x256`, `512x512`, or
              `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or
              `1024x1792` for `dall-e-3` models.

          style: The style of the generated images. Must be one of `vivid` or `natural`. Vivid
              causes the model to lean towards generating hyper-real and dramatic images.
              Natural causes the model to produce more natural, less hyper-real looking
              images. This param is only supported for `dall-e-3`.

          user: A unique identifier representing your end-user, which can help OpenAI to monitor
              and detect abuse.
              [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).

          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
        /images/generationsr[   r2   r3   re   r4   r5   rf   r6   rL   rN   rP   rQ   rU   r   r   ImageGenerateParamsr   r
   r+   r[   r2   r3   re   r4   r5   rf   r6   r7   r8   r9   r:   r.   r.   r/   generate   s&   :
zImages.generate)r#   r   r$   r%   r;   r   r2   r<   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r8   rB   r9   rC   r:   rD   r$   r
   r;   r   r[   rS   rZ   r\   r2   r<   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r8   rB   r9   rC   r:   rD   r$   r
   r[   rS   r2   rg   r3   r=   re   rh   r4   r>   r5   ri   rf   rj   r6   r@   r7   rA   r8   rB   r9   rC   r:   rD   r$   r
   
__name__
__module____qualname____annotations__r)   r   rX   rc   rr   __classcell__r.   r.   r,   r/   r      H   
 OXc                      r    )6r   AsyncImagesWithRawResponser"   r#   r   r$   r%   c                   r&   r'   )r(   r)   r}   r"   r*   r,   r.   r/   r)     r0   zAsyncImages.__init__Nr1   r;   r   r2   r<   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r8   rB   r9   rC   r:   rD   r
   c       
      
     sx   t ||||||d}tttttf |dggd}|r%ddi|p#i }| jdt|tj	|t
|||	|
dtdI d	H S )
rE   rF   r;   rG   rI   rJ   rK   rL   rM   NrR   rW   r.   r.   r/   rX     s,   /

zAsyncImages.create_variationrY   r[   rS   rZ   r\   c             
     s   t ||||||||d}tttttf |dgdggd}|r)ddi|	p'i }	| jdt|tj	|t
|	|
||dtd	I d
H S )r]   r^   r;   rZ   rG   rI   rJ   r_   rL   rM   Nr`   rb   r.   r.   r/   rc   b  s0   7"
zAsyncImages.editrd   rg   re   rh   ri   rf   rj   c                  s@   | j dt||||||||dtjt|	|
||dtdI dH S )rk   rl   rm   rL   rn   Nro   rq   r.   r.   r/   rr     s(   :
zAsyncImages.generate)r#   r   r$   r%   rs   rt   ru   rv   r.   r.   r,   r/   r     r|   c                   @     e Zd ZdddZdS )	r!   imagesr   r$   r%   c                 C  (   t |j| _t |j| _t |j| _d S r'   )r   rX   rc   rr   r+   r   r.   r.   r/   r)        
zImagesWithRawResponse.__init__N)r   r   r$   r%   rw   rx   ry   r)   r.   r.   r.   r/   r!         r!   c                   @  r~   )	r}   r   r   r$   r%   c                 C  r   r'   )r   rX   rc   rr   r   r.   r.   r/   r)     r   z#AsyncImagesWithRawResponse.__init__N)r   r   r$   r%   r   r.   r.   r.   r/   r}     r   r}   )+
__future__r   typingr   r   r   r   r   typing_extensionsr   httpxtypesr
   r   r   r   _typesr   r   r   r   r   r   _utilsr   r   r   	_resourcer   r   	_responser   r   _base_clientr   _clientr   r   __all__r   r   r!   r}   r.   r.   r.   r/   <module>   s&     v v