o
    i`                     @  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-   n/home/kim/smarthome/.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 | httpx.Timeout | None | NotGiven"SyncPage[PermissionCreateResponse]c             
   C  L   |s	t d|| jtd|dtt td|itjt||||dtddS a?  
        **NOTE:** Calling this endpoint requires an [admin API key](../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<   r5   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.createIRetrieve is deprecated. Please swap to the paginated list method instead.afterlimitorder
project_idr6   r7   r8   r9   rV   
str | OmitrW   
int | OmitrX   )Literal['ascending', 'descending'] | OmitrY   r"   c          
      C  sJ   |s	t d|| jtd|dt||||	t||||dtjdtdS )  
        **NOTE:** This endpoint requires an [admin API key](../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   rV   rW   rX   rY   r6   r7   r8   r9   queryrK   Zcast_to)rN   _getr   r   r   r   PermissionRetrieveParamsr"   
r,   r:   rV   rW   rX   rY   r6   r7   r8   r9   r-   r-   r.   retrieved   s2   'zPermissions.retrieve2SyncConversationCursorPage[PermissionListResponse]c          
      C  P   |s	t d|| jtd|dtt t||||	t||||dtjdtdS r]   rE   rF   rG   r^   r_   )rI   rK   rL   )	rN   rO   r   r   r   r   r   r   PermissionListParamsrd   r-   r-   r.   list   4   &zPermissions.listpermission_idr!   c                C  sJ   |s	t d||st d|| jtd||dt||||dtdS )  
        **NOTE:** This endpoint requires an [admin API key](../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:   rl   r5   ra   rN   _deleter   r   r!   r,   rl   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;   rV   rZ   rW   r[   rX   r\   rY   rZ   r6   r>   r7   r?   r8   r@   r9   rA   r'   r"   )r:   r;   rV   rZ   rW   r[   rX   r\   rY   rZ   r6   r>   r7   r?   r8   r@   r9   rA   r'   rf   rl   r;   r:   r;   r6   r>   r7   r?   r8   r@   r9   rA   r'   r!   __name__
__module____qualname____doc__r   r/   r3   r   rR   typing_extensions
deprecatedr   re   rj   rt   r-   r-   r-   r.   r#      F    	/EI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   #  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   )	rN   rO   r   r   r    r   r   rP   r   rQ   r-   r-   r.   rR   ,  rS   zAsyncPermissions.createrT   rU   rV   rZ   rW   r[   rX   r\   rY   r"   c          
        sX   |s
t d|| jtd|dt||||	t||||dtjI dH dtdI dH S )r]   rE   rF   rG   r^   Nr_   ra   )rN   rb   r   r   r   r   rc   r"   rd   r-   r-   r.   re   [  s4   'zAsyncPermissions.retrieve[AsyncPaginator[PermissionListResponse, AsyncConversationCursorPage[PermissionListResponse]]c          
      C  rg   rh   )	rN   rO   r   r   r   r   r   r   ri   rd   r-   r-   r.   rj     rk   zAsyncPermissions.listrl   r!   c                  sR   |s
t d||st d|| jtd||dt||||dtdI dH S )rm   rE   rn   ro   rp   r5   ra   Nrq   rs   r-   r-   r.   rt     s$   zAsyncPermissions.delete)r'   r   )r'   r   )r:   r;   r<   r=   r6   r>   r7   r?   r8   r@   r9   rA   r'   r   ru   )r:   r;   rV   rZ   rW   r[   rX   r\   rY   rZ   r6   r>   r7   r?   r8   r@   r9   rA   r'   r   rv   rw   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_wrapperrR   re   rj   rt   r,   r   r-   r-   r.   __init__     
z#PermissionsWithRawResponse.__init__Nr   r#   r'   r   rx   ry   rz   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_wrapperrR   re   rj   rt   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   rR   re   rj   rt   r   r-   r-   r.   r   6     
z)PermissionsWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r1   5  r   r1   c                   @  r   )	r   r   r$   r'   r   c                 C  r   r   )r   r   rR   re   rj   rt   r   r-   r-   r.   r   J  r   z.AsyncPermissionsWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r   I  r   r   )7
__future__r   r|   r   Zhttpx 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>   s4   ( x x