Ë
    $Æ%hÑ…  ã                  ól  — 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 ddl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l'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«      Z0 G d„ d«      Z1y)é    )Úannotations)ÚListÚ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                  óB  — 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eedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zeeeeeeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„Z	y)r!   c                ó   — t        | «      S ©a  
        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    úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/openai/resources/images.pyÚwith_raw_responsezImages.with_raw_response   s   € ô % TÓ*Ð*ó    c                ó   — t        | «      S ©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_responsezImages.with_streaming_response#   s   € ô +¨4Ó0Ð0r+   N©	ÚmodelÚnÚresponse_formatÚsizeÚuserÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc       
        ó  — t        ||||||dœ«      }t        t        t        t        t
        f   |«      dgg¬«      }ddi|xs i ¥}| j                  dt        |t        j                  «      |t        |||	|
¬«      t        ¬«      S )	á   Creates a variation of a given image.

        This endpoint only supports `dall-e-2`.

        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.

          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
        ©Úimager1   r2   r3   r4   r5   r=   ©ÚpathsúContent-Typeúmultipart/form-dataú/images/variations©r6   r7   r8   r9   ©ÚbodyÚfilesÚoptionsÚcast_to)r   r   r   r   ÚstrÚobjectÚ_postr   r   ÚImageCreateVariationParamsr   r    ©r(   r=   r1   r2   r3   r4   r5   r6   r7   r8   r9   rE   rF   s                r)   Úcreate_variationzImages.create_variation,   s¥   € ô`  àØØØ#2ØØñó	
ˆô œd¤7¬3´¨;Ñ#7¸Ó>ÈÀyÀkÔRˆð (Ð)>ÐXÀ=ÒCVÐTVÐXˆØ�z‰zØ Ü  Ô'D×'_Ñ'_Ó`ØÜ(Ø+¸ÐQ[Ðelôô #ð ó 
ð 	
r+   ©Ú
backgroundÚmaskr1   r2   Úqualityr3   r4   r5   r6   r7   r8   r9   c               ó  — t        |||||||||	|
dœ
«      }t        t        t        t        t
        f   |«      dgddgdgg¬«      }ddi|xs i ¥}| j                  dt        |t        j                  «      |t        ||||¬	«      t        ¬
