o
    ØRWjŒR  ã                   @  sT  d dl mZ d dl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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 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„ deƒZ-G dd„ deƒZ.G dd„ dƒZ/G dd„ dƒZ0G dd„ dƒZ1G dd„ dƒZ2dS )é    )Úannotations)ÚAnyÚcast)ÚLiteralNé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚomitÚ	not_given)Úpath_templateÚmaybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncConversationCursorPageÚAsyncConversationCursorPage)ÚAsyncPaginatorÚmake_request_options)Úthread_list_paramsÚthread_list_items_params)ÚChatKitThread)ÚThreadDeleteResponse)ÚDataÚThreadsÚAsyncThreadsc                
   @  ó’   e Zd Zed*dd„ƒZed+dd„ƒZddded	œd,dd„Zeeeeedddedœ	d-d!d"„Z	ddded	œd.d$d%„Z
eeeeddded&œd/d(d)„ZdS )0r   ÚreturnÚThreadsWithRawResponsec                 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(   út/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/openai/resources/beta/chatkit/threads.pyÚwith_raw_response   ó   zThreads.with_raw_responseÚThreadsWithStreamingResponsec                 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
        )r,   r&   r(   r(   r)   Úwith_streaming_response%   ó   zThreads.with_streaming_responseN©Úextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚ	thread_idÚstrr1   úHeaders | Noner2   úQuery | Noner3   úBody | Noner4   ú'float | httpx.Timeout | None | NotGivenr   c             	   C  óL   |s	t d|›�ƒ‚ddi|pi ¥}| jtd|d�t||||ddid�td	�S )
á`  
        Retrieve a ChatKit thread by its identifier.

        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
        ú8Expected a non-empty value for `thread_id` but received úOpenAI-Betaúchatkit_beta=v1ú/chatkit/threads/{thread_id}©r5   Úbearer_authT©r1   r2   r3   r4   Úsecurity©ÚoptionsÚcast_to©Ú
ValueErrorÚ_getr   r   r   ©r'   r5   r1   r2   r3   r4   r(   r(   r)   Úretrieve.   ó   
û÷zThreads.retrieve©	ÚafterÚbeforeÚlimitÚorderÚuserr1   r2   r3   r4   rO   ú
str | OmitrP   rQ   ú
int | OmitrR   úLiteral['asc', 'desc'] | OmitrS   ú)SyncConversationCursorPage[ChatKitThread]c       	   
      C  óN   ddi|pi ¥}| j dtt t||||	t|||||dœtjƒddid�td�S ©	as  
        List ChatKit threads with optional pagination and user filters.

        Args:
          after: List items created after this thread item ID. Defaults to null for the first
              page.

          before: List items created before this thread item ID. Defaults to null for the newest
              results.

          limit: Maximum number of thread items to return. Defaults to 20.

          order: Sort order for results by creation time. Defaults to `desc`.

          user: Filter threads that belong to this user identifier. Defaults to null to return
              all users.

          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>   r?   z/chatkit/threads)rO   rP   rQ   rR   rS   rB   T©r1   r2   r3   r4   ÚqueryrD   ©ÚpagerF   Úmodel)Ú_get_api_listr   r   r   r   r   ÚThreadListParams©
r'   rO   rP   rQ   rR   rS   r1   r2   r3   r4   r(   r(   r)   ÚlistT   ó,   (ûø
ñìzThreads.listr   c             	   C  r;   )
áx  
        Delete a ChatKit thread along with its items and stored attachments.

        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
        r=   r>   r?   r@   rA   rB   TrC   rE   ©rI   Ú_deleter   r   r   rK   r(   r(   r)   Údelete”   rM   zThreads.delete©rO   rP   rQ   rR   r1   r2   r3   r4   ú SyncConversationCursorPage[Data]c          
      C  ól   |s	t d|›�ƒ‚ddi|pi ¥}| jtd|d�tt t||||	t||||dœtjƒddid	�t	t
tƒd
�S ©aæ  
        List items that belong to a ChatKit thread.

        Args:
          after: List items created after this thread item ID. Defaults to null for the first
              page.

          before: List items created before this thread item ID. Defaults to null for the newest
              results.

          limit: Maximum number of thread items to return. Defaults to 20.

          order: Sort order for results by creation time. Defaults to `desc`.

          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=   r>   r?   z"/chatkit/threads/{thread_id}/itemsrA   )rO   rP   rQ   rR   rB   TrZ   r\   )rI   r_   r   r   r   r   r   r   ÚThreadListItemsParamsr   r   ©
r'   r5   rO   rP   rQ   rR   r1   r2   r3   r4   r(   r(   r)   Ú
list_itemsº   ó.   %
üù	òízThreads.list_items)r"   r#   )r"   r,   ©r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r"   r   )rO   rT   rP   rT   rQ   rU   rR   rV   rS   rT   r1   r7   r2   r8   r3   r9   r4   r:   r"   rW   ©r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r"   r   )r5   r6   rO   rT   rP   rT   rQ   rU   rR   rV   r1   r7   r2   r8   r3   r9   r4   r:   r"   ri   ©Ú__name__Ú
__module__Ú__qualname__r   r*   r.   r   rL   r   rb   rg   rn   r(   r(   r(   r)   r      óD    	÷)óF÷*óc                
   @  r!   )0r    r"   ÚAsyncThreadsWithRawResponsec                 C  r$   r%   )rw   r&   r(   r(   r)   r*   ú   r+   zAsyncThreads.with_raw_responseÚ!AsyncThreadsWithStreamingResponsec                 C  r$   r-   )rx   r&   r(   r(   r)   r.     r/   z$AsyncThreads.with_streaming_responseNr0   r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r   c             	   Ã  óT   �|s
t d|›�ƒ‚ddi|pi ¥}| jtd|d�t||||ddid�td	�I d
H S )r<   r=   r>   r?   r@   rA   rB   TrC   rE   NrH   rK   r(   r(   r)   rL     ó   €
û÷zAsyncThreads.retrieverN   rO   rT   rP   rQ   rU   rR   rV   rS   úIAsyncPaginator[ChatKitThread, AsyncConversationCursorPage[ChatKitThread]]c       	   
      C  rX   rY   )r_   r   r   r   r   r   r`   ra   r(   r(   r)   rb   3  rc   zAsyncThreads.listr   c             	   Ã  ry   )rd   r=   r>   r?   r@   rA   rB   TrC   rE   Nre   rK   r(   r(   r)   rg   s  rz   zAsyncThreads.deleterh   ú7AsyncPaginator[Data, AsyncConversationCursorPage[Data]]c          
      C  rj   rk   )rI   r_   r   r   r   r   r   r   rl   r   r   rm   r(   r(   r)   rn   ™  ro   zAsyncThreads.list_items)r"   rw   )r"   rx   rp   )rO   rT   rP   rT   rQ   rU   rR   rV   rS   rT   r1   r7   r2   r8   r3   r9   r4   r:   r"   r{   rq   )r5   r6   rO   rT   rP   rT   rQ   rU   rR   rV   r1   r7   r2   r8   r3   r9   r4   r:   r"   r|   rr   r(   r(   r(   r)   r    ù   rv   c                   @  ó   e Zd Zddd„ZdS )	r#   Úthreadsr   r"   ÚNonec                 C  óB   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S ©N)Ú_threadsr   Úto_raw_response_wrapperrL   rb   rg   rn   ©r'   r~   r(   r(   r)   Ú__init__Ù  ó   ÿÿÿ
ÿzThreadsWithRawResponse.__init__N©r~   r   r"   r   ©rs   rt   ru   r…   r(   r(   r(   r)   r#   Ø  ó    r#   c                   @  r}   )	rw   r~   r    r"   r   c                 C  r€   r�   )r‚   r   Úasync_to_raw_response_wrapperrL   rb   rg   rn   r„   r(   r(   r)   r…   ë  r†   z$AsyncThreadsWithRawResponse.__init__N©r~   r    r"   r   rˆ   r(   r(   r(   r)   rw   ê  r‰   rw   c                   @  r}   )	r,   r~   r   r"   r   c                 C  ó:   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S r�   )r‚   r   rL   rb   rg   rn   r„   r(   r(   r)   r…   ý  ó   ÿÿÿ
ÿz%ThreadsWithStreamingResponse.__init__Nr‡   rˆ   r(   r(   r(   r)   r,   ü  r‰   r,   c                   @  r}   )	rx   r~   r    r"   r   c                 C  rŒ   r�   )r‚   r   rL   rb   rg   rn   r„   r(   r(   r)   r…     r�   z*AsyncThreadsWithStreamingResponse.__init__Nr‹   rˆ   r(   r(   r(   r)   rx     r‰   rx   )3Ú
__future__r   Útypingr   r   Útyping_extensionsr   ÚhttpxÚ r   Ú_typesr   r	   r
   r   r   r   r   Ú_utilsr   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
paginationr   r   Ú_base_clientr   r   Útypes.beta.chatkitr   r   Ú!types.beta.chatkit.chatkit_threadr   Ú)types.beta.chatkit.thread_delete_responser   Ú+types.beta.chatkit.chatkit_thread_item_listr   Ú__all__r   r    r#   rw   r,   rx   r(   r(   r(   r)   Ú<module>   s2   $ ` `