
    h&                       S SK Jr  S SKJrJrJrJr  S SKJrJ	r	  S SK
r
SSKJr  SSKJr  SSKJrJrJrJrJrJr  SS	KJrJrJr  SS
KJr  SSKJrJr  SSKJ r J!r!  SSK"J#r#J$r$J%r%J&r&  SSK'J(r(J)r)  SSK*J+r+J,r,J-r-  SSK.Jr  SSK/J0r0  SSK1J2r2  SSK3J4r4  SS/r5 " S S\5      r6 " S S\5      r7 " S S5      r8 " S S5      r9 " S S5      r: " S S5      r;g)    )annotations)TYPE_CHECKINGDictUnionOptional)Literalassert_neverN   )_legacy_response)FileChunkingStrategyParam)	NOT_GIVENBodyQueryHeadersNotGiven	FileTypes)is_givenmaybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncPage	AsyncPageSyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)file_list_paramsfile_create_paramsfile_update_params)VectorStoreFile)FileContentResponse)VectorStoreFileDeletedFiles
AsyncFilesc            
         \ rS rSr\SS j5       r\SS j5       r\\SSS\S.                 SS jjrSSS\S.             SS jjr	SSS\S.               SS	 jjr
\\\\\SSS\S
.	                     SS jjrSSS\S.             SS jjr\\S.         SS jjr\S.       SS jjr\S.       SS jjr\\S.         S S jjrSSS\S.             S!S jjrSrg)"r'       c                    [        U 5      $ z
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
)FilesWithRawResponseselfs    V/var/www/html/env/lib/python3.13/site-packages/openai/resources/vector_stores/files.pywith_raw_responseFiles.with_raw_response!   s     $D))    c                    [        U 5      $ 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
)FilesWithStreamingResponser.   s    r0   with_streaming_responseFiles.with_streaming_response+   s     *$//r3   N
attributeschunking_strategyextra_headersextra_query
extra_bodytimeoutc                   U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        UUUS.[        R                  5      [        XVXxS9[        S9$ )	  
Create a vector store file by attaching a
[File](https://platform.openai.com/docs/api-reference/files) to a
[vector store](https://platform.openai.com/docs/api-reference/vector-stores/object).

Args:
  file_id: A [File](https://platform.openai.com/docs/api-reference/files) ID that the
      vector store should use. Useful for tools like `file_search` that can access
      files.

  attributes: 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, and
      querying for objects via API or the dashboard. Keys are strings with a maximum
      length of 64 characters. Values are strings with a maximum length of 512
      characters, booleans, or numbers.

  chunking_strategy: The chunking strategy used to chunk the file(s). If not set, will use the `auto`
      strategy. Only applicable if `file_ids` is non-empty.

  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 `vector_store_id` but received OpenAI-Betaassistants=v2/vector_stores//filesfile_idr:   r;   r<   r=   r>   r?   bodyoptionscast_to)
ValueError_postr   r"   FileCreateParamsr    r$   	r/   vector_store_idrH   r:   r;   r<   r=   r>   r?   s	            r0   createFiles.create4   s    R ]^m]pqrr&QM<ORQzzo.f5 &",):
 #33 )+Q[ $  
 	
r3   rI   c          
         U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        X4XVS9[        S9$ )	  
Retrieves a vector store file.

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
rB   6Expected a non-empty value for `file_id` but received rC   rD   rE   /files/rI   rL   rM   rN   _getr    r$   r/   rH   rR   r<   r=   r>   r?   s          r0   retrieveFiles.retrievep   s    0 ]^m]pqrrUV]U`abb&QM<ORQyyo.ggY?(+Q[ $  
 	
r3   c                   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        SU0[        R                  5      [        XEXgS9[        S	9$ )
  
Update attributes on a vector store file.

Args:
  attributes: 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, and
      querying for objects via API or the dashboard. Keys are strings with a maximum
      length of 64 characters. Values are strings with a maximum length of 512
      characters, booleans, or numbers.

  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
rB   rW   rC   rD   rE   rX   r:   rI   rJ   )rN   rO   r   r#   FileUpdateParamsr    r$   r/   rH   rR   r:   r<   r=   r>   r?   s           r0   updateFiles.update   s    > ]^m]pqrrUV]U`abb&QM<ORQzzo.ggY? ,
!;=O=`=`a(+Q[ $  
 	
r3   	afterbeforefilterlimitorderr<   r=   r>   r?   c       	            U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        [           [	        UUU	U
[        UUUUUS.[        R                  5      S9[        S9$ 	a  
Returns a list of vector store files.

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,
      starting with obj_foo, your subsequent call can include before=obj_foo in order
      to fetch the previous page of the list.

  filter: Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`.

  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
rB   rC   rD   rE   rF   )rf   rg   rh   ri   rj   )r<   r=   r>   r?   querypagerL   model)rN   _get_api_listr   r$   r    r   r!   FileListParamsr/   rR   rf   rg   rh   ri   rj   r<   r=   r>   r?   s              r0   list
Files.list   s    \ ]^m]pqrr&QM<ORQ!!o.f50(+'%%!&"("(!&!& %33	  "' " 
 	
r3   c          
         U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        X4XVS9[        S9$ )	  Delete a vector store file.

This will remove the file from the vector store but
the file itself will not be deleted. To delete the file, use the
[delete file](https://platform.openai.com/docs/api-reference/files/delete)
endpoint.

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
rB   rW   rC   rD   rE   rX   rI   rY   rN   _deleter    r&   r\   s          r0   deleteFiles.delete	  s    8 ]^m]pqrrUV]U`abb&QM<ORQ||o.ggY?(+Q[ +  
 	
r3   poll_interval_msr;   c               D    U R                  X!US9  U R                  UUUS9$ )HAttach a file to the given vector store and wait for it to be processed.rR   rH   r;   rR   r}   rS   pollr/   rH   rR   r}   r;   s        r0   create_and_pollFiles.create_and_poll2  s4     	OXijyy+-  
 	
r3   r}   c                  SS0n[        U5      (       a  [        U5      US'    U R                  R                  UUUS9nUR	                  5       nUR
                  S:X  aQ  [        U5      (       d,  UR                  R                  S5      nUb  [        U5      nOSnU R                  US-  5        OUUR
                  S:X  d   UR
                  S	:X  d  UR
                  S
:X  a  U$ [        (       a  [        UR
                  5        OU$ M  )Wait for the vector store file to finish processing.

Note: this will return even if the file failed to process, you need to check
file.last_error and file.status to handle these cases
X-Stainless-Poll-Helpertrue X-Stainless-Custom-Poll-IntervalrR   r<   in_progressopenai-poll-after-ms  	cancelled	completedfailedr   strr1   r]   parsestatusheadersgetint_sleepr   r	   r/   rH   rR   r}   r   responsefilefrom_headers           r0   r   
Files.pollC  s     $=f"E$%%:=>N:OG67--66 /% 7 H >>#D{{m+ 011"*"2"2"6"67M"NK".+.{+;(+/(,t34+t{{k/IT[[\dMd = -K/ r3   r;   c               ~    U R                   R                  R                  USS9nU R                  XR                  US9$ )Upload a file to the `files` API and then attach it to the given vector store.

Note the file will be asynchronously processed (you can use the alternative
polling helper method to wait for processing to complete).

assistantsr   purposer   _clientfilesrS   idr/   rR   r   r;   file_objs        r0   uploadFiles.uploadl  s;     <<%%,,$,M{{?KKct{uur3   c                   U R                   R                  R                  USS9nU R                  UUR                  UUS9$ )CAdd a file to a vector store and poll until processing is complete.r   r   )rR   rH   r;   r}   r   r   rS   r   r   r/   rR   r   r}   r;   r   s         r0   upload_and_pollFiles.upload_and_poll{  sK     <<%%,,$,M##+KK/-	 $ 
 	
r3   c                   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU S3[        [           [	        X4XVS9[        S	9$ 
a0  
Retrieve the parsed contents of a vector store file.

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
rB   rW   rC   rD   rE   rX   z/contentrI   rn   )rN   rq   r   r%   r    r\   s          r0   contentFiles.content  s    0 ]^m]pqrrUV]U`abb&QM<ORQ!!o.ggYhG-.(+Q[ & " 
 	
r3    )returnr-   )r   r6   rR   r   rH   r   r:   z7Optional[Dict[str, Union[str, float, bool]]] | NotGivenr;   $FileChunkingStrategyParam | NotGivenr<   Headers | Noner=   Query | Noner>   Body | Noner?   'float | httpx.Timeout | None | NotGivenr   r$   rH   r   rR   r   r<   r   r=   r   r>   r   r?   r   r   r$   rH   r   rR   r   r:   z,Optional[Dict[str, Union[str, float, bool]]]r<   r   r=   r   r>   r   r?   r   r   r$   )rR   r   rf   str | NotGivenrg   r   rh   ELiteral['in_progress', 'completed', 'failed', 'cancelled'] | NotGivenri   int | NotGivenrj   !Literal['asc', 'desc'] | NotGivenr<   r   r=   r   r>   r   r?   r   r   zSyncCursorPage[VectorStoreFile]rH   r   rR   r   r<   r   r=   r   r>   r   r?   r   r   r&   
rH   r   rR   r   r}   r   r;   r   r   r$   rH   r   rR   r   r}   r   r   r$   rR   r   r   r   r;   r   r   r$   
rR   r   r   r   r}   r   r;   r   r   r$   )rH   r   rR   r   r<   r   r=   r   r>   r   r?   r   r   zSyncPage[FileContentResponse]__name__
__module____qualname____firstlineno__r   r1   r7   r   rS   r]   rc   rt   rz   r   r   r   r   r   __static_attributes__r   r3   r0   r'   r'       s   * * 0 0 OXBK )-$("&;D:
:
 	:

 L:
 @:
 &:
 ":
  :
 9:
 
:
F )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
Z )-$("&;D+
+
 	+

 A+
 &+
 "+
  +
 9+
 
+
b !*!*Xa )3< )-$("&;DE
E
 	E

 E
 VE
 E
 1E
 &E
 "E
  E
 9E
 
)E
\ )-$("&;D'
'
 	'
 &'
 "'
  '
 9'
 
 '
\ ,5BK

 	

 )
 @
 

, ,5' '  	' 
 )'  
' \ CLv v 	v
 @v 
v( ,5BK
 
 	

 )
 @
 

0 )-$("&;D$
$
 	$
 &$
 "$
  $
 9$
 
'$
 $
r3   c            
         \ rS rSr\SS j5       r\SS j5       r\\SSS\S.                 SS jjrSSS\S.             SS jjr	SSS\S.               SS	 jjr
\\\\\SSS\S
.	                     SS jjrSSS\S.             SS jjr\\S.         SS jjr\S.       SS jjr\S.       SS jjr\\S.         S S jjrSSS\S.             S!S jjrSrg)"r(   i  c                    [        U 5      $ r,   )AsyncFilesWithRawResponser.   s    r0   r1   AsyncFiles.with_raw_response  s     )..r3   c                    [        U 5      $ r5   )AsyncFilesWithStreamingResponser.   s    r0   r7   "AsyncFiles.with_streaming_response  s     /t44r3   Nr9   c                  #    U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        UUUS.[        R                  5      I Sh  vN [        XVXxS9[        S	9I Sh  vN $  N N7f)
rA   rB   rC   rD   rE   rF   rG   NrI   rJ   )rN   rO   r   r"   rP   r    r$   rQ   s	            r0   rS   AsyncFiles.create  s     R ]^m]pqrr&QM<ORQZZo.f5,&",):
 #33  )+Q[ $   
 
 	

s$   AA:A6
A:1A82A:8A:rI   c          
        #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        X4XVS9[        S9I S	h  vN $  N7f)
rV   rB   rW   rC   rD   rE   rX   rI   rY   NrZ   r\   s          r0   r]   AsyncFiles.retrieve  s     0 ]^m]pqrrUV]U`abb&QM<ORQYYo.ggY?(+Q[ $  
 
 	
 
   A"A+$A)%A+c               $  #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        SU0[        R                  5      I Sh  vN [        XEXgS	9[        S
9I Sh  vN $  N N7f)r`   rB   rW   rC   rD   rE   rX   r:   NrI   rJ   )rN   rO   r   r#   ra   r    r$   rb   s           r0   rc   AsyncFiles.update(  s     > ]^m]pqrrUV]U`abb&QM<ORQZZo.ggY?,lJ-GI[IlIlmm(+Q[ $   
 
 	
m
s$   A-B/B
0BBBBre   c       	            U(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU S3[        [           [	        UUU	U
[        UUUUUS.[        R                  5      S9[        S9$ rl   )rN   rq   r   r$   r    r   r!   rr   rs   s              r0   rt   AsyncFiles.listU  s    \ ]^m]pqrr&QM<ORQ!!o.f5 1(+'%%!&"("(!&!& %33	  "' " 
 	
r3   c          
        #    U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU 3[        X4XVS9[        S9I S	h  vN $  N7f)
rw   rB   rW   rC   rD   rE   rX   rI   rY   Nrx   r\   s          r0   rz   AsyncFiles.delete  s     8 ]^m]pqrrUV]U`abb&QM<ORQ\\o.ggY?(+Q[ + " 
 
 	
 
r   r|   c               t   #    U R                  X!US9I Sh  vN   U R                  UUUS9I Sh  vN $  N N7f)r   r   Nr   r   r   s        r0   r   AsyncFiles.create_and_poll  sM      kk/^okpppYY+-  
 
 	
 	q
s   848688r   c               >  #    SS0n[        U5      (       a  [        U5      US'    U R                  R                  UUUS9I Sh  vN nUR	                  5       nUR
                  S:X  aY  [        U5      (       d,  UR                  R                  S5      nUb  [        U5      nOSnU R                  US-  5      I Sh  vN   OUUR
                  S	:X  d   UR
                  S
:X  d  UR
                  S:X  a  U$ [        (       a  [        UR
                  5        OU$ M   N N^7f)r   r   r   r   r   Nr   r   r   r   r   r   r   r   s           r0   r   AsyncFiles.poll  s     $=f"E$%%:=>N:OG67!33<< /% =  H >>#D{{m+ 011"*"2"2"6"67M"NK".+.{+;(+/(kk"2T"9:::+t{{k/IT[[\dMd = -K/  ;s&   ADDA7D<D=ADDr   c                  #    U R                   R                  R                  USS9I Sh  vN nU R                  XR                  US9I Sh  vN $  N& N7f)r   r   r   Nr   r   r   s        r0   r   AsyncFiles.upload  sY      ++22l2SS[[+[[Te ! 
 
 	
 T
s!   (AA!AAAAc                  #    U R                   R                  R                  USS9I Sh  vN nU R                  UUR                  UUS9I Sh  vN $  N( N7f)r   r   r   N)rR   rH   r}   r;   r   r   s         r0   r   AsyncFiles.upload_and_poll  sa      ++22l2SS))+KK-/	 * 
 
 	
 T
s!   (AA#AAAAc                   U(       d  [        SU< 35      eU(       d  [        SU< 35      eSS0U=(       d    0 EnU R                  SU SU S3[        [           [	        X4XVS9[        S	9$ r   )rN   rq   r   r%   r    r\   s          r0   r   AsyncFiles.content!  s    0 ]^m]pqrrUV]U`abb&QM<ORQ!!o.ggYhG./(+Q[ & " 
 	
r3   r   )r   r   )r   r   r   r   r   )rR   r   rf   r   rg   r   rh   r   ri   r   rj   r   r<   r   r=   r   r>   r   r?   r   r   zAAsyncPaginator[VectorStoreFile, AsyncCursorPage[VectorStoreFile]]r   r   r   r   r   )rH   r   rR   r   r<   r   r=   r   r>   r   r?   r   r   zCAsyncPaginator[FileContentResponse, AsyncPage[FileContentResponse]]r   r   r3   r0   r(   r(     s   / / 5 5 OXBK )-$("&;D:
:
 	:

 L:
 @:
 &:
 ":
  :
 9:
 
:
F )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
Z )-$("&;D+
+
 	+

 A+
 &+
 "+
  +
 9+
 
+
b !*!*Xa )3< )-$("&;DE
E
 	E

 E
 VE
 E
 1E
 &E
 "E
  E
 9E
 
KE
\ )-$("&;D'
'
 	'
 &'
 "'
  '
 9'
 
 '
\ ,5BK

 	

 )
 @
 

, ,5' '  	' 
 )'  
' \ CL
 
 	

 @
 

, ,5BK
 
 	

 )
 @
 

0 )-$("&;D$
$
 	$
 &$
 "$
  $
 9$
 
M$
 $
r3   c                      \ rS rSrSS jrSrg)r-   iH  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g N)	_filesr   to_raw_response_wrapperrS   r]   rc   rt   rz   r   r/   r   s     r0   __init__FilesWithRawResponse.__init__I  s    &>>LL
 )@@NN
 '>>LL
 %<<JJ
	 '>>LL
 (??MM
r3   r   r   rS   rz   rt   r]   rc   Nr   r'   r   Noner   r   r   r   r   r   r   r3   r0   r-   r-   H      
r3   r-   c                      \ rS rSrSS jrSrg)r   i`  c                   Xl         [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR
                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        [        R                  " UR                  5      U l        g r   )	r   r   async_to_raw_response_wrapperrS   r]   rc   rt   rz   r   r   s     r0   r   "AsyncFilesWithRawResponse.__init__a  s    &DDLL
 )FFNN
 'DDLL
 %BBJJ
	 'DDLL
 (EEMM
r3   r   Nr   r(   r   r   r   r   r3   r0   r   r   `  r   r3   r   c                      \ rS rSrSS jrSrg)r6   ix  c                H   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )r   r   rS   r]   rc   rt   rz   r   r   s     r0   r   #FilesWithStreamingResponse.__init__y  s    2LL
 5NN
 3LL
 1JJ
	 3LL
 4MM
r3   r   Nr   r   r   r3   r0   r6   r6   x  r   r3   r6   c                      \ rS rSrSS jrSrg)r   i  c                H   Xl         [        UR                  5      U l        [        UR                  5      U l        [        UR                  5      U l        [        UR
                  5      U l        [        UR                  5      U l        [        UR                  5      U l        g r   )r   r   rS   r]   rc   rt   rz   r   r   s     r0   r   (AsyncFilesWithStreamingResponse.__init__  s    8LL
 ;NN
 9LL
 7JJ
	 9LL
 :MM
r3   r   Nr   r   r   r3   r0   r   r     r   r3   r   )<
__future__r   typingr   r   r   r   typing_extensionsr   r	   httpx r   typesr   _typesr   r   r   r   r   r   _utilsr   r   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   r   r   _base_clientr   r    types.vector_storesr!   r"   r#   "types.file_chunking_strategy_param%types.vector_stores.vector_store_filer$   )types.vector_stores.file_content_responser%   -types.vector_stores.vector_store_file_deletedr&   __all__r'   r(   r-   r   r6   r   r   r3   r0   <module>r     s    # 7 7 3    . J J 
 ' : Y N N @ [ [ K D L SL
!P
O P
fR
! R
j
 
0
 
0
 
0
 
r3   