
    +hxk                    D   d dl mZ d dlmZmZmZ d dlmZ d dlZddl	m
Z
mZmZ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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"m#Z#m$Z$ ddl%m&Z&m'Z' erddl(m)Z)m*Z* ddgZ+ G d de      Z, G d de      Z- G d d      Z. G d d      Z/y)    )annotations)TYPE_CHECKINGListOptional)LiteralN   )Files
AsyncFilesFilesWithRawResponseAsyncFilesWithRawResponse   )	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transform)SyncAPIResourceAsyncAPIResource)to_raw_response_wrapperasync_to_raw_response_wrapper)SyncCursorPageAsyncCursorPage)	AssistantAssistantDeletedassistant_list_paramsassistant_create_paramsassistant_update_params)AsyncPaginatormake_request_options)OpenAIAsyncOpenAI
AssistantsAsyncAssistantsc                  j    e Zd ZU ded<   ded<   d fdZeeeeeeddded
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded		 	 	 	 	 	 	 	 	 	 	 dd
Zeeeeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	ddded		 	 	 	 	 	 	 	 	 	 	 ddZ
 xZS )r#   r	   filesAssistantsWithRawResponsewith_raw_responsec                d    t         |   |       t        |      | _        t	        |       | _        y N)super__init__r	   r&   r'   r(   selfclient	__class__s     ^/var/www/html/venv/lib/python3.12/site-packages/openai/resources/beta/assistants/assistants.pyr,   zAssistants.__init__#   s(     6]
