o
    ¨Ýjf  ã                   @  sl  d dl mZ d dl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mZmZmZmZ ddl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mZmZm Z  ddl!m"Z"m#Z# ddl$m%Z%m&Z&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddgZ0G dd„ deƒZ1G dd„ deƒZ2G dd„ dƒZ3G dd„ dƒZ4G dd„ dƒZ5G dd„ dƒZ6dS )é    )ÚannotationsN)ÚLiteralé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚSequenceNotStrÚomitÚ	not_given)Úpath_templateÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncPageÚ	AsyncPageÚSyncConversationCursorPageÚAsyncConversationCursorPage)ÚAsyncPaginatorÚmake_request_options)Úpermission_list_paramsÚpermission_create_paramsÚpermission_retrieve_params)ÚPermissionListResponse)ÚPermissionCreateResponse)ÚPermissionDeleteResponse)ÚPermissionRetrieveResponseÚPermissionsÚAsyncPermissionsc                
   @  óž   e Zd ZdZed-dd„ƒZed.dd„ƒZd	d	d	ed
œd/dd„Ze	 
d¡eeeed	d	d	edœd0d$d%„ƒZeeeed	d	d	edœd1d'd(„Zd	d	d	ed
œd2d+d,„Zd	S )3r#   úIManage fine-tuning jobs to tailor a model to your specific training data.ÚreturnÚPermissionsWithRawResponsec                 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
        )r(   ©Úself© r-   úo/var/www/html/chatgpt/venv/lib/python3.10/site-packages/openai/resources/fine_tuning/checkpoints/permissions.pyÚwith_raw_response"   ó   zPermissions.with_raw_responseÚ PermissionsWithStreamingResponsec                 C  r)   ©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
        )r1   r+   r-   r-   r.   Úwith_streaming_response,   ó   z#Permissions.with_streaming_responseN©Úextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚfine_tuned_model_checkpointÚstrÚproject_idsúSequenceNotStr[str]r6   úHeaders | Noner7   úQuery | Noner8   úBody | Noner9   ú(float | httpx2.Timeout | None | NotGivenú"SyncPage[PermissionCreateResponse]c                C  óR   |s	t d|›�ƒ‚| jtd|d�tt td|itjƒt||||ddid�tdd	�S ©
a§  
        **NOTE:** Calling this endpoint requires an
        [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).

        This enables organization owners to share fine-tuned models with other projects
        in their organization.

        Args:
          project_ids: The project identifiers to grant access to.

          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
        úJExpected a non-empty value for `fine_tuned_model_checkpoint` but received úB/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions©r:   r<   Úbearer_authT©r6   r7   r8   r9   ÚsecurityÚpost)ÚpageÚbodyÚoptionsÚmodelÚmethod)	Ú
ValueErrorÚ_get_api_listr   r   r    r   r   ÚPermissionCreateParamsr   ©r,   r:   r<   r6   r7   r8   r9   r-   r-   r.   Úcreate5   ó*   ÿþûñzPermissions.createúIRetrieve is deprecated. Please swap to the paginated list method instead.©ÚafterÚlimitÚorderÚ
project_idr6   r7   r8   r9   rY   ú
str | OmitrZ   ú
int | Omitr[   ú)Literal['ascending', 'descending'] | Omitr\   r"   c          
      C  sP   |s	t d|›�ƒ‚| jtd|d�t||||	t||||dœtjƒddid�td�S )	áo  
        **NOTE:** This endpoint requires an
        [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).

        Organization owners can use this endpoint to view all permissions for a
        fine-tuned model checkpoint.

        Args:
          after: Identifier for the last permission ID from the previous pagination request.

          limit: Number of permissions to retrieve.

          order: The order in which to retrieve permissions.

          project_id: The ID of the project to get permissions for.

          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
        rE   rF   rG   ©rY   rZ   r[   r\   rH   T©r6   r7   r8   r9   ÚqueryrJ   ©rN   Zcast_to)rQ   Ú_getr   r   r   r   ÚPermissionRetrieveParamsr"   ©
