
    i                     v   S r SSKrSSKrSSKrSSKrSSKJrJrJrJ	r	J
r
JrJrJ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JrJrJrJrJr  SSKJr  SSK J!r!  SS	K"J#r#  SS
K$J%r%J&r&  SSK'J(r(  SSK)J*r*  SSK+J,r,J-r-  SSK.J/r/J0r0J1r1  SSK2J3r3  SSK4J5r5  SSK6J7r7J8r8  SSK9r9\9Rt                  " \;5      r< " S S\(5      r=g)zr
Managed index.

A managed Index - where the index is accessible via some API that
interfaces a managed service.

    N)Any	AwaitableCallableListOptionalSequenceTypeDict)override)
quote_plus)ManagedIngestionStatusResponsePipelineCreatePipelineCreateEmbeddingConfigPipelineCreateTransformConfigPipelineTypeProjectCreateManagedIngestionStatusCloudDocumentCreateCloudDocumentPipelineFileCreateLlamaParseParameters)BaseQueryEngine)BaseRetriever)CallbackManager)DEFAULT_APP_URLDEFAULT_PROJECT_NAME)BaseManagedIndex)ApiError)get_aclient
get_client)BaseNodeDocumentTransformComponent)Settings)
RefDocInfo   )default_transform_configresolve_project_and_pipelinec            '          \ rS rSrSrSSSSS\SSSSSSSSSSS4S\\   S\\   S\\   S	\\   S
\\   S\S\\   S\\   S\\   S\\   S\S\\	R                     S\\	R                     S\S\\   S\\\      S\\\      S\SS4&S jjr\S\4S j5       rS\\   S\\/\4   S\S\S\S \SS4S! jrS\\   S\\/\\   4   S\S\S\S \SS4S" jr      SUS#\\\      S$\\\      S\S%\S\S \S\\   4S& jjr      SUS#\\\      S$\\\      S\S%\S\S \S\\   4S' jjr\\SSSSSSSSS4
S(\S    S\S\S\\   S\\   S\\   S\\   S\S\S)\\    S*\\!   S+\\"   S\SS 4S, jj5       r#\\SSSSSSSSS4
S(\S    S\S\S\\   S\\   S\\   S\\   S\S\S)\\    S*\\!   S+\\"   S\SS 4S- jj5       r$\\SSSSSSSSSS4S(\S    S.\\%   S\S\S\\   S\\   S\\   S\\   S\S\S\S)\\    S*\\!   S\\\      S\SS 4 S/ jj5       r&S\S\'4S0 jr(\)S\S\*4S1 j5       r+\SVS2\S\,\\-4   4S3 jj5       r. SWS4\%S\S5\SS4S6 jjr/ SWS4\%S\S5\SS4S7 jjr0 SWS4\%S\S8\SS4S9 jjr1 SWS4\%S\S8\SS4S: jjr2S.\\%   S8\S\\   4S; jr3S.\\%   S8\S\\   4S< jr4   SXS=\S>\S\S?\S@\SS4SA jjr5   SXS=\S>\S\S?\S@\SS4SB jjr6   SYSC\S\SD\S\S\4
SE jjr7   SYSC\S\SD\S\S\4
SF jjr8       SZSG\SH\SI\\   SJ\\,\\4      SK\SL\S\SD\S\S\4SM jjr9       SZSG\SH\SI\\   SJ\\,\\4      SK\SL\S\SD\S\S\4SN jjr:S\\   S5\SS4SO jr;\)S\\   SS4SP j5       r<S\\   S5\SS4SQ jr= SWSR\\   S>\S@\SS4SS jjr>STr?g)[LlamaCloudIndex6   a>  
A managed index that stores documents in LlamaCloud.

There are two main ways to use this index:

1. Connect to an existing LlamaCloud index:
    ```python
    # Connect using index ID (same as pipeline ID)
    index = LlamaCloudIndex(id="<index_id>")

    # Or connect using index name
    index = LlamaCloudIndex(
        name="my_index",
        project_name="my_project",
        organization_id="my_org_id"
    )
    ```

2. Create a new index with documents:
    ```python
    documents = [Document(...), Document(...)]
    index = LlamaCloudIndex.from_documents(
        documents,
        name="my_new_index",
        project_name="my_project",
        organization_id="my_org_id"
    )
    ```

The index supports standard operations like retrieval and querying
through the as_query_engine() and as_retriever() methods.
N<   Fnamepipeline_idindex_idid
project_idproject_nameorganization_idapi_keybase_urlapp_urltimeouthttpx_clientasync_httpx_clientshow_progresscallback_managernodestransformationskwargsreturnc                    [        [        U5      [        U5      [        U5      [        U5      /5      S:w  a  [        S5      eUb  [        S5      eUb  [        S5      eXl        Xl        [        UU	U
UUS9U l        [        UU	U
UUS9U l        Xpl	        U=(       d    U=(       d    Un[        U R                  XXeU5      u  U l        U l        U R                  R                  U l        U R                  R                  U l        Xl        Xl        Xl        Xl        Xl        U=(       d    [(        R*                  U l        g)zInitialize the Platform Index.r&   z`Exactly one of `name`, `id`, `pipeline_id` or `index_id` must be provided to identify the index.Nz8LlamaCloudIndex does not support nodes on initializationzSetting transformations is deprecated for LlamaCloudIndex, please use the `transform_config` and `embedding_config` parameters instead.)r4   r5   r6   r7   r8   )sumbool
ValueError_httpx_client_async_httpx_clientr    _clientr   _aclientr3   r(   projectpipeliner-   r2   _api_key	_base_url_app_url_timeout_show_progressr$   r;   _callback_manager)selfr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   s                      Y/home/james-whalen/.local/lib/python3.13/site-packages/llama_cloud_services/index/base.py__init__LlamaCloudIndex.__init__X   s7   6 R$x.${*;T$ZHIQNr  WXX& Z 
 *#5 !%
 $+
  /3H3&BLL$\'
#dm MM&&	 LL--!+!1!NX5N5N    c                 .    U R                   R                  $ )z#Return the pipeline (aka index) ID.)rI   r0   )rP   s    rQ   r0   LlamaCloudIndex.id   s     }}rT   resource_idsget_status_fnresource_nameverboseraise_on_errorsleep_intervalc                 J   U(       d  gU(       a!  [        SU [        U5      S:  a  SOS 35        [        U5      nU(       Ga  [        5       nU H  n	 U" U	5      n
U
R                  nU[        R
                  [        R                  4;   a  M>  U[        R                  :X  aJ  U(       a  [        UR                  5        SU	 35        U(       a  [        UR                  5        SU	 35      eUR                  U	5        U(       a   [        UR                  5        SU	 35        M  M     Xx-  nU(       a  [        R                   " U5        U(       a  GM  U(       a  [        S	5        gg! [        R                   a'  nUR                  R                  S;   a   SnAGML  e SnAff = f
u  
Poll `get_status_fn` until every id in `resource_ids` is finished.

Args:
    resource_ids: Iterable of resource ids to watch.
    get_status_fn: Callable that maps a resource id → ManagedIngestionStatus.
    resource_name: Text used in log / error messages: "file", "document", ….
    verbose: Print a progress bar.
    raise_on_error: Whether to raise on ManagedIngestionStatus.ERROR.
    sleep_interval: Seconds between polls (min 0.5 s to avoid rate-limits).

NzLoading r&   s z ingestion failed for z ingestion finished for i  i  i  i  i  Done!)printlensetstatusr   NOT_STARTEDIN_PROGRESSERROR
capitalizerC   addhttpxHTTPStatusErrorresponsestatus_codetimesleeprP   rW   rX   rY   rZ   r[   r\   pendingfinishedridstatus_responserf   es                rQ   _wait_for_resources#LlamaCloudIndex._wait_for_resources   s   * =/\1BQ1F#B)OP  -!$H&3C&8O,33F.::.::"  !!7!=!=="!#0#;#;#=">>TUXTY Z *",#0#;#;#=">>TUXTY Z#  LL%,779::RSVRWX + @ G

>*K gN 'N  ,, zz--1JJ	s%   8E'BE''F";FFF"c                 |  #    U(       d  gU(       a!  [        SU [        U5      S:  a  SOS 35        [        U5      nU(       Ga  [        5       nU H  n	 U" U	5      I Sh  vN n
U
R                  nU[        R
                  [        R                  4;   a  MF  U[        R                  :X  aJ  U(       a  [        UR                  5        SU	 35        U(       a  [        UR                  5        SU	 35      eUR                  U	5        U(       a   [        UR                  5        SU	 35        M  M     Xx-  nU(       a  [        R                   " U5      I Sh  vN   U(       a  GM  U(       a  [        S	5        gg GN! [        R                   a'  nUR                  R                  S;   a   SnAGM_  e SnAff = f Nc7fr^   )rc   rd   re   rf   r   rg   rh   ri   rj   rC   rk   rl   rm   rn   ro   asynciorq   rr   s                rQ   _await_for_resources$LlamaCloudIndex._await_for_resources   s    * =/\1BQ1F#B)OP  -!$H,9#,>&>O,33F.::.::"  !!7!=!=="!#0#;#;#=">>TUXTY Z *",#0#;#;#=">>TUXTY Z#  LL%,779::RSVRWX + @ GmmN333K gN 'N G '?0 ,, zz--1JJ	 4sg   AF<E<!E9"4E<F<BE<,*F<F:F<%F<9E<<F7F2*F<1F22F77F<file_idsdoc_idsraise_on_partial_successc           	        ^  U(       a  T R                  UU 4S jSUUUS9  U(       a  T R                  UU 4S jSUUUS9  U(       a"  [        ST R                  R                   35        Sn  T R                  R
                  R                  T R                  R                  S9nUR                  nU[        R                  :X  d  U(       aG  U[        R                   :X  a3  [#        S
T R                  R                   SUR%                  5        35      eU[        R&                  [        R(                  4;   a(  U(       a
  [        SSS9  [        R                  " U5        OU(       a  [        S5        U$ GM	  ! [        R                   a=  n	U	R                  R                  S	;   a  [        R                  " U5         Sn	A	GMU  e Sn	A	ff = f)  
Block until the requested ingestion work is finished.

- If `file_ids` is given → wait for those files.
- If `doc_ids` is given → wait for those documents.
- If neither is given → wait for the pipeline itself last so that retrieval works.
- Always waits for the pipeline itself last so that retrieval works.

Returns the final PipelineStatus response (or None if only waiting on
files / documents).
c                 t   > TR                   R                  R                  TR                  R                  U S9$ N)r.   file_id)rF   	pipelinesget_pipeline_file_statusrI   r0   fidrP   s    rQ   <lambda>5LlamaCloudIndex.wait_for_completion.<locals>.<lambda>P  s/    DLL22KK $ 0 0# L rT   filerY   rZ   r[   r\   c                    > TR                   R                  R                  TR                  R                  [        [        U 5      5      S9$ Nr.   document_id)rF   r   get_pipeline_document_statusrI   r0   r   didrP   s    rQ   r   r   ]  s9    DLL22OO $ 0 0 *:c? ; P rT   documentSyncing pipeline Nr.   ra   Pipeline ingestion failed for . Details: .r`   endrb   )rx   rc   rI   r0   rF   r   get_pipeline_statusrf   rl   rm   rn   ro   rp   rq   r   ri   PARTIAL_SUCCESSrC   jsonrg   rh   
rP   r~   r   rZ   r   r[   r\   rv   rf   rw   s
   `         rQ   wait_for_completion#LlamaCloudIndex.wait_for_completion8  s   * $$ %-- % 	 $$ )-- % 
 %dmm&6&6%789DH
"&,,"8"8"L"L $ 0 0 #M # )// /555(4DDD 4T]]5E5E4F G  / 4 4 679 
 &22&22  #2&

>*'N&&C  (( ::))-FFJJ~.s   -AE5 5G	0G GGc           	         ^ #    U(       a   T R                  UU 4S jSUUUS9I Sh  vN   U(       a   T R                  UU 4S jSUUUS9I Sh  vN   U(       a"  [        ST R                  R                   35        Sn  T R                  R
                  R                  T R                  R                  S9I Sh  vN nUR                  nU[        R                  :X  d  U(       aG  U[        R                   :X  a3  [#        S
T R                  R                   SUR%                  5        35      eU[        R&                  [        R(                  4;   a0  U(       a
  [        SSS9  [        R                  " U5      I Sh  vN   OU(       a  [        S5        U$ GM   GNq GNM N! [        R                   aF  n	U	R                  R                  S	;   a&  [        R                  " U5      I Sh  vN     Sn	A	GMv  e Sn	A	ff = f N7f)r   c                 t   > TR                   R                  R                  TR                  R                  U S9$ r   )rG   r   r   rI   r0   r   s    rQ   r   6LlamaCloudIndex.await_for_completion.<locals>.<lambda>  s/    DMM33LL $ 0 0# M rT   r   r   Nc                    > TR                   R                  R                  TR                  R                  [        [        U 5      5      S9$ r   )rG   r   r   rI   r0   r   r   s    rQ   r   r     s9    DMM33PP $ 0 0 *:c? ; Q rT   r   r   r   ra   r   r   r   r`   r   rb   )r|   rc   rI   r0   rG   r   r   rf   rl   rm   rn   ro   r{   rq   r   ri   r   rC   r   rg   rh   r   s
   `         rQ   await_for_completion$LlamaCloudIndex.await_for_completion  s    * ++ %-- , 	 	 	 ++ )-- , 
 
 
 %dmm&6&6%789DH
(,(?(?(S(S $ 0 0 )T ) # )// /555(4DDD 4T]]5E5E4F G  / 4 4 679 
 &22&22  #2&mmN333'N&&C =	
&# (( ::))-FF!--777, 4s|   #G>F&G>F0G>?:F 9F:F 
B0G>:G<;G>G>F G933G4&G)'G4,G>3G44G99G>clsembedding_configtransform_configllama_parse_parametersc           
         U=(       d$    [         R                  R                  S[        5      n[	        XEXg5      nUR
                  R                  U[        US9S9nUR                  c  [        SU 35      eU(       a%  [        SUR                   SUR                   35        [        U[        R                  U	U
=(       d
    [        5       U=(       d
    [!        5       S9nUR"                  R%                  UR                  US9nUR                  c  [        S	U 35      eU(       a%  [        S
UR                   SUR                   35        U " U4UR                  UR&                  UUUUS.UD6$ )&Create a new LlamaCloud managed index.LLAMA_CLOUD_APP_URLr-   r3   requestFailed to create/get project Created project  with name r-   pipeline_typer   r   r   r1   r   Failed to create/get pipeline Created pipeline r2   r3   r4   r5   r6   r7   )osenvirongetr   r    projectsupsert_projectr   r0   rC   rc   r-   r   r   MANAGEDr'   r   r   upsert_pipeliner3   )r   r-   r2   r3   r4   r5   r6   r7   rZ   r   r   r   r>   clientrH   pipeline_createrI   s                    rQ   create_indexLlamaCloudIndex.create_index  sc   $ SRZZ^^,A?SGw@ //00+]5U 1 
 ::<\NKLL$WZZLGLL>JK )&..--K1I1K#9#S=Q=S
 ##33zz? 4 
 ;;=dVDEE%hkk]+hmm_MN	
 #33	
 	
 		
rT   c           
        #    U=(       d$    [         R                  R                  S[        5      n[	        XEXg5      nUR
                  R                  U[        US9S9I Sh  vN nUR                  c  [        SU 35      eU(       a%  [        SUR                   SUR                   35        [        U[        R                  U	U
=(       d
    [        5       U=(       d
    [!        5       S9nUR"                  R%                  UR                  US	9I Sh  vN nUR                  c  [        S
U 35      eU(       a%  [        SUR                   SUR                   35        U " U4UR                  UR&                  UUUUS.UD6$  GN  Nr7f)r   r   r   r   Nr   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r0   rC   rc   r-   r   r   r   r'   r   r   r   r3   )r   r-   r2   r3   r4   r5   r6   r7   rZ   r   r   r   r>   aclientrH   r   rI   s                    rQ   acreate_indexLlamaCloudIndex.acreate_index   s|    $ SRZZ^^,A?SgB  ((77+]5U 8 
 
 ::<\NKLL$WZZLGLL>JK )&..--K1I1K#9#S=Q=S
 !**::zz? ; 
 
 ;;=dVDEE%hkk]+hmm_MN	
 #33	
 	
 		
3
"
s&   AF F !B/FFA0FF	documentsc                    U R                  UUUUUUUU	UUS9
nU=(       d$    [        R                  R                  S[        5      n[        XVXx5      nUR                  R                  UR                  R                  U Vs/ s HB  n[        UR                  UR                  UR                  UR                  UR                  S9PMD     snS9nU Vs/ s H  nUR                  PM     nnUR!                  UXS9  [#        SU SUR$                  R                   SUR                  R                   35        U$ s  snf s  snf )	z>Build a LlamaCloud managed index from a sequence of documents.)
r-   r2   r3   r4   r5   r6   r7   rZ   r   r   r   textmetadataexcluded_embed_metadata_keysexcluded_llm_metadata_keysr0   r.   r   r   rZ   r[   zFind your index at z	/project/z/deploy/)r   r   r   r   r   r    r   upsert_batch_pipeline_documentsrI   r0   r   r   r   r   r   id_r   rc   rH   )r   r   r-   r2   r3   r4   r5   r6   r7   rZ   r[   r   r   r=   r>   indexr   docupserted_documentsr   s                       rQ   from_documentsLlamaCloudIndex.from_documentsZ  sS   *   %+-- ! 
 SRZZ^^,A?SGw@ $--MM)) %	 %C $ \\141Q1Q/2/M/Mww %	 N 
 &88%7c366%78!!W 	" 	
 	!')EMM4D4D3EXennN_N_M`a	
 +	 9s    A	D8
D=c                 b   SSK Jn  UR                  SS5      nUR                  SS5      nUb  UnU" SU R                  R                  U R
                  R                  U R                  U R                  U R                  U R                  U R                  UU R                  U R                  S.
UD6$ )z*Return a Retriever for this managed index.r&   )LlamaCloudRetrieversimilarity_top_kNdense_similarity_top_k)
r1   r.   r4   r5   r6   r7   r3   r   r8   r9    )	retrieverr   poprH   r0   rI   rJ   rK   rL   rM   r3   rD   rE   )rP   r>   r   r   r   s        rQ   as_retrieverLlamaCloudIndex.as_retriever  s    	
 "::&8$?!',Dd!K'%5"" 
||((MM^^MMMM 00#9++#77
 
 	
rT   c                 \    SSK Jn  U R                  " S0 UD6US'   UR                  " S0 UD6$ )Nr   )RetrieverQueryEnginer   r   )4llama_index.core.query_engine.retriever_query_enginer   r   	from_args)rP   r>   r   s      rQ   as_query_engineLlamaCloudIndex.as_query_engine  s5    	
 #//9&9{#--777rT   
batch_sizec           	      .   U R                   R                  n/ nSnUn U R                  R                  R	                  UUUS9nU(       d  OUR                  U5        XE-  nMD  U Vs0 s H"  nUR                  [        UR                  / S9_M$     sn$ s  snf )zZRetrieve a dict mapping of ingested documents and their metadata. The nodes list is empty.r   )r.   skiplimit)r   node_ids)rI   r0   rF   r   list_pipeline_documentsextendr%   r   )rP   r   r.   pipeline_documentsr   r   batchr   s           rQ   ref_doc_infoLlamaCloudIndex.ref_doc_info  s     mm&&24LL**BB' C E
 %%e,MD  *
) FFJrBB)
 	
 
s   &)Br   insert_kwargsc                    U R                   R                  S5         U R                  R                  R	                  U R
                  R                  [        UR                  UR                  UR                  UR                  UR                  S9/S9nUS   nU R                  UR                  /USS9  SSS5        g! , (       d  f       g= f)Insert a document.insertr   r   r   Tr   N)rO   as_tracerF   r   create_batch_pipeline_documentsrI   r0   r   r   r   r   r   r   r   rP   r   rZ   r   r   upserted_documents         rQ   r   LlamaCloudIndex.insert       ##,,X6!%!7!7!W!W MM,,'%]]!)!2!25=5Z5Z3;3V3V#<< "X " !31 5$$*--.PT %  766   BB==
Cc                   #    U R                   R                  S5         U R                  R                  R	                  U R
                  R                  [        UR                  UR                  UR                  UR                  UR                  S9/S9I Sh  vN nUS   nU R                  UR                  /USS9I Sh  vN   SSS5        g N6 N! , (       d  f       g= f7f)r   r   r   r   Nr   Tr   )rO   r   rG   r   r   rI   r0   r   r   r   r   r   r   r   r   s         rQ   ainsertLlamaCloudIndex.ainsert        ##,,X6'+}}'>'>'^'^ MM,,'%]]!)!2!25=5Z5Z3;3V3V#<< (_ ( " !31 5++*--.PT ,    76" 76A   C$A:CC(CCC	C$CC
C!C$update_kwargsc                    U R                   R                  S5         U R                  R                  R	                  U R
                  R                  [        UR                  UR                  UR                  UR                  UR                  S9/S9nUS   nU R                  UR                  /USS9  SSS5        g! , (       d  f       g= f)/Upserts a document and its corresponding nodes.updater   r   r   Tr   N)rO   r   rF   r   r   rI   r0   r   r   r   r   r   r   r   rP   r   rZ   r  r   r   s         rQ   update_ref_docLlamaCloudIndex.update_ref_doc  r   r   c                   #    U R                   R                  S5         U R                  R                  R	                  U R
                  R                  [        UR                  UR                  UR                  UR                  UR                  S9/S9I Sh  vN nUS   nU R                  UR                  /USS9I Sh  vN   SSS5        g N6 N! , (       d  f       g= f7f)r  r  r   r   Nr   Tr   )rO   r   rG   r   r   rI   r0   r   r   r   r   r   r   r   r	  s         rQ   aupdate_ref_docLlamaCloudIndex.aupdate_ref_doc  r  r  c                    U R                   R                  S5         U R                  R                  R	                  U R
                  R                  U Vs/ s HB  n[        UR                  UR                  UR                  UR                  UR                  S9PMD     snS9nU Vs/ s H  o3R                  PM     nnU R                  USSS9  S/[        U5      -  sSSS5        $ s  snf s  snf ! , (       d  f       g= f)2Refresh an index with documents that have changed.refreshr   r   Tr   N)rO   r   rF   r   r   rI   r0   r   r   r   r   r   r   r   rd   rP   r   r  r   r   r   s         rQ   refresh_ref_docs LlamaCloudIndex.refresh_ref_docs)  s     ##,,Y7!%!7!7!W!W MM,,  )	  ) ( XX!$585U5U363Q3Q77  )	 "X " *<<);#vv);G<$$WdSW$X6CL(! 87	 = 87s*   9C1A	C'	C1'C,<!C1'
C11
C?c                 4  #    U R                   R                  S5         U R                  R                  R	                  U R
                  R                  U Vs/ s HB  n[        UR                  UR                  UR                  UR                  UR                  S9PMD     snS9I Sh  vN nU Vs/ s H  o3R                  PM     nnU R                  USSS9I Sh  vN   S/[        U5      -  sSSS5        $ s  snf  NUs  snf  N(! , (       d  f       g= f7f)r  r  r   r   NTr   )rO   r   rG   r   r   rI   r0   r   r   r   r   r   r   r   rd   r  s         rQ   arefresh_ref_docs!LlamaCloudIndex.arefresh_ref_docs?  s     ##,,Y7'+}}'>'>'^'^ MM,,  )	  ) ( XX!$585U5U363Q3Q77  )	 (_ ( " *<<);#vv);G<++d ,    6CL(% 87	" = 87sY   D9DA	C9 D(C>)D1D DDD/
D9D D
DD
ref_doc_iddelete_from_docstoreraise_if_not_founddelete_kwargsc                 J    U R                   R                  R                  U R                  R                  [        [        U5      5      S9  U R                  USS9  g! [         a;  nUR                  S:X  a%  U(       d  [        R                  SU S35         SnANPe SnAff = f)4Delete a document and its nodes by using ref_doc_id.r     ref_doc_id  not found, nothing deleted.NFrZ   r   )rF   r   delete_pipeline_documentrI   r0   r   r   ro   loggerwarningr   rP   r  r  rZ   r  r  rw   s          rQ   delete_ref_docLlamaCloudIndex.delete_ref_docW  s    
	LL"";; MM,,&z*'=> <  	  5 Q  	}}#,>ZL8TUVV		s   A
A 
B"'0BBB"c                 z  #     U R                   R                  R                  U R                  R                  [        [        U5      5      S9I Sh  vN   U R                  USS9I Sh  vN   g N! [         a;  nUR                  S:X  a%  U(       d  [        R                  SU S35         SnANZe SnAff = f NO7f)r  r   Nr  r  r   Fr!  )rG   r   r"  rI   r0   r   r   ro   r#  r$  r   r%  s          rQ   adelete_ref_docLlamaCloudIndex.adelete_ref_doco  s     
	--))BB MM,,&z*'=> C    ''RW'XXX  	}}#,>ZL8TUVV		 	YsS   B;AA1 A/A1 B;)B9*B;/A1 1
B6;0B1+B;0B11B66B;	file_pathwait_for_ingestionc                 
   [        US5       nU R                  R                  R                  U R                  R
                  US9nU(       a%  [        SUR
                   SUR                   35        SSS5        [        WR
                  S9nU R                  R                  R                  U R                  R
                  U/S9  U(       a  U R                  UR
                  /X$S9  UR
                  $ ! , (       d  f       N= f)	Upload a file to the index.rbr1   upload_fileUploaded file r   Nr   r   r~   rZ   r[   )openrF   filesr1  rH   r0   rc   r-   r   r   add_files_to_pipeline_apirI   r   rP   r+  rZ   r,  r[   fr   pipeline_file_creates           rQ   r1  LlamaCloudIndex.upload_file  s     )T"a<<%%11<<?? 2 D twwi{499+FG #  2$''B88((3G2H 	9 	
 $$''G %  ww# #"s   A%C44
Dc                 N  #    [        US5       nU R                  R                  R                  U R                  R
                  US9I Sh  vN nU(       a%  [        SUR
                   SUR                   35        SSS5        [        WR
                  S9nU R                  R                  R                  U R                  R
                  U/S9I Sh  vN   U(       a#  U R                  UR
                  /X$S9I Sh  vN   UR
                  $  N! , (       d  f       N= f NM N%7f)	r.  r/  r0  Nr2  r   r3  r   r4  )r5  rG   r6  r1  rH   r0   rc   r-   r   r   r7  rI   r   r8  s           rQ   aupload_fileLlamaCloudIndex.aupload_file  s     )T"a,,88<<?? 9  D twwi{499+FG #  2$''Bmm%%??((3G2H @ 
 	
 	
 ++''G ,    ww# #"	

sM   D%<DD0D<AD%D!)D%=D#>D%D
DD%#D%	file_nameurl	proxy_urlrequest_headers
verify_sslfollow_redirectsc
           
         U R                   R                  R                  U R                  R                  UUUUUUS9n
U(       a%  [        SU
R                   SU
R                   35        [        U
R                  S9nU R                   R                  R                  U R                  R                  U/S9  U(       a  U R                  U
R                  /XyS9  U
R                  $ )&Upload a file from a URL to the index.r1   r-   r@  rA  rB  rC  rD  r2  	 with ID r3  r   r4  )rF   r6  upload_file_from_urlrH   r0   rc   r   r   r7  rI   r   rP   r?  r@  rA  rB  rC  rD  rZ   r,  r[   r   r:  s               rQ   rI  $LlamaCloudIndex.upload_file_from_url  s     ||!!66||+!- 7 
 N477)9TWWI>?  2$''B88((3G2H 	9 	
 $$''G %  wwrT   c
           
        #    U R                   R                  R                  U R                  R                  UUUUUUS9I Sh  vN n
U(       a%  [        SU
R                   SU
R                   35        [        U
R                  S9nU R                   R                  R                  U R                  R                  U/S9I Sh  vN   U(       a#  U R                  U
R                  /XyS9I Sh  vN   U
R                  $  N N< N7f)rF  rG  Nr2  rH  r3  r   r4  )rG   r6  rI  rH   r0   rc   r   r   r7  rI   r   rJ  s               rQ   aupload_file_from_url%LlamaCloudIndex.aupload_file_from_url  s      ]]((==||+!- > 
 
 N477)9TWWI>?  2$''Bmm%%??((3G2H @ 
 	
 	
 ++''G ,    ww/
	

s7   ADC>A?DD )D-D.D DDc                     [        S5      e)z=Index-specific logic for inserting nodes to the index struct.z,_insert not implemented for LlamaCloudIndex.NotImplementedErrorrP   r<   r   s      rQ   _insertLlamaCloudIndex._insert  s    !"PQQrT   c                     [        S5      e)zBuild the index from nodes.z;build_index_from_nodes not implemented for LlamaCloudIndex.rP  )rP   r<   s     rQ   build_index_from_nodes&LlamaCloudIndex.build_index_from_nodes  s     "I
 	
rT   c                     [        S5      e)zInsert a set of nodes.z1insert_nodes not implemented for LlamaCloudIndex.rP  rR  s      rQ   insert_nodesLlamaCloudIndex.insert_nodes  s    !"UVVrT   r   c                     [        S5      e)zDelete a set of nodes.z1delete_nodes not implemented for LlamaCloudIndex.rP  )rP   r   r  r  s       rQ   delete_nodesLlamaCloudIndex.delete_nodes  s     ""UVVrT   )rG   rJ   rL   rE   rK   rO   rF   rD   rN   rM   r-   r3   rI   rH   r2   )NNFFFg      ?)d   )F)FFF)FTF)NNTTFTF)@__name__
__module____qualname____firstlineno____doc__r   r   strintrl   ClientAsyncClientrB   r   r   r!   r#   r   rR   propertyr0   r   r   r   floatrx   r   r|   r   r   classmethodr	   r   r   r   r   r   r"   r   r   r   r   r   r   r
   r%   r   r   r  r
  r  r  r  r&  r)  r1  r=  rI  rM  rS  rV  rY  r\  __static_attributes__r   rT   rQ   r*   r*   6   sn
   H #%)"& $(0)-!%"&!%/3:>#6:*.>B/IO smIO c]	IO
 3-IO SMIO SMIO IO "#IO #IO 3-IO #IO IO  u||,!IO" %U%6%67#IO& 'IO( #?3)IO, X'-IO. "$'9":;/IO0 1IO2 
3IOV  C    FsmF  'E EFF 	F
 F F F 
FPFsmF  y1O'P PQF 	F
 F F F 
FT -1+/).$ #U'8C=)U' (3-(U' 	U'
 #'U' U' U' 
0	1U'r -1+/).$ #U'8C=)U' (3-(U' 	U'
 #'U' U' U' 
0	1U'n  1)-!%"&!%DHDHAE7
#$7
7
 7
 "#	7

 #7
 3-7
 #7
 7
 7
 ##@A7
 ##@A7
 !))= >7
 7
 
7
 7
r  1)-!%"&!%DHDHAE7
#$7
7
 7
 "#	7

 #7
 3-7
 #7
 7
 7
 ##@A7
 ##@A7
 !))= >7
 7
 
7
 7
r 
 1)-!%"&!%$DHDH>B!<#$<>< < 	<
 "#< #< 3-< #< < < < ##@A< ##@A<  "$'9":;!<" #<$ 
%< <|
S 
] 
2 8 8 8 8 
s 
T#z/5J 
 
, 38 +/JM	. 38 +/JM	. 38 +/JM	. 38 +/JM	,)!(+)>A)	d),)!(+)>A)	d)6 &+#(RR #R 	R
 !R R 
R6 &+#(YY #Y 	Y
 !Y Y 
Y6 #'$  !	
  
< #'$  !	
  
@ $(48!%#'$## # C=	#
 "$sCx.1# # # # !# # 
#R $(48!%#'$$$ $ C=	$
 "$sCx.1$ $ $ $ !$ $ 
$PRXh/ R# R$ R 
HX,> 
4 
 
W(8"4 Ws Wt W &+Ws)W #W 	W
 
W WrT   r*   )>rc  r{   rl   r   rp   typingr   r   r   r   r   r   r	   r
   typing_extensionsr   urllib.parser   llama_cloudr   r   r   r   r   r   r   r   r   r   r   'llama_index.core.base.base_query_enginer   $llama_index.core.base.base_retrieverr   llama_index.core.callbacks.baser   llama_index.core.constantsr   r   %llama_index.core.indices.managed.baser   llama_cloud.core.api_errorr   $llama_index.core.ingestion.api_utilsr   r    llama_index.core.schemar!   r"   r#   llama_index.core.settingsr$   'llama_index.core.storage.docstore.typesr%   	api_utilsr'   r(   logging	getLoggerr_  r#  r*   r   rT   rQ   <module>r}     s      	  Q Q Q & #    D > ; L B / K J . > 			8	$kW& kWrT   