
    f j`                    z   d dl mZ d dlmZmZmZmZ d dlmZ d dl	Z	ddl
m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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& ddgZ' G d de           Z( G d de!          Z) G d d          Z* G d d          Z+ G d d          Z, G d d          Z-dS )    )annotations)UnionMappingOptionalcast)LiteralN   )_legacy_response)ImagesResponseimage_edit_paramsimage_generate_paramsimage_create_variation_params)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)extract_filesmaybe_transformdeepcopy_minimalasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)make_request_optionsImagesAsyncImagesc                      e Zd Zed,d            Zed-d            Zeeeeeddded	d.dZeeeeeeddded
d/d#Zeeeeeeeddded$d0d+Z	dS )1r   returnImagesWithRawResponsec                     t          |           S N)r#   selfs    kC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\openai/resources/images.pywith_raw_responsezImages.with_raw_response#   s    $T***    ImagesWithStreamingResponsec                     t          |           S r%   )r+   r&   s    r(   with_streaming_responsezImages.with_streaming_response'   s    *4000r*   N	modelnresponse_formatsizeuserextra_headersextra_query
extra_bodytimeoutimager   r/   0Union[str, Literal['dall-e-2'], None] | NotGivenr0   Optional[int] | NotGivenr1   /Optional[Literal['url', 'b64_json']] | NotGivenr2   ?Optional[Literal['256x256', '512x512', '1024x1024']] | NotGivenr3   str | NotGivenr4   Headers | Noner5   Query | Noner6   Body | Noner7   'float | httpx.Timeout | None | NotGivenr   c       
        B   t          ||||||d          }t          t          t          t          t
          f         |          dgg          }|rddi|pi }|                     dt          |t          j	                  |t          |||	|
          t                    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`. URLs are only valid for 60 minutes after the image has been
              generated.

          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
        r8   r/   r0   r1   r2   r3   r8   pathsContent-Typemultipart/form-data/images/variationsr4   r5   r6   r7   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   ImageCreateVariationParamsr   r   r'   r8   r/   r0   r1   r2   r3   r4   r5   r6   r7   rL   rM   s                r(   create_variationzImages.create_variation+   s    `  #2 	
 	
 d73;#7>>ykRRR 	] ,-B\}GZXZ\Mzz  'D'_``(+Q[el   #  
 
 	
r*   
maskr/   r0   r1   r2   r3   r4   r5   r6   r7   promptrP   rW   FileTypes | NotGivenc               J   t          ||||||||d          }t          t          t          t          t
          f         |          dgdgg          }|rddi|	pi }	|                     dt          |t          j	                  |t          |	|
||          t          	          S )
  
        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`. URLs are only valid for 60 minutes after the image has been
              generated.

          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
        r8   rX   rW   r/   r0   r1   r2   r3   r8   rW   rE   rG   rH   /images/editsrJ   rK   )r   r   r   r   rP   rQ   rR   r   r   ImageEditParamsr   r   r'   r8   rX   rW   r/   r0   r1   r2   r3   r4   r5   r6   r7   rL   rM   s                  r(   editzImages.editu   s    p   #2	 	
 
 d73;#7>>ySYRZF[\\\ 	] ,-B\}GZXZ\Mzz '8'HII(+Q[el   #  
 
 	
r*   r/   r0   qualityr1   r2   styler3   r4   r5   r6   r7   <Union[str, Literal['dall-e-2', 'dall-e-3'], None] | NotGivenrb   $Literal['standard', 'hd'] | NotGivenYOptional[Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792']] | NotGivenrc   0Optional[Literal['vivid', 'natural']] | NotGivenc                   |                      dt          ||||||||dt          j                  t	          |	|
||          t
                    S )  
        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`. URLs are only valid for 60 minutes after the image has been
              generated.

          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rX   r/   r0   rb   r1   r2   rc   r3   rJ   rL   rN   rO   )rR   r   r   ImageGenerateParamsr   r   r'   rX   r/   r0   rb   r1   r2   rc   r3   r4   r5   r6   r7   s                r(   generatezImages.generate   s~    v zz! $"&'6 " 	 	 &9  )+Q[el   #%  
 
 	
