o
    ¨Ýj”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(   ú`/var/www/html/chatgpt/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 | httpx2.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©ÚoptionsZ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   rN   ú
str | OmitrO   rP   ú
int | OmitrQ   úLiteral['asc', 'desc'] | OmitrR   ú)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)rN   rO   rP   rQ   rR   rB   T©r1   r2   r3   r4   ÚqueryrD   ©ÚpagerF   Úmodel)Ú_get_api_listr   r   r   r   r   ÚThreadListParams©
r'   rN   rO   rP   rQ   rR   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   ©rH   Ú_deleter   r   r   rJ   r(   r(   r)   Údelete”   rL   zThreads.delete©rN   rO   rP   rQ   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   )rN   rO   rP   rQ   rB   TrY   r[   )rH   r^   r   r   r   r   r   r   ÚThreadListItemsParamsr   r   ©
r'   r5   rN   rO   rP   rQ   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   )rN   rS   rO   rS   rP   rT   rQ   rU   rR   rS   r1   r7   r2   r8   r3   r9   r4   r:   r"   rV   ©r5   r6   r1   r7   r2   r8   r3   r9   r4   r:   r"   r   )r5   r6   rN   rS   rO   rS   rP   rT   rQ   rU   r1   r7   r2   r8   r3   r9   r4   r:   r"   rh   ©Ú__name__Ú
__module__Ú__qualname__r   r*   r.   r   rK   r   ra   rf   rm   r(   r(   r(   r)   r      óD    	÷)óF÷*óc                
   @  r!   )0r    r"   ÚAsyncThreadsWithRawResponsec                 C  r$   r%   )rv   r&   r(   r(   r)   r*   ú   r+   zAsyncThreads.with_raw_responseÚ!AsyncThreadsWithStreamingResponsec                 C  r$   r-   )rw   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   NrG   rJ   r(   r(   r)   rK     ó   €
û÷zAsyncThreads.retrieverM   rN   rS   rO   rP   rT   rQ   rU   rR   úIAsyncPaginator[ChatKitThread, AsyncConversationCursorPage[ChatKitThread]]c       	   
      C  rW   rX   )r^   r   r   r   r   r   r_   r`   r(   r(   r)   ra   3  rb   zAsyncThreads.listr   c             	   Ã  rx   )rc   r=   r>   r?   r@   rA   rB   TrC   rE   Nrd   rJ   r(   r(   r)   rf   s  ry   zAsyncThreads.deleterg   ú7AsyncPaginator[Data, AsyncConversationCursorPage[Data]]c          
      C  ri   rj   )rH   r^   r   r   r   r   r   r   rk   r   r   rl   r(   r(   r)   rm   ™  rn   zAsyncThreads.list_items)r"   rv   )r"   rw   ro   )rN   rS   rO   rS   rP   rT   rQ   rU   rR   rS   r1   r7   r2   r8   r3   r9   r4   r:   r"   rz   rp   )r5   r6   rN   rS   rO   rS   rP   rT   rQ   rU   r1   r7   r2   r8   r3   r9   r4   r:   r"   r{   rq   r(   r(   r(   r)   r    ù   ru   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   Zto_raw_response_wrapperrK   ra   rf   rm   ©r'   r}   r(   r(   r)   Ú__init__Ù  ó   ÿÿÿ
ÿzThreadsWithRawResponse.__init__N©r}   r   r"   r~   ©rr   rs   rt   rƒ   r(   r(   r(   r)   r#   Ø  ó    r#   c                   @  r|   )	rv   r}   r    r"   r~   c                 C  r   r€   )r�   r   Zasync_to_raw_response_wrapperrK   ra   rf   rm   r‚   r(   r(   r)   rƒ   ë  r„   z$AsyncThreadsWithRawResponse.__init__N©r}   r    r"   r~   r†   r(   r(   r(   r)   rv   ê  r‡   rv   c                   @  r|   )	r,   r}   r   r"   r~   c                 C  ó:   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S r€   )r�   r   rK   ra   rf   rm   r‚   r(   r(   r)   rƒ   ý  ó   ÿÿÿ
ÿz%ThreadsWithStreamingResponse.__init__Nr…   r†   r(   r(   r(   r)   r,   ü  r‡   r,   c                   @  r|   )	rw   r}   r    r"   r~   c                 C  r‰   r€   )r�   r   rK   ra   rf   rm   r‚   r(   r(   r)   rƒ     rŠ   z*AsyncThreadsWithStreamingResponse.__init__Nrˆ   r†   r(   r(   r(   r)   rw     r‡   rw   )3Ú
__future__r   Útypingr   r   Ztyping_extensionsr   Zhttpx2Ú r   Ú_typesr   r	   r
   r   r   r   r   Z_utilsr   r   Z_compatr   Z	_resourcer   r   Ú	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.beta.chatkitr   r   Z!types.beta.chatkit.chatkit_threadr   Z)types.beta.chatkit.thread_delete_responser   Z+types.beta.chatkit.chatkit_thread_item_listr   Ú__all__r   r    r#   rv   r,   rw   r(   r(   r(   r)   Ú<module>   s2   $ ` `