!:4!@    N
descriptionfile_idsinstructionsmetadatanametoolsextra_headersextra_query
extra_bodytimeoutc                   ddi|xs i }| j                  dt        |||||||dt        j                        t	        ||	|
|      t
              S )  
        Create an assistant with a model and instructions.

        Args:
          model: ID of the model to use. You can use the
              [List models](https://platform.openai.com/docs/api-reference/models/list) API to
              see all of your available models, or see our
              [Model overview](https://platform.openai.com/docs/models/overview) for
              descriptions of them.

          description: The description of the assistant. The maximum length is 512 characters.

          file_ids: A list of [file](https://platform.openai.com/docs/api-reference/files) IDs
              attached to this assistant. There can be a maximum of 20 files attached to the
              assistant. Files are ordered by their creation date in ascending order.

          instructions: The system instructions that the assistant uses. The maximum length is 32768
              characters.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format. Keys
              can be a maximum of 64 characters long and values can be a maxium of 512
              characters long.

          name: The name of the assistant. The maximum length is 256 characters.

          tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per
              assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.

          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
        OpenAI-Betaassistants=v1/assistantsmodelr4   r5   r6   r7   r8   r9   r:   r;   r<   r=   bodyoptionscast_to_postr   r   AssistantCreateParamsr    r   r.   rD   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   s               r1   createzAssistants.create(   sy    l 'QM<ORQzz "#. ($0 ( " (== )+Q[el #  
 	
r2   rE   c          	     f    ddi|xs i }| j                  d| t        ||||      t              S )K  
        Retrieves an assistant.

        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@   rA   /assistants/rE   rH   rI   _getr    r   r.   assistant_idr:   r;   r<   r=   s         r1   retrievezAssistants.retrieves   sP    . 'QM<ORQyy<.)(+Q[el   
 	
r2   r4   r5   r6   r7   rD   r8   r9   r:   r;   r<   r=   c                   ddi|	xs i }	| j                  d| t        |||||||dt        j                        t	        |	|
||      t
              S )k  Modifies an assistant.

        Args:
          description: The description of the assistant.

        The maximum length is 512 characters.

          file_ids: A list of [File](https://platform.openai.com/docs/api-reference/files) IDs
              attached to this assistant. There can be a maximum of 20 files attached to the
              assistant. Files are ordered by their creation date in ascending order. If a
              file was previosuly attached to the list but does not show up in the list, it
              will be deleted from the assistant.

          instructions: The system instructions that the assistant uses. The maximum length is 32768
              characters.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format. Keys
              can be a maximum of 64 characters long and values can be a maxium of 512
              characters long.

          model: ID of the model to use. You can use the
              [List models](https://platform.openai.com/docs/api-reference/models/list) API to
              see all of your available models, or see our
              [Model overview](https://platform.openai.com/docs/models/overview) for
              descriptions of them.

          name: The name of the assistant. The maximum length is 256 characters.

          tools: A list of tool enabled on the assistant. There can be a maximum of 128 tools per
              assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`.

          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@   rA   rQ   r4   r5   r6   r7   rD   r8   r9   rE   rF   rK   r   r   AssistantUpdateParamsr    r   r.   rV   r4   r5   r6   r7   rD   r8   r9   r:   r;   r<   r=   s                r1   updatezAssistants.update   s    t 'QM<ORQzz<.) #. ($0 (" " (== )+Q[el #  
 	
r2   afterbeforelimitorderr:   r;   r<   r=   c                   ddi|xs i }| j                  dt        t           t        ||||t	        ||||dt
        j                              t              S a  Returns a list of assistants.

        Args:
          after: A cursor for use in pagination.

        `after` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include after=obj_foo in order to
              fetch the next page of the list.

          before: A cursor for use in pagination. `before` is an object ID that defines your place
              in the list. For instance, if you make a list request and receive 100 objects,
              ending with obj_foo, your subsequent call can include before=obj_foo in order to
              fetch the previous page of the list.

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

          order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending
              order and `desc` for 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
        r@   rA   rB   )ra   rb   rc   rd   )r:   r;   r<   r=   query)pagerH   rD   )_get_api_listr   r   r    r   r   AssistantListParams	r.   ra   rb   rc   rd   r:   r;   r<   r=   s	            r1   listzAssistants.list   sy    V 'QM<ORQ!!	*(+'%%!&"(!&!&	 *== % " 
 	
r2   c          	     f    ddi|xs i }| j                  d| t        ||||      t              S )H  
        Delete an assistant.

        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@   rA   rQ   rE   rR   _deleter    r   rU   s         r1   deletezAssistants.delete#  sP    . 'QM<ORQ||<.)(+Q[el %  
 	
r2   )r/   r!   returnNonerD   strr4   Optional[str] | NotGivenr5   List[str] | NotGivenr6   rv   r7   Optional[object] | NotGivenr8   rv   r9   z-List[assistant_create_params.Tool] | NotGivenr:   Headers | Noner;   Query | Noner<   Body | Noner=   'float | httpx.Timeout | None | NotGivenrr   r   rV   ru   r:   ry   r;   rz   r<   r{   r=   r|   rr   r   rV   ru   r4   rv   r5   rw   r6   rv   r7   rx   rD   str | NotGivenr8   rv   r9   z-List[assistant_update_params.Tool] | NotGivenr:   ry   r;   rz   r<   r{   r=   r|   rr   r   )ra   r   rb   r   rc   int | NotGivenrd   !Literal['asc', 'desc'] | NotGivenr:   ry   r;   rz   r<   r{   r=   r|   rr   zSyncCursorPage[Assistant]rV   ru   r:   ry   r;   rz   r<   r{   r=   r|   rr   r   __name__
__module____qualname____annotations__r,   r   rN   rW   r_   rl   rq   __classcell__r0   s   @r1   r#   r#      s   L00A 1:)21:09)2?H )-$("&;DI
 I
 .	I

 'I
 /I
 .I
 'I
 =I
 &I
 "I
  I
 9I
  
!I
b )-$("&;D

 &
 "
  
 9
 

H 1:)21:09 ))2?H )-$("&;D!M
M
 .	M

 'M
 /M
 .M
 M
 'M
 =M
 &M
 "M
  M
  9!M
" 
#M
d !*!* )3< )-$("&;D?
 ?
 	?

 ?
 1?
 &?
 "?
  ?
 9?
 
#?
N )-$("&;D

 &
 "
  
 9
 

r2   c                  j    e Zd ZU ded<   ded<   d fdZeeeeeeddded
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded		 	 	 	 	 	 	 	 	 	 	 dd
Zeeeeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	ddded		 	 	 	 	 	 	 	 	 	 	 ddZ
 xZS )r$   r
   r&   AsyncAssistantsWithRawResponser(   c                d    t         |   |       t        |      | _        t	        |       | _        y r*   )r+   r,   r
   r&   r   r(   r-   s     r1   r,   zAsyncAssistants.__init__H  s)     '
!?!Er2   Nr3   c                  K   ddi|xs i }| j                  dt        |||||||dt        j                        t	        ||	|
|      t
               d{   S 7 w)r?   r@   rA   rB   rC   rE   rF   NrJ   rM   s               r1   rN   zAsyncAssistants.createM  s     l 'QM<ORQZZ "#. ($0 ( " (== )+Q[el #   
 
 	
 
s   AAAArE   c          	        K   ddi|xs i }| j                  d| t        ||||      t               d{   S 7 w)rP   r@   rA   rQ   rE   rR   NrS   rU   s         r1   rW   zAsyncAssistants.retrieve  s^     . 'QM<ORQYY<.)(+Q[el   
 
 	
 
   6?=?rX   c                  K   ddi|	xs i }	| j                  d| t        |||||||dt        j                        t	        |	|
||      t
               d{   S 7 w)rZ   r@   rA   rQ   r[   rE   rF   Nr\   r^   s                r1   r_   zAsyncAssistants.update  s     t 'QM<ORQZZ<.) #. ($0 (" " (== )+Q[el #   
 
 	
 
s   AA AA r`   c                   ddi|xs i }| j                  dt        t           t        ||||t	        ||||dt
        j                              t              S rf   )ri   r   r   r    r   r   rj   rk   s	            r1   rl   zAsyncAssistants.list  sy    V 'QM<ORQ!! +(+'%%!&"(!&!&	 *== % " 
 	
r2   c          	        K   ddi|xs i }| j                  d| t        ||||      t               d{   S 7 w)rn   r@   rA   rQ   rE   rR   Nro   rU   s         r1   rq   zAsyncAssistants.deleteH  s^     . 'QM<ORQ\\<.)(+Q[el % " 
 
 	
 
