o
    r)ix\                     @  sh  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 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Z/G dd deZ0G dd deZ1G dd dZ2G dd dZ3G dd dZ4G dd dZ5dS )    )annotationsN)Literal   )_legacy_response)BodyOmitQueryHeadersNotGivenSequenceNotStromit	not_given)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,   x/var/www/html/voicebot/backend/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
        )r0   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]r5   Headers | Noner6   Query | Noner7   Body | Noner8   'float | httpx.Timeout | None | NotGiven"SyncPage[PermissionCreateResponse]c             
   C  L   |s	t d|| j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 /fine_tuning/checkpoints//permissionsr;   r4   post)pagebodyoptionsmodelmethod)
ValueError_get_api_listr   r   r   r   PermissionCreateParamsr   r+   r9   r;   r5   r6   r7   r8   r,   r,   r-   create5      
zPermissions.createIRetrieve is deprecated. Please swap to the paginated list method instead.afterlimitorder
project_idr5   r6   r7   r8   rU   
str | OmitrV   
int | OmitrW   )Literal['ascending', 'descending'] | OmitrX   r!   c          
      C  sJ   |s	t d|| j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
        rD   rE   rF   rU   rV   rW   rX   r5   r6   r7   r8   queryrJ   cast_to)rM   _getr   r   r   PermissionRetrieveParamsr!   
r+   r9   rU   rV   rW   rX   r5   r6   r7   r8   r,   r,   r-   retrievea   s,   '
zPermissions.retrieve2SyncConversationCursorPage[PermissionListResponse]c          
      C  P   |s	t d|| jd| dtt t||||	t||||dtjdtdS r\   rD   rE   rF   r]   r^   )rH   rJ   rK   )rM   rN   r   r   r   r   r   PermissionListParamsrd   r,   r,   r-   list   .   &
zPermissions.listpermission_idr    c                C  sL   |s	t d||st d|| j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
        rD   <Expected a non-empty value for `permission_id` but received rE   /permissions/r4   r`   rM   _deleter   r    r+   rl   r9   r5   r6   r7   r8   r,   r,   r-   delete   s   zPermissions.delete)r&   r'   )r&   r0   )r9   r:   r;   r<   r5   r=   r6   r>   r7   r?   r8   r@   r&   rA   r9   r:   rU   rY   rV   rZ   rW   r[   rX   rY   r5   r=   r6   r>   r7   r?   r8   r@   r&   r!   )r9   r:   rU   rY   rV   rZ   rW   r[   rX   rY   r5   r=   r6   r>   r7   r?   r8   r@   r&   rf   rl   r:   r9   r:   r5   r=   r6   r>   r7   r?   r8   r@   r&   r    __name__
__module____qualname____doc__r   r.   r2   r   rQ   typing_extensions
deprecatedr   re   rj   rs   r,   r,   r,   r-   r"      F    	,BFc                
   @  r$   )3r#   r%   r&   AsyncPermissionsWithRawResponsec                 C  r(   r)   )r~   r*   r,   r,   r-   r.     r/   z"AsyncPermissions.with_raw_response%AsyncPermissionsWithStreamingResponsec                 C  r(   r1   )r   r*   r,   r,   r-   r2     r3   z(AsyncPermissions.with_streaming_responseNr4   r9   r:   r;   r<   r5   r=   r6   r>   r7   r?   r8   r@   MAsyncPaginator[PermissionCreateResponse, AsyncPage[PermissionCreateResponse]]c             
   C  rB   rC   )rM   rN   r   r   r   r   rO   r   rP   r,   r,   r-   rQ     rR   zAsyncPermissions.createrS   rT   rU   rY   rV   rZ   rW   r[   rX   r!   c          
        sX   |s
t d|| jd| dt||||	t||||dtjI dH dtdI dH S )r\   rD   rE   rF   r]   Nr^   r`   )rM   rb   r   r   r   rc   r!   rd   r,   r,   r-   re   K  s.   '
zAsyncPermissions.retrieve[AsyncPaginator[PermissionListResponse, AsyncConversationCursorPage[PermissionListResponse]]c          
      C  rg   rh   )rM   rN   r   r   r   r   r   ri   rd   r,   r,   r-   rj     rk   zAsyncPermissions.listrl   r    c                  sT   |s
t d||st d|| jd| d| t||||dtdI dH S )rm   rD   rn   rE   ro   r4   r`   Nrp   rr   r,   r,   r-   rs     s   zAsyncPermissions.delete)r&   r~   )r&   r   )r9   r:   r;   r<   r5   r=   r6   r>   r7   r?   r8   r@   r&   r   rt   )r9   r:   rU   rY   rV   rZ   rW   r[   rX   rY   r5   r=   r6   r>   r7   r?   r8   r@   r&   r   ru   rv   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   to_raw_response_wrapperrQ   re   rj   rs   r+   r   r,   r,   r-   __init__     
z#PermissionsWithRawResponse.__init__Nr   r"   r&   r   rw   rx   ry   r   r,   r,   r,   r-   r'         r'   c                   @  r   )	r~   r   r#   r&   r   c                 C  r   r   )r   r   async_to_raw_response_wrapperrQ   re   rj   rs   r   r,   r,   r-   r     r   z(AsyncPermissionsWithRawResponse.__init__Nr   r#   r&   r   r   r,   r,   r,   r-   r~     r   r~   c                   @  r   )	r0   r   r"   r&   r   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r   )r   r   rQ   re   rj   rs   r   r,   r,   r-   r        
z)PermissionsWithStreamingResponse.__init__Nr   r   r,   r,   r,   r-   r0     r   r0   c                   @  r   )	r   r   r#   r&   r   c                 C  r   r   )r   r   rQ   re   rj   rs   r   r,   r,   r-   r   0  r   z.AsyncPermissionsWithStreamingResponse.__init__Nr   r   r,   r,   r,   r-   r   /  r   r   )6
__future__r   r{   r   httpx r   _typesr   r   r   r	   r
   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   r   r   _base_clientr   r   types.fine_tuning.checkpointsr   r   r   6types.fine_tuning.checkpoints.permission_list_responser   8types.fine_tuning.checkpoints.permission_create_responser   8types.fine_tuning.checkpoints.permission_delete_responser    :types.fine_tuning.checkpoints.permission_retrieve_responser!   __all__r"   r#   r'   r~   r0   r   r,   r,   r,   r-   <module>   s4   ( k k