o
    ØRWjNb  ã                   @  s|  d dl mZ d dlmZmZ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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(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddgZ4G dd„ deƒZ5G dd„ deƒZ6G dd„ dƒZ7G dd„ dƒZ8G dd„ dƒZ9G dd„ dƒZ:dS ) é    )Úannotations)ÚAnyÚListÚIterableÚcast)ÚLiteralNé   )Ú_legacy_response)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚomitÚ	not_given)Úpath_templateÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncConversationCursorPageÚAsyncConversationCursorPage)ÚAsyncPaginatorÚmake_request_options)Úitem_list_paramsÚitem_create_paramsÚitem_retrieve_params)ÚConversation)ÚResponseIncludable)ÚConversationItem)ÚResponseInputItemParam)ÚConversationItemListÚItemsÚ
AsyncItemsc                	   @  ó�   e Zd ZdZed.dd„ƒZed/dd„ƒZed	d	d	ed
œd0dd„Z	ed	d	d	ed
œd1dd„Z
eeeed	d	d	ed œd2d(d)„Zd	d	d	ed*œd3d,d-„Zd	S )4r%   ú,Manage conversations and conversation items.ÚreturnÚItemsWithRawResponsec                 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/   ús/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/openai/resources/conversations/items.pyÚwith_raw_response   ó   zItems.with_raw_responseÚItemsWithStreamingResponsec                 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
        )r3   r-   r/   r/   r0   Úwith_streaming_response)   ó   zItems.with_streaming_responseN©ÚincludeÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚconversation_idÚstrÚitemsú Iterable[ResponseInputItemParam]r8   úList[ResponseIncludable] | Omitr9   úHeaders | Noner:   úQuery | Noner;   úBody | Noner<   ú'float | httpx.Timeout | None | NotGivenr$   c                C  sX   |s	t d|›�ƒ‚| jtd|d�td|itjƒt||||td|itjƒddid�td	�S )
áä  
        Create items in a conversation with the given ID.

        Args:
          items: The items to add to the conversation. You may add up to 20 items at a time.

          include: Additional fields to include in the response. See the `include` parameter for
              [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
              for more information.

          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
        ú>Expected a non-empty value for `conversation_id` but received ú&/conversations/{conversation_id}/items©r=   r?   r8   Úbearer_authT©r9   r:   r;   r<   ÚqueryÚsecurity©ÚbodyÚoptionsÚcast_to)Ú
ValueErrorÚ_postr   r   r   ÚItemCreateParamsr   r$   ©r.   r=   r?   r8   r9   r:   r;   r<   r/   r/   r0   Úcreate2   s   
úõzItems.createÚitem_idr"   c                C  sj   |s	t d|›�ƒ‚|st d|›�ƒ‚tt| jtd||d�t||||td|itjƒddid�tt	tƒd	�ƒS )
áŽ  
        Get a single item from a conversation with the given IDs.

        Args:
          include: Additional fields to include in the response. See the `include` parameter for
              [listing Conversation items above](https://platform.openai.com/docs/api-reference/conversations/list-items#conversations_list_items-include)
              for more information.

          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
        rG   ú6Expected a non-empty value for `item_id` but received ú0/conversations/{conversation_id}/items/{item_id}©r=   rW   r8   rJ   TrK   ©rP   rQ   )
rR   r   r"   Ú_getr   r   r   r   ÚItemRetrieveParamsr   ©r.   rW   r=   r8   r9   r:   r;   r<   r/   r/   r0   Úretrievea   s*   ÿúôþzItems.retrieve©Úafterr8   ÚlimitÚorderr9   r:   r;   r<   rb   ú
str | Omitrc   ú
int | Omitrd   úLiteral['asc', 'desc'] | Omitú,SyncConversationCursorPage[ConversationItem]c          
      C  ó\   |s	t d|›�ƒ‚| jtd|d�tt t||||	t||||dœtjƒddid�t	t
tƒd�S ©	aä  
        List all items for a conversation with the given ID.

        Args:
          after: An item ID to list items after, used in pagination.

          include: Specify additional output data to include in the model response. Currently
              supported values are:

              - `web_search_call.action.sources`: Include the sources of the web search tool
                call.
              - `code_interpreter_call.outputs`: Includes the outputs of python code execution
                in code interpreter tool call items.
              - `computer_call_output.output.image_url`: Include image urls from the computer
                call output.
              - `file_search_call.results`: Include the search results of the file search tool
                call.
              - `message.input_image.image_url`: Include image urls from the input message.
              - `message.output_text.logprobs`: Include logprobs with assistant messages.
              - `reasoning.encrypted_content`: Includes an encrypted version of reasoning
                tokens in reasoning item outputs. This enables reasoning items to be used in
                multi-turn conversations when using the Responses API statelessly (like when
                the `store` parameter is set to `false`, or when an organization is enrolled
                in the zero data retention program).

          limit: A limit on the number of objects to be returned. Limit can range between 1 and
              100, and the default is 20.

          order: The order to return the input items in. Default is `desc`.

              - `asc`: Return the input items in ascending order.
              - `desc`: Return the input items in descending order.

          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
        rG   rH   rI   )rb   r8   rc   rd   rJ   TrK   )ÚpagerP   Úmodel)rR   Ú_get_api_listr   r   r"   r   r   r   ÚItemListParamsr   r   ©