r   )r/   r"   rr   rs   rt   r}   r~   )ra   r   rb   r   rc   r   rd   r   r:   ry   r;   rz   r<   r{   r=   r|   rr   z5AsyncPaginator[Assistant, AsyncCursorPage[Assistant]]r   r   r   s   @r1   r$   r$   D  s   55F 1:)21:09)2?H )-$("&;DI
 I
 .	I

 'I
 /I
 .I
 'I
 =I
 &I
 "I
  I
 9I
  
!I
b )-$("&;D

 &
 "
  
 9
 

H 1:)21:09 ))2?H )-$("&;D!M
M
 .	M

 'M
 /M
 .M
 M
 'M
 =M
 &M
 "M
  M
  9!M
" 
#M
d !*!* )3< )-$("&;D?
 ?
 	?

 ?
 1?
 &?
 "?
  ?
 9?
 
??
N )-$("&;D

 &
 "
  
 9
 

r2   c                      e Zd ZddZy)r'   c                <   t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        y r*   )r   r&   r   rN   rW   r_   rl   rq   r.   
assistantss     r1   r,   z"AssistantsWithRawResponse.__init__j  s    )**:*:;
-
 0
 .
 ,OO
	 .
r2   N)r   r#   rr   rs   r   r   r   r,    r2   r1   r'   r'   i      
r2   r'   c                      e Zd ZddZy)r   c                <   t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        y r*   )r   r&   r   rN   rW   r_   rl   rq   r   s     r1   r,   z'AsyncAssistantsWithRawResponse.__init__  s    .z/?/?@
3
 6
 4
 2OO
	 4
r2   N)r   r$   rr   rs   r   r   r2   r1   r   r   ~  r   r2   r   )0
__future__r   typingr   r   r   typing_extensionsr   httpxr&   r	   r
   r   r   _typesr   r   r   r   r   _utilsr   	_resourcer   r   	_responser   r   
paginationr   r   
types.betar   r   r   r   r   _base_clientr   r    _clientr!   r"   __all__r#   r$   r'   r   r   r2   r1   <module>r      s    # 0 0 %  U U @ @ & ; P :  B/*
+b
 b
J	b
& b
J	
 
*
 
r2   