
    hd                    h   S SK Jr  S SKJrJrJrJr  S SKJr  S SK	r	SSK
Jr  SSKJrJrJr  SSKJrJrJrJrJrJr  SS	KJrJrJrJr  SS
KJr  SSKJrJ r   SSK!J"r"J#r#  SSK$J%r%  SSK&J'r'  SSK(J)r)  SS/r* " S S\5      r+ " S S\ 5      r, " S S5      r- " S S5      r. " S S5      r/ " S S5      r0g)    )annotations)UnionMappingOptionalcast)LiteralN   )_legacy_response)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)
ImageModel)ImagesResponseImagesAsyncImagesc                  6   \ rS rSr\SS j5       r\SS j5       r\\\\\SSS\S.	                     SS jjr\\\\\\SSS\S.
                         SS jjr	\\\\\\\SSS\S	.                         SS
 jjr
Srg)r       c                    [        U 5      $ z
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
)ImagesWithRawResponseselfs    I/var/www/html/env/lib/python3.13/site-packages/openai/resources/images.pywith_raw_responseImages.with_raw_response   s     %T**    c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
)ImagesWithStreamingResponser'   s    r)   with_streaming_responseImages.with_streaming_response(   s     +400r,   N	modelnresponse_formatsizeuserextra_headersextra_query
extra_bodytimeoutc       
            [        UUUUUUS.5      n[        [        [        [        [
        4   U5      S//S9nSS0U=(       d    0 EnU R                  S[        U[        R                  5      U[        XxXS9[        S9$ )	g  
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
imager3   r4   r5   r6   r7   r?   pathsContent-Typemultipart/form-data/images/variationsr8   r9   r:   r;   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   ImageCreateVariationParamsr   r   r(   r?   r3   r4   r5   r6   r7   r8   r9   r:   r;   rG   rH   s                r)   create_variationImages.create_variation1   s    `  #2	
 d73;#7>ykR ()>X=CVTVXzz  'D'_'_`(+Q[ #  
 	
r,   
maskr3   r4   r5   r6   r7   r8   r9   r:   r;   c                  [        UUUUUUUUS.5      n[        [        [        [        [
        4   U5      S/S//S9nSS0U	=(       d    0 En	U R                  S[        U[        R                  5      U[        XXS9[        S	9$ )
  
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
r?   promptrS   r3   r4   r5   r6   r7   r?   rS   r@   rB   rC   /images/editsrE   rF   )r   r   r   r   rK   rL   rM   r   r   ImageEditParamsr   r   r(   r?   rW   rS   r3   r4   r5   r6   r7   r8   r9   r:   r;   rG   rH   s                  r)   editImages.editz   s    p   #2	
 d73;#7>ySYRZF[\ ()>X=CVTVXzz '8'H'HI(+Q[ #  
 	
r,   r3   r4   qualityr5   r6   styler7   r8   r9   r:   r;   c                   U R                  S[        UUUUUUUUS.[        R                  5      [	        XXS9[
        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`. 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rW   r3   r4   r^   r5   r6   r_   r7   rE   rG   rI   rJ   )rM   r   r   ImageGenerateParamsr   r   r(   rW   r3   r4   r^   r5   r6   r_   r7   r8   r9   r:   r;   s                r)   generateImages.generate   sc    v zz! $"&'6 " 	 &99 )+Q[ #%  
 	
r,    )returnr&   )rj   r/   r?   r   r3   'Union[str, ImageModel, None] | NotGivenr4   Optional[int] | NotGivenr5   /Optional[Literal['url', 'b64_json']] | NotGivenr6   ?Optional[Literal['256x256', '512x512', '1024x1024']] | NotGivenr7   str | NotGivenr8   Headers | Noner9   Query | Noner:   Body | Noner;   'float | httpx.Timeout | None | NotGivenrj   r   r?   r   rW   rK   rS   zFileTypes | NotGivenr3   rl   r4   rm   r5   rn   r6   ro   r7   rp   r8   rq   r9   rr   r:   rs   r;   rt   rj   r   rW   rK   r3   rl   r4   rm   r^   z$Literal['standard', 'hd'] | NotGivenr5   rn   r6   zYOptional[Literal['256x256', '512x512', '1024x1024', '1792x1024', '1024x1792']] | NotGivenr_   z0Optional[Literal['vivid', 'natural']] | NotGivenr7   rp   r8   rq   r9   rr   r:   rs   r;   rt   rj   r   __name__
__module____qualname____firstlineno__r   r*   r0   r   rP   r[   rg   __static_attributes__ri   r,   r)   r    r       sH   + + 1 1 :C&/KTPY( )-$("&;DG
 G
 7	G

 $G
 IG
 NG
 G
 &G
 "G
  G
 9G
 
G
\ &/9B&/KTPY( )-$("&;D!Q
 Q
 	Q

 #Q
 7Q
 $Q
 IQ
 NQ
 Q
 &Q
 "Q
  Q
  9!Q
" 
#Q
n :C&/8AKTjsBK( )-$("&;D!N
 N
 7	N

 $N
 6N
 IN
 hN
 @N
 N
 &N
 "N
  N
  9!N
" 
#N
 N
r,   c                  6   \ rS rSr\SS j5       r\SS j5       r\\\\\SSS\S.	                     SS jjr\\\\\\SSS\S.
                         SS jjr	\\\\\\\SSS\S	.                         SS
 jjr
Srg)r!   i  c                    [        U 5      $ r%   )AsyncImagesWithRawResponser'   s    r)   r*   AsyncImages.with_raw_response  s     *$//r,   c                    [        U 5      $ r.   ) AsyncImagesWithStreamingResponser'   s    r)   r0   #AsyncImages.with_streaming_response)  s     055r,   Nr2   c       
        0  #    [        UUUUUUS.5      n[        [        [        [        [
        4   U5      S//S9nSS0U=(       d    0 EnU R                  S[        U[        R                  5      I Sh  vN U[        XxXS9[        S	9I Sh  vN $  N N7f)
r=   r>   r?   r@   rB   rC   rD   NrE   rF   )r   r   r   r   rK   rL   rM   r   r   rN   r   r   rO   s                r)   rP   AsyncImages.create_variation2  s     `  #2	
 d73;#7>ykR ()>X=CVTVXZZ ,T3P3k3kll(+Q[ #   
 
 	
l
s$   A2B4B
5BBBBrR   c               8  #    [        UUUUUUUUS.5      n[        [        [        [        [
        4   U5      S/S//S9nSS0U	=(       d    0 En	U R                  S[        U[        R                  5      I Sh  vN U[        XXS	9[        S
9I Sh  vN $  N N7f)rU   rV   r?   rS   r@   rB   rC   rX   NrE   rF   )r   r   r   r   rK   rL   rM   r   r   rY   r   r   rZ   s                  r)   r[   AsyncImages.edit{  s     p   #2	
 d73;#7>ySYRZF[\ ()>X=CVTVXZZ,T3D3T3TUU(+Q[ #   
 
 	
U
s$   A6B8B
9BBBBr]   c                  #    U R                  S[        UUUUUUUUS.[        R                  5      I Sh  vN [	        XXS9[
        S9I Sh  vN $  N N7f)ra   rb   rc   NrE   rd   )rM   r   r   re   r   r   rf   s                r)   rg   AsyncImages.generate  sz     v ZZ!,$"&'6 " 	 &99  )+Q[ #%   
 
 	

s!   3AA
AAAAri   )rj   r   )rj   r   rk   ru   rv   rw   ri   r,   r)   r!   r!     sH   0 0 6 6 :C&/KTPY( )-$("&;DG
 G
 7	G

 $G
 IG
 NG
 G
 &G
 "G
  G
 9G
 
G
\ &/9B&/KTPY( )-$("&;D!Q
 Q
 	Q

 #Q
 7Q
 $Q
 IQ
 NQ
 Q
 &Q
 "Q
  Q
  9!Q
" 
#Q
n :C&/8AKTjsBK( )-$("&;D!N
 N
 7	N

 $N
 6N
 IN
 hN
 @N
 N
 &N
 "N
  N
  9!N
" 
#N
 N
r,   c                      \ rS rSrSS jrSrg)r&   i  c                    Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        g N)_imagesr
   to_raw_response_wrapperrP   r[   rg   r(   imagess     r)   __init__ImagesWithRawResponse.__init__   sY     0 H H##!
 %<<KK
	 )@@OO
r,   r   rP   r[   rg   Nr   r    rj   Nonerx   ry   rz   r{   r   r|   ri   r,   r)   r&   r&         
r,   r&   c                      \ rS rSrSS jrSrg)r   i.  c                    Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        g r   )r   r
   async_to_raw_response_wrapperrP   r[   rg   r   s     r)   r   #AsyncImagesWithRawResponse.__init__/  sY     0 N N##!
 %BBKK
	 )FFOO
r,   r   Nr   r!   rj   r   r   ri   r,   r)   r   r   .  r   r,   r   c                      \ rS rSrSS jrSrg)r/   i=  c                    Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )r   r   rP   r[   rg   r   s     r)   r   $ImagesWithStreamingResponse.__init__>  sG     <##!
 1KK
	 5OO
r,   r   Nr   r   ri   r,   r)   r/   r/   =  r   r,   r/   c                      \ rS rSrSS jrSrg)r   iL  c                    Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )r   r   rP   r[   rg   r   s     r)   r   )AsyncImagesWithStreamingResponse.__init__M  sG     B##!
 7KK
	 ;OO
r,   r   Nr   r   ri   r,   r)   r   r   L  r   r,   r   )1
__future__r   typingr   r   r   r   typing_extensionsr   httpx r
   typesr   r   r   _typesr   r   r   r   r   r   _utilsr   r   r   r   _compatr   	_resourcer   r   	_responser   r   _base_clientr   types.image_modelr   types.images_responser   __all__r    r!   r&   r   r/   r   ri   r,   r)   <module>r      s    # 1 1 %   [ [ I I  & 9 X / * 2]
#~
_ ~
B~
" ~
B
 

 

 

 
r,   