
    i                        S r SSKrSSKJ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  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-J.r.J/r/  SSK0J1r1  SSKJrJ2r2J
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.J/r/  SSK0J1r1  SSK3J4r4  SSK5J6r6J7r7J8r8  SSK9r9\9Rt                  " \;5      r<\" \8SSS9 " S S\&5      5       r=g)zr
Managed index.

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

    N)
deprecated)Any	AwaitableCallableListOptionalSequenceType)
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)r   Dictr   r   r	   r
   )
RefDocInfo)default_transform_configresolve_project_and_pipelineDEPRECATION_REASONz0.9.1once)reasonversionactionc            '          \ 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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r/ SWS4\%S\S8\SS4S9 jjr0 SWS4\%S\S8\SS4S: jjr1S.\\%   S8\S\\   4S; jr2S.\\%   S8\S\\   4S< jr3   SXS=\S>\S\S?\S@\SS4SA jjr4   SXS=\S>\S\S?\S@\SS4SB jjr5   SYSC\S\SD\S\S\4
SE jjr6   SYSC\S\SD\S\S\4
SF jjr7       SZSG\SH\SI\\   SJ\\+\\4      SK\SL\S\SD\S\S\4SM jjr8       SZSG\SH\SI\\   SJ\\+\\4      SK\SL\S\SD\S\S\4SN jjr9S\\   S5\SS4SO jr:S\\   SS4SP jr;S\\   S5\SS4SQ jr< SWSR\\   S>\S@\SS4SS jjr=STr>g)[LlamaCloudIndex@   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.   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.)r8   r9   r:   r;   r<   )sumbool
ValueError_httpx_client_async_httpx_clientr   _clientr   _aclientr7   r'   projectpipeliner1   r6   _api_key	_base_url_app_url_timeout_show_progressr#   r?   _callback_manager)selfr1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   s                      f/home/james-whalen/.local/lib/python3.13/site-packages/llama_index/indices/managed/llama_cloud/base.py__init__LlamaCloudIndex.__init__g   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.)rN   r4   )rU   s    rV   r4   LlamaCloudIndex.id   s     }}rY   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 rE   s z ingestion failed for z ingestion finished for i  i  i  i  i  Done!)printlensetstatusr   NOT_STARTEDIN_PROGRESSERROR
capitalizerH   addhttpxHTTPStatusErrorresponsestatus_codetimesleeprU   r\   r]   r^   r_   r`   ra   pendingfinishedridstatus_responserk   es                rV   _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rc   )rh   ri   rj   rk   r   rl   rm   rn   ro   rH   rp   rq   rr   rs   rt   asynciorv   rw   s                rV   _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)r2   file_id)rK   	pipelinesget_pipeline_file_statusrN   r4   fidrU   s    rV   <lambda>5LlamaCloudIndex.wait_for_completion.<locals>.<lambda>_  s/    DLL22KK $ 0 0# L rY   filer^   r_   r`   ra   c                    > TR                   R                  R                  TR                  R                  [        [        U 5      5      S9$ Nr2   document_id)rK   r   get_pipeline_document_statusrN   r4   r   didrU   s    rV   r   r   l  s9    DLL22OO $ 0 0 *:c? ; P rY   documentSyncing pipeline Nr2   rf   Pipeline ingestion failed for . Details: .re   endrg   )r}   rh   rN   r4   rK   r   get_pipeline_statusrk   rq   rr   rs   rt   ru   rv   r   rn   PARTIAL_SUCCESSrH   jsonrl   rm   
rU   r   r   r_   r   r`   ra   r{   rk   r|   s
   `         rV   wait_for_completion#LlamaCloudIndex.wait_for_completionG  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   )rL   r   r   rN   r4   r   s    rV   r   6LlamaCloudIndex.await_for_completion.<locals>.<lambda>  s/    DMM33LL $ 0 0# M rY   r   r   Nc                    > TR                   R                  R                  TR                  R                  [        [        U 5      5      S9$ r   )rL   r   r   rN   r4   r   r   s    rV   r   r     s9    DMM33PP $ 0 0 *:c? ; Q rY   r   r   r   rf   r   r   r   re   r   rg   )r   rh   rN   r4   rL   r   r   rk   rq   rr   rs   rt   r   rv   r   rn   r   rH   r   rl   rm   r   s
   `         rV   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r1   r7   requestFailed to create/get project Created project  with name r1   pipeline_typer   r   r   r5   r   Failed to create/get pipeline Created pipeline r6   r7   r8   r9   r:   r;   )osenvirongetr   r   projectsupsert_projectr   r4   rH   rh   r1   r   r   MANAGEDr&   r   r   upsert_pipeliner7   )r   r1   r6   r7   r8   r9   r:   r;   r_   r   r   r   rB   clientrM   pipeline_createrN   s                    rV   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	
 	
 		
rY   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   r4   rH   rh   r1   r   r   r   r&   r   r   r   r7   )r   r1   r6   r7   r8   r9   r:   r;   r_   r   r   r   rB   aclientrM   r   rN   s                    rV   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.)
r1   r6   r7   r8   r9   r:   r;   r_   r   r   r   textmetadataexcluded_embed_metadata_keysexcluded_llm_metadata_keysr4   r2   r   r   r_   r`   zFind your index at z	/project/z/deploy/)r   r   r   r   r   r   r   upsert_batch_pipeline_documentsrN   r4   r   r   r   r   r   id_r   rh   rM   )r   r   r1   r6   r7   r8   r9   r:   r;   r_   r`   r   r   rA   rB   indexr   docupserted_documentsr   s                       rV   from_documentsLlamaCloudIndex.from_documentsi  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)
r5   r2   r8   r9   r:   r;   r7   r   r<   r=    )1llama_index.indices.managed.llama_cloud.retrieverr   poprM   r4   rN   rO   rP   rQ   rR   r7   rI   rJ   )rU   rB   r   r   r   s        rV   as_retrieverLlamaCloudIndex.as_retriever  s    	
 "::&8$?!',Dd!K'%5"" 
||((MM^^MMMM 00#9++#77
 
 	
rY   c                 \    SSK Jn  U R                  " S0 UD6US'   UR                  " S0 UD6$ )Nr   )RetrieverQueryEngine	retrieverr   )4llama_index.core.query_engine.retriever_query_enginer   r   	from_args)rU   rB   r   s      rV   as_query_engineLlamaCloudIndex.as_query_engine  s5    	
 #//9&9{#--777rY   
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   )r2   skiplimit)r   node_ids)rN   r4   rK   r   list_pipeline_documentsextendr%   r   )rU   r   r2   pipeline_documentsr   r   batchr   s           rV   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)rT   as_tracerK   r   create_batch_pipeline_documentsrN   r4   r   r   r   r   r   r   r   rU   r   r_   r   r   upserted_documents         rV   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   )rT   r   rL   r   r   rN   r4   r   r   r   r   r   r   r   r  s         rV   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)rT   r   rK   r   r   rN   r4   r   r   r   r   r   r   r   rU   r   r_   r  r   r  s         rV   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   )rT   r   rL   r   r   rN   r4   r   r   r   r   r   r   r   r  s         rV   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)rT   r   rK   r   r   rN   r4   r   r   r   r   r   r   r   ri   rU   r   r  r   r   r   s         rV   refresh_ref_docs LlamaCloudIndex.refresh_ref_docs7  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   )rT   r   rL   r   r   rN   r4   r   r   r   r   r   r   r   ri   r  s         rV   arefresh_ref_docs!LlamaCloudIndex.arefresh_ref_docsM  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r_   r   )rK   r   delete_pipeline_documentrN   r4   r   r   rt   loggerwarningr   rU   r  r  r_   r   r!  r|   s          rV   delete_ref_docLlamaCloudIndex.delete_ref_doce  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'  )rL   r   r(  rN   r4   r   r   rt   r)  r*  r   r+  s          rV   adelete_ref_docLlamaCloudIndex.adelete_ref_doc}  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r5   upload_fileUploaded file r   Nr   r   r   r_   r`   )openrK   filesr7  rM   r4   rh   r1   r   r   add_files_to_pipeline_apirN   r   rU   r1  r_   r2  r`   fr   pipeline_file_creates           rV   r7  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)	r4  r5  r6  Nr8  r   r9  r   r:  )r;  rL   r<  r7  rM   r4   rh   r1   r   r   r=  rN   r   r>  s           rV   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.r5   r1   rF  rG  rH  rI  rJ  r8  	 with ID r9  r   r:  )rK   r<  upload_file_from_urlrM   r4   rh   r   r   r=  rN   r   rU   rE  rF  rG  rH  rI  rJ  r_   r2  r`   r   r@  s               rV   rO  $LlamaCloudIndex.upload_file_from_url  s     ||!!66||+!- 7 
 N477)9TWWI>?  2$''B88((3G2H 	9 	
 $$''G %  wwrY   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)rL  rM  Nr8  rN  r9  r   r:  )rL   r<  rO  rM   r4   rh   r   r   r=  rN   r   rP  s               rV   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rU   r@   r   s      rV   _insertLlamaCloudIndex._insert  s    !"PQQrY   c                     [        S5      e)zBuild the index from nodes.z;build_index_from_nodes not implemented for LlamaCloudIndex.rV  )rU   r@   s     rV   build_index_from_nodes&LlamaCloudIndex.build_index_from_nodes  s    !I
 	