r,   r:   rY   rZ   r[   r\   r6   r7   r8   r9   r-   r-   r.   Úretrievei   s4   (ÿþüù	òëzPermissions.retrieveú2SyncConversationCursorPage[PermissionListResponse]c          
      C  óV   |s	t d|›�ƒ‚| jtd|d�tt t||||	t||||dœtjƒddid�td�S ©	r`   rE   rF   rG   ra   rH   Trb   )rL   rN   rO   )	rQ   rR   r   r   r   r   r   r   ÚPermissionListParamsrg   r-   r-   r.   Úlist­   ó6   'ÿþüù	òêzPermissions.listÚpermission_idr!   c             	   C  sP   |s	t d|›�ƒ‚|st d|›�ƒ‚| jtd||d�t||||ddid�td�S )	áX  
        **NOTE:** This endpoint requires an
        [admin API key](https://developers.openai.com/api/reference/resources/admin/subresources/organization/subresources/admin_api_keys).

        Organization owners can use this endpoint to delete a permission for a
        fine-tuned model checkpoint.

        Args:
          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
        rE   ú<Expected a non-empty value for `permission_id` but received úR/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}©r:   ro   rH   TrI   rd   ©rQ   Ú_deleter   r   r!   ©r,   ro   r:   r6   r7   r8   r9   r-   r-   r.   Údeleteñ   s*   ÿýûózPermissions.delete)r'   r(   )r'   r1   )r:   r;   r<   r=   r6   r>   r7   r?   r8   r@   r9   rA   r'   rB   ©r:   r;   rY   r]   rZ   r^   r[   r_   r\   r]   r6   r>   r7   r?   r8   r@   r9   rA   r'   r"   )r:   r;   rY   r]   rZ   r^   r[   r_   r\   r]   r6   r>   r7   r?   r8   r@   r9   rA   r'   ri   ©ro   r;   r:   r;   r6   r>   r7   r?   r8   r@   r9   rA   r'   r!   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r/   r3   r   rU   Útyping_extensionsÚ
deprecatedr   rh   rm   rw   r-   r-   r-   r.   r#      óF    	ö4óGóKöc                
   @  r%   )3r$   r&   r'   ÚAsyncPermissionsWithRawResponsec                 C  r)   r*   )r‚   r+   r-   r-   r.   r/   '  r0   z"AsyncPermissions.with_raw_responseÚ%AsyncPermissionsWithStreamingResponsec                 C  r)   r2   )rƒ   r+   r-   r-   r.   r3   1  r4   z(AsyncPermissions.with_streaming_responseNr5   r:   r;   r<   r=   r6   r>   r7   r?   r8   r@   r9   rA   úMAsyncPaginator[PermissionCreateResponse, AsyncPage[PermissionCreateResponse]]c                C  rC   rD   )	rQ   rR   r   r   r    r   r   rS   r   rT   r-   r-   r.   rU   :  rV   zAsyncPermissions.createrW   rX   rY   r]   rZ   r^   r[   r_   r\   r"   c          
      Ã  s^   �|s
t d|›�ƒ‚| jtd|d�t||||	t||||dœtjƒI dH ddid�td	�I dH S )
r`   rE   rF   rG   ra   NrH   Trb   rd   )rQ   re   r   r   r   r   rf   r"   rg   r-   r-   r.   rh   n  s6   €(ÿþüù	òëzAsyncPermissions.retrieveú[AsyncPaginator[PermissionListResponse, AsyncConversationCursorPage[PermissionListResponse]]c          
      C  rj   rk   )	rQ   rR   r   r   r   r   r   r   rl   rg   r-   r-   r.   rm   ²  rn   zAsyncPermissions.listro   r!   c             	   Ã  sX   �|s
t d|›�ƒ‚|st d|›�ƒ‚| jtd||d�t||||ddid�td�I d	H S )
rp   rE   rq   rr   rs   rH   TrI   rd   Nrt   rv   r-   r-   r.   rw   ö  s,   €ÿýûózAsyncPermissions.delete)r'   r‚   )r'   rƒ   )r:   r;   r<   r=   r6   r>   r7   r?   r8   r@   r9   rA   r'   r„   rx   )r:   r;   rY   r]   rZ   r^   r[   r_   r\   r]   r6   r>   r7   r?   r8   r@   r9   rA   r'   r…   ry   rz   r-   r-   r-   r.   r$   $  r�   c                   @  ó   e Zd Zddd„ZdS )	r(   Úpermissionsr#   r'   ÚNonec                 C  óB   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S ©N)Ú_permissionsr   Zto_raw_response_wrapperrU   rh   rm   rw   ©r,   r‡   r-   r-   r.   Ú__init__*  ó   ÿÿÿÿ
ÿz#PermissionsWithRawResponse.__init__N©r‡   r#   r'   rˆ   ©r{   r|   r}   r�   r-   r-   r-   r.   r(   )  ó    r(   c                   @  r†   )	r‚   r‡   r$   r'   rˆ   c                 C  r‰   rŠ   )r‹   r   Zasync_to_raw_response_wrapperrU   rh   rm   rw   rŒ   r-   r-   r.   r�   >  rŽ   z(AsyncPermissionsWithRawResponse.__init__N©r‡   r$   r'   rˆ   r�   r-   r-   r-   r.   r‚   =  r‘   r‚   c                   @  r†   )	r1   r‡   r#   r'   rˆ   c                 C  ó:   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S rŠ   )r‹   r   rU   rh   rm   rw   rŒ   r-   r-   r.   r�   R  ó   ÿÿÿÿ
ÿz)PermissionsWithStreamingResponse.__init__Nr�   r�   r-   r-   r-   r.   r1   Q  r‘   r1   c                   @  r†   )	rƒ   r‡   r$   r'   rˆ   c                 C  r“   rŠ   )r‹   r   rU   rh   rm   rw   rŒ   r-   r-   r.   r�   f  r”   z.AsyncPermissionsWithStreamingResponse.__init__Nr’   r�   r-   r-   r-   r.   rƒ   e  r‘   rƒ   )7Ú
__future__r   r   r   Zhttpx2Ú r   Ú_typesr   r   r   r	   r
   r   r   r   Z_utilsr   r   r   Z_compatr   Z	_resourcer   r   Ú	_responser   r   Z
paginationr   r   r   r   Z_base_clientr   r   Ztypes.fine_tuning.checkpointsr   r   r   Z6types.fine_tuning.checkpoints.permission_list_responser   Z8types.fine_tuning.checkpoints.permission_create_responser    Z8types.fine_tuning.checkpoints.permission_delete_responser!   Z:types.fine_tuning.checkpoints.permission_retrieve_responser"   Ú__all__r#   r$   r(   r‚   r1   rƒ   r-   r-   r-   r.   Ú<module>   s8   (    