U
    ·ÜŸjt  ã                   @  s  d dl 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 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 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ƒZ%G dd„ dƒZ&G dd„ dƒZ'dS )é    )Úannotations)ÚLiteralNé   )Ú_legacy_response)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úmaybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)Úto_streamed_response_wrapperÚ"async_to_streamed_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚAsyncPaginatorÚmake_request_options)Úmessage_list_params)ÚChatCompletionStoreMessageÚMessagesÚAsyncMessagesc                   @  s`   e Zd Zeddœdd„ƒZeddœdd„ƒZeeeddded	œd
dddddddddœ	dd„ZdS )r   ÚMessagesWithRawResponse©Ú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   úN/tmp/pip-unpacked-wheel-2qj3ofc_/openai/resources/chat/completions/messages.pyÚwith_raw_response   s    zMessages.with_raw_responseÚMessagesWithStreamingResponsec                 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 Messages.with_streaming_responseN©ÚafterÚlimitÚorderÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚstrústr | NotGivenúint | NotGivenú#Literal[('asc', 'desc')] | NotGivenúHeaders | NoneúQuery | NoneúBody | Noneú'float | httpx.Timeout | None | NotGivenz*SyncCursorPage[ChatCompletionStoreMessage]©	Úcompletion_idr&   r'   r(   r)   r*   r+   r,   r   c          	      C  sN   |st d|›�ƒ‚| jd|› d�tt t||||t|||dœtjƒd�td�S ©aò  Get the messages in a stored chat completion.

        Only Chat Completions that have
        been created with the `store` parameter set to `true` will be returned.

        Args:
          after: Identifier for the last message from the previous pagination request.

          limit: Number of messages to retrieve.

          order: Sort order for messages by timestamp. Use `asc` for ascending order or `desc`
              for descending order. Defaults to `asc`.

          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
        z<Expected a non-empty value for `completion_id` but received z/chat/completions/z	/messages)r&   r'   r(   )r)   r*   r+   r,   Úquery)ÚpageÚoptionsÚmodel)Ú
ValueErrorÚ_get_api_listr   r   r   r   r   ÚMessageListParams©	r   r6   r&   r'   r(   r)   r*   r+   r,   r   r   r    Úlist+   s(    #
ýúûïzMessages.list©Ú__name__Ú
__module__Ú__qualname__r   r!   r$   r   r@   r   r   r   r    r      s   	ôc                   @  s`   e Zd Zeddœdd„ƒZeddœdd„ƒZeeeddded	œd
dddddddddœ	dd„ZdS )r   ÚAsyncMessagesWithRawResponser   c                 C  s   t | ƒS r   )rE   r   r   r   r    r!   f   s    zAsyncMessages.with_raw_responseÚ"AsyncMessagesWithStreamingResponsec                 C  s   t | ƒS r#   )rF   r   r   r   r    r$   p   s    z%AsyncMessages.with_streaming_responseNr%   r-   r.   r/   r0   r1   r2   r3   r4   zWAsyncPaginator[ChatCompletionStoreMessage, AsyncCursorPage[ChatCompletionStoreMessage]]r5   c          	      C  sN   |st d|›�ƒ‚| jd|› d�tt t||||t|||dœtjƒd�td�S r7   )r<   r=   r   r   r   r   r   r>   r?   r   r   r    r@   y   s(    #
ýúûïzAsyncMessages.listrA   r   r   r   r    r   e   s   	ôc                   @  s   e Zd Zdddœdd„ZdS )r   r   ÚNone©Úmessagesr   c                 C  s   || _ t |j¡| _d S ©N)Ú	_messagesr   Zto_raw_response_wrapperr@   ©r   rI   r   r   r    Ú__init__´   s    ÿz MessagesWithRawResponse.__init__N©rB   rC   rD   rM   r   r   r   r    r   ³   s   r   c                   @  s   e Zd Zdddœdd„ZdS )rE   r   rG   rH   c                 C  s   || _ t |j¡| _d S rJ   )rK   r   Zasync_to_raw_response_wrapperr@   rL   r   r   r    rM   ½   s    ÿz%AsyncMessagesWithRawResponse.__init__NrN   r   r   r   r    rE   ¼   s   rE   c                   @  s   e Zd Zdddœdd„ZdS )r"   r   rG   rH   c                 C  s   || _ t|jƒ| _d S rJ   )rK   r   r@   rL   r   r   r    rM   Æ   s    ÿz&MessagesWithStreamingResponse.__init__NrN   r   r   r   r    r"   Å   s   r"   c                   @  s   e Zd Zdddœdd„ZdS )rF   r   rG   rH   c                 C  s   || _ t|jƒ| _d S rJ   )rK   r   r@   rL   r   r   r    rM   Ï   s    ÿz+AsyncMessagesWithStreamingResponse.__init__NrN   r   r   r   r    rF   Î   s   rF   )(Ú
__future__r   Útyping_extensionsr   ZhttpxÚ r   Ú_typesr   r   r   r	   r
   Ú_utilsr   Ú_compatr   Z	_resourcer   r   Ú	_responser   r   Z
paginationr   r   Z_base_clientr   r   Ztypes.chat.completionsr   Z(types.chat.chat_completion_store_messager   Ú__all__r   r   r   rE   r"   rF   r   r   r   r    Ú<module>   s&   NN			