U
    h^                     @  sp  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 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%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddgZ1G dd deZ2G dd deZ3G dd dZ4G dd dZ5G dd dZ6G dd dZ7dS )     )annotations)AnyListIterablecast)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)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                   @  s   e Zd ZeddddZeddddZeddded	d
ddddddddddZeddded	d
d
dddddddddZeeeedddedd
dddddddddd
dd Z	ddded!d
d
ddddd"d#d$d%Z
dS )&r"   ItemsWithRawResponsereturnc                 C  s   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*   H/tmp/pip-unpacked-wheel-dms8d3uv/openai/resources/conversations/items.pywith_raw_response   s    zItems.with_raw_responseItemsWithStreamingResponsec                 C  s   t | S 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'   s    zItems.with_streaming_responseNincludeextra_headersextra_query
extra_bodytimeoutstr Iterable[ResponseInputItemParam]#List[ResponseIncludable] | NotGivenHeaders | NoneQuery | NoneBody | None'float | httpx.Timeout | None | NotGivenr!   conversation_iditemsr1   r2   r3   r4   r5   r&   c                C  sR   |st d|| jd| dtd|itjt||||td|itj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//itemsr?   r1   r2   r3   r4   r5   querybodyoptionscast_to)
ValueError_postr   r   ItemCreateParamsr   r!   r)   r>   r?   r1   r2   r3   r4   r5   r*   r*   r+   create0   s    
zItems.creater   item_idr>   r1   r2   r3   r4   r5   r&   c                C  sf   |st d||s$t d|tt| jd| d| t||||td|itj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
        rA   6Expected a non-empty value for `item_id` but received rB   /items/r1   rD   rH   rI   )	rJ   r   r   _getr   r   r   ItemRetrieveParamsr   r)   rP   r>   r1   r2   r3   r4   r5   r*   r*   r+   retrieve^   s$    zItems.retrieveafterr1   limitorderr2   r3   r4   r5   str | NotGivenint | NotGiven#Literal[('asc', 'desc')] | NotGivenz,SyncConversationCursorPage[ConversationItem]
r>   rZ   r1   r[   r\   r2   r3   r4   r5   r&   c          
      C  sV   |st d|| jd| dtt t||||	t||||dtj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
        rA   rB   rC   )rZ   r1   r[   r\   rD   )pagerH   model)
rJ   _get_api_listr   r   r   r   r   ItemListParamsr   r   
r)   r>   rZ   r1   r[   r\   r2   r3   r4   r5   r*   r*   r+   list   s*    8
z
Items.listr2   r3   r4   r5   r   rP   r>   r2   r3   r4   r5   r&   c                C  sL   |st d||s$t d|| jd| d| t||||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
        rA   rR   rB   rS   rh   rT   rJ   _deleter   r   r)   rP   r>   r2   r3   r4   r5   r*   r*   r+   delete   s       zItems.delete__name__
__module____qualname__r   r,   r/   r
   rN   rX   rg   rn   r*   r*   r*   r+   r"      s<   	 3 4$Vc                   @  s   e Zd ZeddddZeddddZeddded	d
ddddddddddZeddded	d
d
dddddddddZeeeedddedd
dddddddddd
dd Z	ddded!d
d
ddddd"d#d$d%Z
dS )&r#   AsyncItemsWithRawResponser%   c                 C  s   t | S r'   )rs   r(   r*   r*   r+   r,     s    zAsyncItems.with_raw_responseAsyncItemsWithStreamingResponsec                 C  s   t | S r.   )rt   r(   r*   r*   r+   r/     s    z"AsyncItems.with_streaming_responseNr0   r6   r7   r8   r9   r:   r;   r<   r!   r=   c                  sd   |st d|| jd| dtd|itjI dH t||||td|itjI dH dtdI dH S )	r@   rA   rB   rC   r?   Nr1   rD   rF   )rJ   rK   r   r   rL   r   r!   rM   r*   r*   r+   rN     s    
zAsyncItems.creater   rO   c                  sr   |st d||s$t d|tt| jd| d| t||||td|itjI dH dtttdI dH S )	rQ   rA   rR   rB   rS   r1   NrD   rT   )	rJ   r   r   rU   r   r   r   rV   r   rW   r*   r*   r+   rX   D  s$    
zAsyncItems.retrieverY   r]   r^   r_   zOAsyncPaginator[ConversationItem, AsyncConversationCursorPage[ConversationItem]]r`   c          
      C  sV   |st d|| jd| dtt t||||	t||||dtjdtt	tdS ra   )
rJ   rd   r   r   r   r   r   re   r   r   rf   r*   r*   r+   rg   t  s*    8
zAsyncItems.listrh   r   ri   c                  sR   |st d||s$t d|| jd| d| t||||dtdI dH S )rj   rA   rR   rB   rS   rh   rT   Nrk   rm   r*   r*   r+   rn     s       zAsyncItems.deletero   r*   r*   r*   r+   r#     s<   	 3 4$Vc                   @  s   e Zd ZdddddZdS )r$   r"   Noner?   r&   c                 C  sB   || _ t|j| _t|j| _t|j| _t|j| _d S N)_itemsr	   Zto_raw_response_wrapperrN   rX   rg   rn   r)   r?   r*   r*   r+   __init__  s    zItemsWithRawResponse.__init__Nrp   rq   rr   rz   r*   r*   r*   r+   r$     s   r$   c                   @  s   e Zd ZdddddZdS )rs   r#   ru   rv   c                 C  sB   || _ t|j| _t|j| _t|j| _t|j| _d S rw   )rx   r	   Zasync_to_raw_response_wrapperrN   rX   rg   rn   ry   r*   r*   r+   rz     s    z"AsyncItemsWithRawResponse.__init__Nr{   r*   r*   r*   r+   rs     s   rs   c                   @  s   e Zd ZdddddZdS )r-   r"   ru   rv   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S rw   )rx   r   rN   rX   rg   rn   ry   r*   r*   r+   rz     s    z#ItemsWithStreamingResponse.__init__Nr{   r*   r*   r*   r+   r-     s   r-   c                   @  s   e Zd ZdddddZdS )rt   r#   ru   rv   c                 C  s:   || _ t|j| _t|j| _t|j| _t|j| _d S rw   )rx   r   rN   rX   rg   rn   ry   r*   r*   r+   rz     s    z(AsyncItemsWithStreamingResponse.__init__Nr{   r*   r*   r*   r+   rt     s   rt   )8
__future__r   typingr   r   r   r   Ztyping_extensionsr   Zhttpx r	   _typesr
   r   r   r   r   _utilsr   r   _compatr   Z	_resourcer   r   	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.conversationsr   r   r   Z types.conversations.conversationr   Z#types.responses.response_includabler   Z%types.conversations.conversation_itemr   Z)types.responses.response_input_item_paramr    Z*types.conversations.conversation_item_listr!   __all__r"   r#   r$   rs   r-   rt   r*   r*   r*   r+   <module>   s4    g g