«      S )á‚  Creates an edited or extended image given one or more source images and a
        prompt.

        This endpoint only supports `gpt-image-1` and `dall-e-2`.

        Args:
          image: The image(s) to edit. Must be a supported image file or an array of images.

              For `gpt-image-1`, each image should be a `png`, `webp`, or `jpg` file less than
              25MB. You can provide up to 16 images.

              For `dall-e-2`, you can only provide one image, and it should be a square `png`
              file less than 4MB.

          prompt: A text description of the desired image(s). The maximum length is 1000
              characters for `dall-e-2`, and 32000 characters for `gpt-image-1`.

          background: Allows to set transparency for the background of the generated image(s). This
              parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
              `opaque` or `auto` (default value). When `auto` is used, the model will
              automatically determine the best background for the image.

              If `transparent`, the output format needs to support transparency, so it should
              be set to either `png` (default value) or `webp`.

          mask: An additional image whose fully transparent areas (e.g. where alpha is zero)
              indicate where `image` should be edited. If there are multiple images provided,
              the mask will be applied on the first image. 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` and `gpt-image-1` are
              supported. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1`
              is used.

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

          quality: The quality of the image that will be generated. `high`, `medium` and `low` are
              only supported for `gpt-image-1`. `dall-e-2` only supports `standard` quality.
              Defaults to `auto`.

          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. This parameter is only supported for `dall-e-2`, as `gpt-image-1`
              will always return base64-encoded images.

          size: The size of the generated images. Must be one of `1024x1024`, `1536x1024`
              (landscape), `1024x1536` (portrait), or `auto` (default value) for
              `gpt-image-1`, and one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`.

          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=   ÚpromptrP   rQ   r1   r2   rR   r3   r4   r5   r=   ú<array>rQ   r>   r@   rA   ú/images/editsrC   rD   )r   r   r   r   rI   rJ   rK   r   r   ÚImageEditParamsr   r    ©r(   r=   rV   rP   rQ   r1   r2   rR   r3   r4   r5   r6   r7   r8   r9   rE   rF   s                    r)   ÚeditzImages.editu   sÁ   € ôd  àØ Ø(ØØØØ"Ø#2ØØñó
ˆô œd¤7¬3´¨;Ñ#7¸Ó>ÈÀyÐSZÐ\eÐRfÐioÐhpÐFqÔrˆð (Ð)>ÐXÀ=ÒCVÐTVÐXˆØ�z‰zØÜ  Ô'8×'HÑ'HÓIØÜ(Ø+¸ÐQ[Ðelôô #ð ó 
ð 	
r+   ©rP   r1   Ú
moderationr2   Úoutput_compressionÚoutput_formatrR   r3   r4   Ústyler5   r6   r7   r8   r9   c               ó˜   — | j                  dt        |||||||||	|
||dœt        j                  «      t	        ||||¬«      t
        ¬«      S )á­  
        Creates an image given a prompt.
        [Learn more](https://platform.openai.com/docs/guides/images).

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

          background: Allows to set transparency for the background of the generated image(s). This
              parameter is only supported for `gpt-image-1`. Must be one of `transparent`,
              `opaque` or `auto` (default value). When `auto` is used, the model will
              automatically determine the best background for the image.

              If `transparent`, the output format needs to support transparency, so it should
              be set to either `png` (default value) or `webp`.

          model: The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or
              `gpt-image-1`. Defaults to `dall-e-2` unless a parameter specific to
              `gpt-image-1` is used.

          moderation: Control the content-moderation level for images generated by `gpt-image-1`. Must
              be either `low` for less restrictive filtering or `auto` (default value).

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

          output_compression: The compression level (0-100%) for the generated images. This parameter is only
              supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and
              defaults to 100.

          output_format: The format in which the generated images are returned. This parameter is only
              supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`.

          quality: The quality of the image that will be generated.

              - `auto` (default value) will automatically select the best quality for the
                given model.
              - `high`, `medium` and `low` are supported for `gpt-image-1`.
              - `hd` and `standard` are supported for `dall-e-3`.
              - `standard` is the only option for `dall-e-2`.

          response_format: The format in which generated images with `dall-e-2` and `dall-e-3` are
              returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes
              after the image has been generated. This parameter isn't supported for
              `gpt-image-1` which will always return base64-encoded images.

          size: The size of the generated images. Must be one of `1024x1024`, `1536x1024`
              (landscape), `1024x1536` (portrait), or `auto` (default value) for
              `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and
              one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.

          style: The style of the generated images. This parameter is only supported for
              `dall-e-3`. 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.

          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©rV   rP   r1   r]   r2   r^   r_   rR   r3   r4   r`   r5   rC   ©rE   rG   rH   )rK   r   r   ÚImageGenerateParamsr   r    ©r(   rV   rP   r1   r]   r2   r^   r_   rR   r3   r4   r`   r5   r6   r7   r8   r9   s                    r)   ÚgeneratezImages.generateä   st   € ð| �z‰zØ!Ü à$Ø",Ø"Ø",ØØ*<Ø%2Ø&Ø'6Ø Ø"Ø ñô &×9Ñ9óô" )Ø+¸ÐQ[Ðelôô #ð- ó 
ð 	
r+   )Úreturnr&   )ri   r.   ©r=   r   r1   ú'Union[str, ImageModel, None] | NotGivenr2   úOptional[int] | NotGivenr3   ú/Optional[Literal['url', 'b64_json']] | NotGivenr4   z?Optional[Literal['256x256', '512x512', '1024x1024']] | NotGivenr5   ústr | NotGivenr6   úHeaders | Noner7   úQuery | Noner8   úBody | Noner9   ú'float | httpx.Timeout | None | NotGivenri   r    ©r=   z!Union[FileTypes, List[FileTypes]]rV   rI   rP   ú=Optional[Literal['transparent', 'opaque', 'auto']] | NotGivenrQ   zFileTypes | NotGivenr1   rk   r2   rl   rR   zIOptional[Literal['standard', 'low', 'medium', 'high', 'auto']] | NotGivenr3   rm   r4   zaOptional[Literal['256x256', '512x512', '1024x1024', '1536x1024', '1024x1536', 'auto']] | NotGivenr5   rn   r6   ro   r7   rp   r8   rq   r9   rr   ri   r    ©"rV   rI   rP   rt   r1   rk   r]   z+Optional[Literal['low', 'auto']] | NotGivenr2   rl   r^   rl   r_   z3Optional[Literal['png', 'jpeg', 'webp']] | NotGivenrR   zOOptional[Literal['standard', 'hd', 'low', 'medium', 'high', 'auto']] | NotGivenr3   rm   r4   z{Optional[Literal['auto', '1024x1024', '1536x1024', '1024x1536', '256x256', '512x512', '1792x1024', '1024x1792']] | NotGivenr`   z0Optional[Literal['vivid', 'natural']] | NotGivenr5   rn   r6   ro   r7   rp   r8   rq   r9   rr   ri   r    ©
Ú__name__Ú
__module__Ú__qualname__r   r*   r/   r   rN   r[   rh   © r+   r)   r!   r!      sŸ  „ Øò+ó ð+ð ò1ó ð1ð :CØ&/ØKTØPYØ(ð )-Ø$(Ø"&Ø;DñG
ð ðG
ð 7ð	G
ð
 $ðG
ð IðG
ð NðG
ð ðG
ð &ðG
ð "ðG
ð  ðG
ð 9ðG
ð 
óG
ð\ U^Ø%.Ø9BØ&/Ø]fØKTàØ(ð )-Ø$(Ø"&Ø;Dñ'm
ð 1ðm
ð ð	m
ð
 Rðm
ð #ðm
ð 7ðm
ð $ðm
ð [ðm
ð Iðm
ððm
ð ðm
ð  &ð!m
ð" "ð#m
ð$  ð%m
ð& 9ð'm
ð( 
ó)m
ðf U^Ø9BØBKØ&/Ø7@ØMVØclØKTð ØBKØ(ð )-Ø$(Ø"&Ø;Dñ/u
ð ðu
ð Rð	u
ð
 7ðu
ð @ðu
ð $ðu
ð 5ðu
ð Kðu
ð aðu
ð Iðu
ððu
ð  @ð!u
ð" ð#u
ð( &ð)u
ð* "ð+u
ð,  ð-u
ð. 9ð/u
ð0 
ô1u
r+   c                  óB  — 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eedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zeeeeeeeeeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	„Z	y)r"   c                ó   — t        | «      S r%   )ÚAsyncImagesWithRawResponser'   s    r)   r*   zAsyncImages.with_raw_response]  s   € ô *¨$Ó/Ð/r+   c                ó   — t        | «      S r-   )Ú AsyncImagesWithStreamingResponser'   s    r)   r/   z#AsyncImages.with_streaming_responseg  s   € ô 0°Ó5Ð5r+   Nr0   c       
      ƒ  ó<  K  — t        ||||||dœ«      }t        t        t        t        t
        f   |«      dgg¬«      }ddi|xs i ¥}| j                  dt        |t        j                  «      ƒ d{  –—† |t        |||	|
¬«      t        ¬	«      ƒ d{  –—† S 7 Œ%7 Œ­w)
r;   r<   r=   r>   r@   rA   rB   NrC   rD   )r   r   r   r   rI   rJ   rK   r   r   rL   r   r    rM   s                r)   rN   zAsyncImages.create_variationp  sº   è ø€ ô`  àØØØ#2ØØñó	
ˆô œd¤7¬3´¨;Ñ#7¸Ó>ÈÀyÀkÔRˆð (Ð)>ÐXÀ=ÒCVÐTVÐXˆØ—Z‘ZØ Ü,¨TÔ3P×3kÑ3kÓl×lØÜ(Ø+¸ÐQ[Ðelôô #ð  ó 
÷ 
ð 	
àløð
ús$   ‚A0BÁ2B
Á3 BÂBÂBÂBrO   c             ƒ  óN  K  — t        |||||||||	|
dœ
«      }t        t        t        t        t
        f   |«      dgddgdgg¬«      }ddi|xs i ¥}| j                  dt        |t        j                  «      ƒ d	{  –—† |t        ||||¬
«      t        ¬«      ƒ d	{  –—† S 7 Œ%7 Œ­w)rT   rU   r=   rW   rQ   r>   r@   rA   rX   NrC   rD   )r   r   r   r   rI   rJ   rK   r   r   rY   r   r    rZ   s                    r)   r[   zAsyncImages.edit¹  sÖ   è ø€ ôd  àØ Ø(ØØØØ"Ø#2ØØñó
ˆô œd¤7¬3´¨;Ñ#7¸Ó>ÈÀyÐSZÐ\eÐRfÐioÐhpÐFqÔrˆð (Ð)>ÐXÀ=ÒCVÐTVÐXˆØ—Z‘ZØÜ,¨TÔ3D×3TÑ3TÓU×UØÜ(Ø+¸ÐQ[Ðelôô #ð  ó 
÷ 
ð 	
àUøð
ús$   ‚A9B%Á;B!
Á< B%ÂB#ÂB%Â#B%r\   c             ƒ  óÈ   K  — | j                  dt        |||||||||	|
||dœt        j                  «      ƒ d{  –—† t	        ||||¬«      t
        ¬«      ƒ d{  –—† S 7 Œ$7 Œ­w)rb   rc   rd   NrC   re   )rK   r   r   rf   r   r    rg   s                    r)   rh   zAsyncImages.generate(  s�   è ø€ ð| —Z‘ZØ!Ü,à$Ø",Ø"Ø",ØØ*<Ø%2Ø&Ø'6Ø Ø"Ø ñô &×9Ñ9ó÷ ô" )Ø+¸ÐQ[Ðelôô #ð-  ó 
÷ 
ð 	
ðøð
ús!   ‚7A"¹A
ºA"ÁA ÁA"Á A")ri   r}   )ri   r   rj   rs   ru   rv   rz   r+   r)   r"   r"   \  sŸ  „ Øò0ó ð0ð ò6ó ð6ð :CØ&/ØKTØPYØ(ð )-Ø$(Ø"&Ø;DñG
ð ðG
ð 7ð	G
ð
 $ðG
ð IðG
ð NðG
ð ðG
ð &ðG
ð "ðG
ð  ðG
ð 9ðG
ð 
óG
ð\ U^Ø%.Ø9BØ&/Ø]fØKTàØ(ð )-Ø$(Ø"&Ø;Dñ'm
ð 1ðm
ð ð	m
ð
 Rðm
ð #ðm
ð 7ðm
ð $ðm
ð [ðm
ð Iðm
ððm
ð ðm
ð  &ð!m
ð" "ð#m
ð$  ð%m
ð& 9ð'm
ð( 
ó)m
ðf U^Ø9BØBKØ&/Ø7@ØMVØclØKTð ØBKØ(ð )-Ø$(Ø"&Ø;Dñ/u
ð ðu
ð Rð	u
ð
 7ðu
ð @ðu
ð $ðu
ð 5ðu
ð Kðu
ð aðu
ð Iðu
ððu
ð  @ð!u
ð" ð#u
ð( &ð)u
ð* "ð+u
ð,  ð-u
ð. 9ð/u
ð0 
ô1u
r+   c                  ó   — e Zd Zdd„Zy)r&   c                óê   — || _         t        j                  |j                  «      | _        t        j                  |j                  «      | _        t        j                  |j
                  «      | _        y ©N)Ú_imagesr   Úto_raw_response_wrapperrN   r[   rh   ©r(   Úimagess     r)   Ú__init__zImagesWithRawResponse.__init__¡  s[   € ØˆŒä 0× HÑ HØ×#Ñ#ó!
ˆÔô %×<Ñ<Ø�K‰Kó
ˆŒ	ô )×@Ñ@Ø�O‰Oó
ˆ�r+   N©r‰   r!   ri   ÚNone©rw   rx   ry   rŠ   rz   r+   r)   r&   r&      ó   „ ô
r+   r&   c                  ó   — e Zd Zdd„Zy)r}   c                óê   — || _         t        j                  |j                  «      | _        t        j                  |j                  «      | _        t        j                  |j
                  «      | _        y r…   )r†   r   Úasync_to_raw_response_wrapperrN   r[   rh   rˆ   s     r)   rŠ   z#AsyncImagesWithRawResponse.__init__°  s[   € ØˆŒä 0× NÑ NØ×#Ñ#ó!
ˆÔô %×BÑBØ�K‰Kó
ˆŒ	ô )×FÑFØ�O‰Oó
ˆ�r+   N©r‰   r"   ri   rŒ   r�   rz   r+   r)   r}   r}   ¯  rŽ   r+   r}   c                  ó   — e Zd Zdd„Zy)r.   c                ó®   — || _         t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        y r…   )r†   r   rN   r[   rh   rˆ   s     r)   rŠ   z$ImagesWithStreamingResponse.__init__¿  sI   € ØˆŒä <Ø×#Ñ#ó!
ˆÔô 1Ø�K‰Kó
ˆŒ	ô 5Ø�O‰Oó
ˆ�r+   Nr‹   r�   rz   r+   r)   r.   r.   ¾  rŽ   r+   r.   c                  ó   — e Zd Zdd„Zy)r   c                ó®   — || _         t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        y r…   )r†   r   rN   r[   rh   rˆ   s     r)   rŠ   z)AsyncImagesWithStreamingResponse.__init__Î  sI   € ØˆŒä BØ×#Ñ#ó!
ˆÔô 7Ø�K‰Kó
ˆŒ	ô ;Ø�O‰Oó
ˆ�r+   Nr’   r�   rz   r+   r)   r   r   Í  rŽ   r+   r   )2Ú
__future__r   Útypingr   r   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   rz   r+   r)   ú<module>r¦      sŽ   ðõ #ç 7Õ 7Ý %ã å ß [Ñ [ß I× Iß \Ó \Ý %ß 9ß XÝ /Ý *Ý 2à�]Ð
#€ôA
ˆ_ô A
ôH
A
Ð"ô A
÷H

ñ 
÷
ñ 
÷
ñ 
÷
ò 
r+   