rY   c                     [        S5      e)zInsert a set of nodes.z1insert_nodes not implemented for LlamaCloudIndex.rV  rX  s      rV   insert_nodesLlamaCloudIndex.insert_nodes#  s    !"UVVrY   r   c                     [        S5      e)zDelete a set of nodes.z1delete_nodes not implemented for LlamaCloudIndex.rV  )rU   r   r  r!  s       rV   delete_nodesLlamaCloudIndex.delete_nodes'  s     ""UVVrY   )rL   rO   rQ   rJ   rP   rT   rK   rI   rS   rR   r1   r7   rN   rM   r6   )NNFFFg      ?)d   )F)FFF)FTF)NNTTFTF)?__name__
__module____qualname____firstlineno____doc__r   r   strintrq   ClientAsyncClientrG   r   r   r    r"   r   rW   propertyr4   r	   r   r   floatr}   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/  r7  rC  rO  rS  rY  r\  r_  rb  __static_attributes__r   rY   rV   r.   r.   @   sP
   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 
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rY   r.   )>ri  r   r   rq   r   ru   typingr   r   r   r   r   r	   r
   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#   r$   'llama_index.core.storage.docstore.typesr%   1llama_index.indices.managed.llama_cloud.api_utilsr&   r'   r(   logging	getLoggerre  r)  r.   r   rY   rV   <module>r     s     !  	  K K K #    D > ; L B / K J . < < C > ; J J ? 
 			8	$ 
iW& iW
iWrY   