o
    h]                     @  sx  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 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/m0Z0 ddl1m2Z2 ddgZ3G dd deZ4G dd deZ5G dd dZ6G dd dZ7G dd dZ8G dd dZ9dS )     )annotations)AnyListIterablecast)LiteralN   )_legacy_response)BodyOmitQueryHeadersNotGivenomit	not_given)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ed-ddZed.ddZeddded	d/ddZ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$   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-   e/var/www/html/openai_agents/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
        )r1   r+   r-   r-   r.   with_streaming_response'      zItems.with_streaming_responseNincludeextra_headersextra_query
extra_bodytimeoutconversation_idstritems Iterable[ResponseInputItemParam]r6   List[ResponseIncludable] | Omitr7   Headers | Noner8   Query | Noner9   Body | Noner:   'float | httpx.Timeout | None | NotGivenr#   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=   r6   r7   r8   r9   r:   querybodyoptionscast_to)
ValueError_postr   r   ItemCreateParamsr   r#   r,   r;   r=   r6   r7   r8   r9   r:   r-   r-   r.   create0   s   
zItems.createitem_idr!   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
        rE   6Expected a non-empty value for `item_id` but received rF   /items/r6   rH   rL   rM   )	rN   r   r!   _getr   r   r   ItemRetrieveParamsr   r,   rS   r;   r6   r7   r8   r9   r:   r-   r-   r.   retrieve^   s$   zItems.retrieveafterr6   limitorderr7   r8   r9   r:   r]   
str | Omitr^   
int | Omitr_   Literal['asc', 'desc'] | Omit,SyncConversationCursorPage[ConversationItem]c          
      C  V   |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
        rE   rF   rG   )r]   r6   r^   r_   rH   )pagerL   model)
rN   _get_api_listr   r!   r   r   r   ItemListParamsr   r   
r,   r;   r]   r6   r^   r_   r7   r8   r9   r:   r-   r-   r.   list   *   8
z
Items.listr7   r8   r9   r:   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
        rE   rU   rF   rV   rm   rW   rN   _deleter   r   r,   rS   r;   r7   r8   r9   r:   r-   r-   r.   delete   s   zItems.delete)r'   r(   )r'   r1   r;   r<   r=   r>   r6   r?   r7   r@   r8   rA   r9   rB   r:   rC   r'   r#   rS   r<   r;   r<   r6   r?   r7   r@   r8   rA   r9   rB   r:   rC   r'   r!   )r;   r<   r]   r`   r6   r?   r^   ra   r_   rb   r7   r@   r8   rA   r9   rB   r:   rC   r'   rc   rS   r<   r;   r<   r7   r@   r8   rA   r9   rB   r:   rC   r'   r   __name__
__module____qualname__r   r/   r3   r   r   rR   r[   rk   rr   r-   r-   r-   r.   r$      >    	34Vc                	   @  r&   )3r%   r'   AsyncItemsWithRawResponsec                 C  r)   r*   )r{   r+   r-   r-   r.   r/     r0   zAsyncItems.with_raw_responseAsyncItemsWithStreamingResponsec                 C  r)   r2   )r|   r+   r-   r-   r.   r3     r4   z"AsyncItems.with_streaming_responseNr5   r;   r<   r=   r>   r6   r?   r7   r@   r8   rA   r9   rB   r:   rC   r#   c                  sf   |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 )	rD   rE   rF   rG   r=   Nr6   rH   rJ   )rN   rO   r   r   rP   r   r#   rQ   r-   r-   r.   rR     s   
zAsyncItems.createrS   r!   c                  st   |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 )	rT   rE   rU   rF   rV   r6   NrH   rW   )	rN   r   r!   rX   r   r   r   rY   r   rZ   r-   r-   r.   r[   D  s&   
zAsyncItems.retriever\   r]   r`   r^   ra   r_   rb   OAsyncPaginator[ConversationItem, AsyncConversationCursorPage[ConversationItem]]c          
      C  rd   re   )
rN   rh   r   r!   r   r   r   ri   r   r   rj   r-   r-   r.   rk   t  rl   zAsyncItems.listrm   r   c                  sT   |s
t d||st d|| jd| d| t||||dtdI dH S )rn   rE   rU   rF   rV   rm   rW   Nro   rq   r-   r-   r.   rr     s   zAsyncItems.delete)r'   r{   )r'   r|   rs   rt   )r;   r<   r]   r`   r6   r?   r^   ra   r_   rb   r7   r@   r8   rA   r9   rB   r:   rC   r'   r}   ru   rv   r-   r-   r-   r.   r%     rz   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_wrapperrR   r[   rk   rr   r,   r=   r-   r-   r.   __init__     
zItemsWithRawResponse.__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_wrapperrR   r[   rk   rr   r   r-   r-   r.   r     r   z"AsyncItemsWithRawResponse.__init__Nr=   r%   r'   r   r   r-   r-   r-   r.   r{     r   r{   c                   @  r~   )	r1   r=   r$   r'   r   c                 C  :   || _ t|j| _t|j| _t|j| _t|j| _d S r   )r   r   rR   r[   rk   rr   r   r-   r-   r.   r        
z#ItemsWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r1     r   r1   c                   @  r~   )	r|   r=   r%   r'   r   c                 C  r   r   )r   r   rR   r[   rk   rr   r   r-   r-   r.   r     r   z(AsyncItemsWithStreamingResponse.__init__Nr   r   r-   r-   r-   r.   r|     r   r|   ):
__future__r   typingr   r   r   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.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{   r1   r|   r-   r-   r-   r.   <module>   s6   $ g g