r.   r=   rb   r8   rc   rd   r9   r:   r;   r<   r/   r/   r0   Úlist”   ó,   8
üù	òíz
Items.list©r9   r:   r;   r<   r    c             	   C  sP   |s	t d|›�ƒ‚|st d|›�ƒ‚| jtd||d�t||||ddid�td�S )	áj  
        Delete an item from a conversation with the given IDs.

        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
        rG   rY   rZ   r[   rJ   T©r9   r:   r;   r<   rM   r\   ©rR   Ú_deleter   r   r    ©r.   rW   r=   r9   r:   r;   r<   r/   r/   r0   Údeleteä   s"   ÿûõzItems.delete)r)   r*   )r)   r3   ©r=   r>   r?   r@   r8   rA   r9   rB   r:   rC   r;   rD   r<   rE   r)   r$   ©rW   r>   r=   r>   r8   rA   r9   rB   r:   rC   r;   rD   r<   rE   r)   r"   )r=   r>   rb   re   r8   rA   rc   rf   rd   rg   r9   rB   r:   rC   r;   rD   r<   rE   r)   rh   ©rW   r>   r=   r>   r9   rB   r:   rC   r;   rD   r<   rE   r)   r    ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r1   r5   r   r   rV   r`   rp   rx   r/   r/   r/   r0   r%      ó@    	õ4õ7óWöc                	   @  r'   )4r&   r(   r)   ÚAsyncItemsWithRawResponsec                 C  r+   r,   )r‚   r-   r/   r/   r0   r1     r2   zAsyncItems.with_raw_responseÚAsyncItemsWithStreamingResponsec                 C  r+   r4   )rƒ   r-   r/   r/   r0   r5     r6   z"AsyncItems.with_streaming_responseNr7   r=   r>   r?   r@   r8   rA   r9   rB   r:   rC   r;   rD   r<   rE   r$   c                Ã  sl   �|s
t d|›�ƒ‚| jtd|d�td|itjƒI dH t||||td|itjƒI dH ddid	�td
�I dH S )rF   rG   rH   rI   r?   Nr8   rJ   TrK   rN   )rR   rS   r   r   r   rT   r   r$   rU   r/   r/   r0   rV   %  s    €
úõzAsyncItems.createrW   r"   c                Ã  sx   �|s
t d|›�ƒ‚|st d|›�ƒ‚tt| jtd||d�t||||td|itjƒI dH ddid	�tt	tƒd
�I dH ƒS )rX   rG   rY   rZ   r[   r8   NrJ   TrK   r\   )
rR   r   r"   r]   r   r   r   r   r^   r   r_   r/   r/   r0   r`   T  s,   €ÿú
ôþzAsyncItems.retrievera   rb   re   rc   rf   rd   rg   úOAsyncPaginator[ConversationItem, AsyncConversationCursorPage[ConversationItem]]c          
      C  ri   rj   )rR   rm   r   r   r"   r   r   r   rn   r   r   ro   r/   r/   r0   rp   ‡  rq   zAsyncItems.listrr   r    c             	   Ã  sX   �|s
t d|›�ƒ‚|st d|›�ƒ‚| jtd||d�t||||ddid�td�I d	H S )
rs   rG   rY   rZ   r[   rJ   Trt   r\   Nru   rw   r/   r/   r0   rx   ×  s$   €ÿûõzAsyncItems.delete)r)   r‚   )r)   rƒ   ry   rz   )r=   r>   rb   re   r8   rA   rc   rf   rd   rg   r9   rB   r:   rC   r;   rD   r<   rE   r)   r„   r{   r|   r/   r/   r/   r0   r&     r�   c                   @  ó   e Zd Zddd„ZdS )	r*   r?   r%   r)   ÚNonec                 C  óB   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _d S ©N)Ú_itemsr	   Úto_raw_response_wrapperrV   r`   rp   rx   ©r.   r?   r/   r/   r0   Ú__init__  ó   ÿÿÿ
ÿzItemsWithRawResponse.__init__N©r?   r%   r)   r†   ©r}   r~   r   rŒ   r/   r/   r/   r0   r*     ó    r*   c                   @  r…   )	r‚   r?   r&   r)   r†   c                 C  r‡   rˆ   )r‰   r	   Úasync_to_raw_response_wrapperrV   r`   rp   rx   r‹   r/   r/   r0   rŒ     r�   z"AsyncItemsWithRawResponse.__init__N©r?   r&   r)   r†   r�   r/   r/   r/   r0   r‚     r�   r‚   c                   @  r…   )	r3   r?   r%   r)   r†   c                 C  ó:   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _d S rˆ   )r‰   r   rV   r`   rp   rx   r‹   r/   r/   r0   rŒ   '  ó   ÿÿÿ
ÿz#ItemsWithStreamingResponse.__init__NrŽ   r�   r/   r/   r/   r0   r3   &  r�   r3   c                   @  r…   )	rƒ   r?   r&   r)   r†   c                 C  r“   rˆ   )r‰   r   rV   r`   rp   rx   r‹   r/   r/   r0   rŒ   9  r”   z(AsyncItemsWithStreamingResponse.__init__Nr’   r�   r/   r/   r/   r0   rƒ   8  r�   rƒ   );Ú
__future__r   Útypingr   r   r   r   Útyping_extensionsr   ÚhttpxÚ r	   Ú_typesr
   r   r   r   r   r   r   Ú_utilsr   r   r   Ú_compatr   Ú	_resourcer   r   Ú	_responser   r   Ú
paginationr   r   Ú_base_clientr   r   Útypes.conversationsr   r   r   Ú types.conversations.conversationr    Ú#types.responses.response_includabler!   Ú%types.conversations.conversation_itemr"   Ú)types.responses.response_input_item_paramr#   Ú*types.conversations.conversation_item_listr$   Ú__all__r%   r&   r*   r‚   r3   rƒ   r/   r/   r/   r0   Ú<module>   s6   $ t t