r*   )r"   r#   )r"   r+   r8   r   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r"   r   r8   r   rX   rP   rW   rY   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r"   r   rX   rP   r/   rd   r0   r:   rb   re   r1   r;   r2   rf   rc   rg   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r"   r   
__name__
__module____qualname__r   r)   r-   r   rU   r`   ro    r*   r(   r   r   "   s,       + + + _+ 1 1 1 _1 CL&/KTPY( )-$("&;DH
 H
 H
 H
 H
 H
^ &/BK&/KTPY( )-$("&;D!R
 R
 R
 R
 R
 R
p OX&/8AKTjsBK( )-$("&;D!N
 N
 N
 N
 N
 N
 N
 N
r*   c                      e Zd Zed,d            Zed-d            Zeeeeeddded	d.dZeeeeeeddded
d/d#Zeeeeeeeddded$d0d+Z	dS )1r    r"   AsyncImagesWithRawResponsec                     t          |           S r%   )ry   r&   s    r(   r)   zAsyncImages.with_raw_response  s    )$///r*    AsyncImagesWithStreamingResponsec                     t          |           S r%   )r{   r&   s    r(   r-   z#AsyncImages.with_streaming_response  s    /555r*   Nr.   r8   r   r/   r9   r0   r:   r1   r;   r2   r<   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r   c       
        ^  K   t          ||||||d          }t          t          t          t          t
          f         |          dgg          }|rddi|pi }|                     dt          |t          j	                   d{V |t          |||	|
          t          	           d{V S )
rC   rD   r8   rE   rG   rH   rI   NrJ   rK   )r   r   r   r   rP   rQ   rR   r   r   rS   r   r   rT   s                r(   rU   zAsyncImages.create_variation#  s     `  #2 	
 	
 d73;#7>>ykRRR 	] ,-B\}GZXZ\MZZ ,T3P3kllllllll(+Q[el   #   
 
 
 
 
 
 
 
 	
r*   rV   rX   rP   rW   rY   c               f  K   t          ||||||||d          }t          t          t          t          t
          f         |          dgdgg          }|rddi|	pi }	|                     dt          |t          j	                   d{V |t          |	|
||	          t          
           d{V S )r[   r\   r8   rW   rE   rG   rH   r]   NrJ   rK   )r   r   r   r   rP   rQ   rR   r   r   r^   r   r   r_   s                  r(   r`   zAsyncImages.editm  s     p   #2	 	
 
 d73;#7>>ySYRZF[\\\ 	] ,-B\}GZXZ\MZZ,T3D3TUUUUUUUU(+Q[el   #   
 
 
 
 
 
 
 
 	
r*   ra   rd   rb   re   rf   rc   rg   c                  K   |                      dt          ||||||||dt          j                   d{V t	          |	|
||          t
                     d{V S )ri   rj   rk   NrJ   rl   )rR   r   r   rm   r   r   rn   s                r(   ro   zAsyncImages.generate  s      v ZZ!,$"&'6 " 	 	 &9        )+Q[el   #%   
 
 
 
 
 
 
 
 	
r*   )r"   ry   )r"   r{   rp   rq   rr   rs   rw   r*   r(   r    r      s,       0 0 0 _0 6 6 6 _6 CL&/KTPY( )-$("&;DH
 H
 H
 H
 H
 H
^ &/BK&/KTPY( )-$("&;D!R
 R
 R
 R
 R
 R
p OX&/8AKTjsBK( )-$("&;D!N
 N
 N
 N
 N
 N
 N
 N
r*   c                      e Zd ZddZdS )r#   imagesr   r"   Nonec                    || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r%   )_imagesr
   to_raw_response_wrapperrU   r`   ro   r'   r   s     r(   __init__zImagesWithRawResponse.__init__  s^     0 H#!
 !
 %<K
 
	 )@O
 
r*   Nr   r   r"   r   rt   ru   rv   r   rw   r*   r(   r#   r#     (        
 
 
 
 
 
r*   r#   c                      e Zd ZddZdS )ry   r   r    r"   r   c                    || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r%   )r   r
   async_to_raw_response_wrapperrU   r`   ro   r   s     r(   r   z#AsyncImagesWithRawResponse.__init__"  s^     0 N#!
 !
 %BK
 
	 )FO
 
r*   Nr   r    r"   r   r   rw   r*   r(   ry   ry   !  r   r*   ry   c                      e Zd ZddZdS )r+   r   r   r"   r   c                    || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        d S r%   )r   r   rU   r`   ro   r   s     r(   r   z$ImagesWithStreamingResponse.__init__1  sU     <#!
 !
 1K
 
	 5O
 
r*   Nr   r   rw   r*   r(   r+   r+   0  r   r*   r+   c                      e Zd ZddZdS )r{   r   r    r"   r   c                    || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        d S r%   )r   r   rU   r`   ro   r   s     r(   r   z)AsyncImagesWithStreamingResponse.__init__@  sU     B#!
 !
 7K
 
	 ;O
 
r*   Nr   r   rw   r*   r(   r{   r{   ?  r   r*   r{   ).
__future__r   typingr   r   r   r   typing_extensionsr   httpx r
   typesr   r   r   r   _typesr   r   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   _base_clientr   __all__r   r    r#   ry   r+   r{   rw   r*   r(   <module>r      s   # " " " " " 1 1 1 1 1 1 1 1 1 1 1 1 % % % % % %                   J I I I I I I I I I I I I I I I            & % % % % % 9 9 9 9 9 9 9 9 X X X X X X X X      ]
#u
 u
 u
 u
 u
_ u
 u
 u
pu
 u
 u
 u
 u
" u
 u
 u
p
 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
r*   