
    JiBj                    \   d dl Z d dlZd dlmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z; dd l<m=Z= dd!l>m?Z? dd"l@mAZA 	 d dlBZBeBj                  j                  d#      reEd dlFmGZB  e j                  e j                  d$      ZJ G d% d&      ZK G d' d(      ZLy# eE$ r d dlBZBY =w xY w))    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)jsonable_encoder)remove_none_from_dict)UnprocessableEntityError)ChatData)CloudDocument)CloudDocumentCreate)DataSinkCreate)HttpValidationError)InputMessage)LlamaParseParameters)ManagedIngestionStatusResponse)MetadataFilters)#PaginatedListCloudDocumentsResponse)Pipeline)PipelineCreate)PipelineMetadataConfig)PipelineType)PlaygroundSession)PresetRetrievalParams)RetrievalMode)RetrieveResults)SparseModelConfig)TextNode   )SListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy)ePaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy)PipelineUpdateEmbeddingConfig)PipelineUpdateTransformConfig)0RetrievalParamsSearchFiltersInferenceSchemaValuez1..c            '       	   e Zd ZdefdZdddddddej                  e   dej                  e   dej                  e   dej                  e   d	ej                  e   d
ej                  e
   fdZddddej                  e   d	ej                  e   ded
e
fdZddddej                  e   d	ej                  e   ded
e
fdZded
e
fdZeeeeeeeeeeeeddedej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   d
e
fdZded
dfd Zeeed!ded"ej                  e   d#ej                  e   d$ej                  ej                  e      d
ej8                  f
d%Zded
e
fd&Zddddddd'ded(ej                  e   d)ej                  e   d*ej                  e   d+ej                  e    d,ej                  e    d-ej                  e!   d
ej                  e"   fd.Z#dedej                  e$   d
ej                  e"   fd/Z%dedej                  e$   d
ej                  e"   fd0Z&ddd1ded2ej                  e   d3ej                  e    d
dfd4Z'ddddddd'ded(ej                  e   d)ej                  e   d*ej                  e   d+ej                  e    d,ej                  e    d-ej                  e(   d
e)fd5Z*d6eded
e"fd7Z+d6eded
dfd8Z,d6eded
ej                  e-   fd9Z.d6eded
e/fd:Z0d6eded
ej8                  fd;Z1ded
dfd<Z2ded
e3fd=Z4ddeeeeeeeeeeeeeed>dedej                  e   d	ej                  e   d?ej                  e5   d"ej                  e   d@ej                  e5   dAej                  e   dBej                  e    dCej                  e   dDedEej                  e   dFej                  e6   dGej                  e    dHej                  e    dIej                  e    dJej                  e7   dKej                  ejp                  eej                  e9   f      dLej                  e   d
e:f&dMZ;ddNdedOej                  e    d
e/fdPZ<ded
e
fdQZ=ded
e
fdRZ>y)SPipelinesClientclient_wrapperc                    || _         y N_client_wrapperselfr'   s     x/var/www/html/BankruptcyAI-uat/bankruptcy-ai/venv/lib/python3.12/site-packages/llama_cloud/resources/pipelines/client.py__init__zPipelinesClient.__init__9   
    -    N
project_idproject_namepipeline_namepipeline_typeorganization_idr3   r4   r5   r6   r7   returnc                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |||||d      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  t        j                  t           |j                               S |j                  d	k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |
      # t$        $ r" t'        |j                  |j(                  
      w xY w)aw  
        Search for pipelines by various parameters.

        Parameters:
            - project_id: typing.Optional[str].

            - project_name: typing.Optional[str].

            - pipeline_name: typing.Optional[str].

            - pipeline_type: typing.Optional[PipelineType].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud import PipelineType
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.search_pipelines(
            pipeline_type=PipelineType.PLAYGROUND,
        )
        GET/api/v1/pipelinesr2   <   paramsheaderstimeout   ,    status_codebodyr+   httpx_clientrequesturllibparseurljoinget_base_urlr	   get_headersrF   pydanticparse_obj_astypingListr   jsonr
   r   r   r   textr-   r3   r4   r5   r6   r7   	_response_response_jsons           r.   search_pipelinesz PipelinesClient.search_pipelines<   sB   B ((55==LL  D$8$8$E$E$G#H!JL^_(",$0%2%2'6 ((446 > 
	 )''-#-((X)>	@PQQ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   E +E/r3   r7   rJ   c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      t        |      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |
      # t"        $ r" t%        |j                  |j&                  
      w xY w)
        Create a new pipeline for a project.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - request: PipelineCreate.
        POSTr;   r<   rZ   r=   r?   rT   r@   rA   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   r	   r   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r-   r3   r7   rJ   rW   rX   s         r.   create_pipelinezPipelinesClient.create_pipelinev   s0   " ((55==LL  D$8$8$E$E$G#H!JL^_(
Wf)gh!'*((446 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   D: :+E%c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      t        |      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |
      # t"        $ r" t%        |j                  |j&                  
      w xY w)H  
        Upsert a pipeline for a project.
        Updates if a pipeline with the same name and project_id already exists. Otherwise, creates a new pipeline.

        Parameters:
            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - request: PipelineCreate.
        PUTr;   r<   rZ   r=   r^   rB   rC   rD   rE   r_   r`   s         r.   upsert_pipelinezPipelinesClient.upsert_pipeline   s0   $ ((55==LL  D$8$8$E$E$G#H!JL^_(
Wf)gh!'*((446 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Srb   pipeline_idc                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |	      # t        $ r" t!        |j                  |j"                  	      w xY w)
p
        Get a pipeline by ID for a given project.

        Parameters:
            - pipeline_id: str.
        r:   r;   api/v1/pipelines/r=   r@   rA   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r-   rg   rW   rX   s       r.   get_pipelinezPipelinesClient.get_pipeline   s#    ((55==LL  D$8$8$E$E$G#H!JN_`k_lLmn((446	 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   ?D& &+E	data_sinkdata_sink_idembedding_configembedding_model_config_idllama_parse_parametersmanaged_pipeline_idmetadata_confignamepreset_retrieval_parameterssparse_model_configstatustransform_configrp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   c                   i }|t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |	t         ur|	|d<   |
t         ur|
|d	<   |t         ur||d
<   |t         ur||d<   |t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd|       t        |      | j                  j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)  
        Update an existing pipeline for a project.

        Parameters:
            - pipeline_id: str.

            - data_sink: typing.Optional[DataSinkCreate].

            - data_sink_id: typing.Optional[str].

            - embedding_config: typing.Optional[PipelineUpdateEmbeddingConfig].

            - embedding_model_config_id: typing.Optional[str].

            - llama_parse_parameters: typing.Optional[LlamaParseParameters].

            - managed_pipeline_id: typing.Optional[str].

            - metadata_config: typing.Optional[PipelineMetadataConfig].

            - name: typing.Optional[str].

            - preset_retrieval_parameters: typing.Optional[PresetRetrievalParams].

            - sparse_model_config: typing.Optional[SparseModelConfig].

            - status: typing.Optional[str].

            - transform_config: typing.Optional[PipelineUpdateTransformConfig]. Configuration for the transformation.
        rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   re   r;   rj   r=   rT   r@   rA   rB   rC   rD   rE   OMITr+   rI   rJ   rK   rL   rM   rN   r   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r-   rg   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   _requestrW   rX   s                    r.   update_existing_pipelinez(PipelinesClient.update_existing_pipeline   s   ^ 24D $-H[!t#'3H^$4'+;H'($D04MH01!-1GH-.d*.AH*+$&*9H&'t#HV&d26QH23d*.AH*+!'HX4'+;H'(((55==LL  D$8$8$E$E$G#H!JN_`k_lLmn!(+((446 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   'G +G9c                 V   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d      }d|j                  cxk  rdk  ry |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |
      # t        $ r" t        |j                  |j                   
      w xY w)a;  
        Delete a pipeline by ID.

        Parameters:
            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.delete_pipeline(
            pipeline_id="string",
        )
        DELETEr;   rj   r=   rk   rB   rC   NrD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   r
   rP   rQ   r   rT   r   r   rU   rm   s       r.   delete_pipelinezPipelinesClient.delete_pipeline-  s     ((55==LL  D$8$8$E$E$G#H!JN_`k_lLmn((446	 > 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   C= =+D(
class_namedatamessagesr   r   r   c          	      $   i }|t         ur||d<   |t         ur||d<   |t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd| d      t        |      | j                  j                         d	      }d
|j                  cxk  rdk  r5n n2t        j                  t        j                  |j                               S |j                  dk(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      # t$        $ r" t'        |j                  |j(                        w xY w)a  
        Make a retrieval query + chat completion for a managed pipeline.

        Parameters:
            - pipeline_id: str.

            - class_name: typing.Optional[str].

            - data: typing.Optional[ChatData].

            - messages: typing.Optional[typing.List[InputMessage]].
        ---
        from llama_cloud import (
            ChatData,
            FilterCondition,
            LlmParameters,
            MetadataFilters,
            PresetRetrievalParams,
            RetrievalMode,
            SupportedLlmModelNames,
        )
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.chat(
            pipeline_id="string",
            data=ChatData(
                llm_parameters=LlmParameters(
                    model_name=SupportedLlmModelNames.GPT_4_O,
                ),
                retrieval_parameters=PresetRetrievalParams(
                    retrieval_mode=RetrievalMode.CHUNKS,
                    search_filters=MetadataFilters(
                        condition=FilterCondition.AND,
                        filters=[],
                    ),
                ),
            ),
        )
        r   r   r   r]   r;   rj   /chatr=   r~   rB   rC   rD   rE   r   r+   rI   rJ   rK   rL   rM   rN   r   rO   rF   rP   rQ   rR   AnyrT   r
   r   r   r   rU   r-   rg   r   r   r   r   rW   rX   s           r.   chatzPipelinesClient.chatM  sn   d 24T!%/H\"t#HV4#+HZ ((55==LL  D$8$8$E$E$G#H!JN_`k_llqLrs!(+((446 > 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   =E$ $+Fc           	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      # t        $ r" t!        |j                  |j"                  
      w xY w)]
        Copy a pipeline by ID.

        Parameters:
            - pipeline_id: str.
        r]   r;   rj   /copyr=   rk   rB   rC   rD   rE   rl   rm   s       r.   copy_pipelinezPipelinesClient.copy_pipeline  &    ((55==LL  D$8$8$E$E$G#H!JN_`k_llqLrs((446	 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S    D' '+Eskiplimitfile_idonly_direct_uploadonly_api_data_source_documentsstatus_refresh_policyr   r   r   r   r   r   c                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||||||d      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t!        t        j                  t"        |j                                     	 |j                         }	t'        |j                  |	      # t$        $ r" t'        |j                  |j(                        w xY w)a  
        Return a list of documents for a pipeline.

        Parameters:
            - pipeline_id: str.

            - skip: typing.Optional[int].

            - limit: typing.Optional[int].

            - file_id: typing.Optional[str].

            - only_direct_upload: typing.Optional[bool].

            - only_api_data_source_documents: typing.Optional[bool].

            - status_refresh_policy: typing.Optional[ListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy].
        ---
        from llama_cloud import (
            ListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy,
        )
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.list_pipeline_documents(
            pipeline_id="string",
            status_refresh_policy=ListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy.CACHED,
        )
        r:   r;   rj   
/documentsr   r=   r>   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   r	   rO   rF   rP   rQ   rR   rS   r   rT   r
   r   r   r   rU   
r-   rg   r   r   r   r   r   r   rW   rX   s
             r.   list_pipeline_documentsz'PipelinesClient.list_pipeline_documents  sT   X ((55==LL  ''4467q9=N{m[e;f ) "&*<6T-B	 ((446! > 
	$ )''-#-((])CY^^EUVV  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   "E	 	+E4c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  t        j                  t           |j                               S |j                  d	k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |
      # t$        $ r" t'        |j                  |j(                  
      w xY w)a  
        Batch create documents for a pipeline.

        Parameters:
            - pipeline_id: str.

            - request: typing.List[CloudDocumentCreate].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.create_batch_pipeline_documents(
            pipeline_id="string",
            request=[],
        )
        r]   r;   rj   r   r=   r~   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   r   rO   rF   rP   rQ   rR   rS   r   rT   r
   r   r   r   rU   r-   rg   rJ   rW   rX   s        r.   create_batch_pipeline_documentsz/PipelinesClient.create_batch_pipeline_documents  s:   * ((55==LL  ''4467q9=N{m[e;f "'*((446 > 
	 )''-#-((])CY^^EUVV  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   E +E-c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |      | j                   j                         d      }d|j                  cxk  rdk  r<n n9t        j                  t        j                  t           |j                               S |j                  d	k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |
      # t$        $ r" t'        |j                  |j(                  
      w xY w)a  
        Batch create or update a document for a pipeline.

        Parameters:
            - pipeline_id: str.

            - request: typing.List[CloudDocumentCreate].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.upsert_batch_pipeline_documents(
            pipeline_id="string",
            request=[],
        )
        re   r;   rj   r   r=   r~   rB   rC   rD   rE   r   r   s        r.   upsert_batch_pipeline_documentsz/PipelinesClient.upsert_batch_pipeline_documents  s:   * ((55==LL  ''4467q9=N{m[e;f "'*((446 > 
	 )''-#-((])CY^^EUVV  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Sr   
batch_sizeonly_failedr   r   c          	      r   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||d      | j                   j                         d      }d|j                  cxk  rd	k  ry
 |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      # t        $ r" t!        |j                  |j"                        w xY w)a  
        Force sync all documents in a pipeline by batching document ingestion jobs.

        - Iterates all document refs for the pipeline
        - Enqueues document ingestion jobs in batches of `batch_size`

        Parameters:
            - pipeline_id: str.

            - batch_size: typing.Optional[int].

            - only_failed: typing.Optional[bool]. Only sync retriable documents (failed/cancelled/not-started/stalled-in-progress)
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.force_sync_all_pipeline_documents(
            pipeline_id="string",
        )
        r]   r;   rj   /documents/force-sync-allr   r=   r>   rB   rC   NrD   rE   r+   rI   rJ   rK   rL   rM   rN   r	   rO   rF   r
   rP   rQ   r   rT   r   r   rU   r-   rg   r   r   rW   rX   s         r.   !force_sync_all_pipeline_documentsz1PipelinesClient.force_sync_all_pipeline_documentsF  s%   2 ((55==LL  ''4467q9=N{m[t;u )
S^)_`((446 > 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   $D +D6c                   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||||||d      | j                   j                         d      }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }	t#        |j                  |	      # t         $ r" t#        |j                  |j$                        w xY w)a1  
        Return a list of documents for a pipeline.

        Parameters:
            - pipeline_id: str.

            - skip: typing.Optional[int].

            - limit: typing.Optional[int].

            - file_id: typing.Optional[str].

            - only_direct_upload: typing.Optional[bool].

            - only_api_data_source_documents: typing.Optional[bool].

            - status_refresh_policy: typing.Optional[PaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy].
        ---
        from llama_cloud import (
            PaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy,
        )
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.paginated_list_pipeline_documents(
            pipeline_id="string",
            status_refresh_policy=PaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy.CACHED,
        )
        r:   r;   rj   /documents/paginatedr   r=   r>   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   r	   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r   s
             r.   !paginated_list_pipeline_documentsz1PipelinesClient.paginated_list_pipeline_documentsr  sL   X ((55==LL  ''4467q9=N{m[o;p ) "&*<6T-B	 ((446! > 
	$ )''-#-(()LinnN^__  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D8 8+E#document_idc           
         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      # t        $ r" t!        |j                  |j"                  
      w xY w)a  
        Return a single document for a pipeline.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.get_pipeline_document(
            document_id="string",
            pipeline_id="string",
        )
        r:   r;   rj   /documents/r=   rk   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r-   r   rg   rW   rX   s        r.   get_pipeline_documentz%PipelinesClient.get_pipeline_document  s/   & ((55==LL  ''4467q9=N{m[fgrfs;t ((446 > 
	 )''-#-((	8HII  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D) )+Ec           
      \   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       | j                   j                         d      }d|j                  cxk  rdk  ry	 |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |      # t        $ r" t        |j                  |j                         w xY w)a?  
        Delete a document from a pipeline.
        Initiates an async job that will:

        1. Delete vectors from the vector store
        2. Delete the document from MongoDB after vectors are successfully deleted

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.delete_pipeline_document(
            document_id="string",
            pipeline_id="string",
        )
        r   r;   rj   r   r=   rk   rB   rC   NrD   rE   r   r   s        r.   delete_pipeline_documentz(PipelinesClient.delete_pipeline_document  s   . ((55==LL  ''4467q9=N{m[fgrfs;t ((446 > 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D   +D+c                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d      }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      # t"        $ r" t%        |j                  |j&                        w xY w)a  
        Return a list of chunks for a pipeline document.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.list_pipeline_document_chunks(
            document_id="string",
            pipeline_id="string",
        )
        r:   r;   rj   r   /chunksr=   rk   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   rP   rQ   rR   rS   r   rT   r
   r   r   r   rU   r   s        r.   list_pipeline_document_chunksz-PipelinesClient.list_pipeline_document_chunks  s7   & ((55==LL  ''4467q9#K=K=P ((446 > 
	 )''-#-((X)>	@PQQ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D; ;+E&c                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d      }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      # t        $ r" t!        |j                  |j"                        w xY w)a  
        Return a single document for a pipeline.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.get_pipeline_document_status(
            document_id="string",
            pipeline_id="string",
        )
        r:   r;   rj   r   /statusr=   rk   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r   s        r.   get_pipeline_document_statusz,PipelinesClient.get_pipeline_document_status.  s/   & ((55==LL  ''4467q9#K=K=P ((446 > 
	 )''-#-(()GIYZZ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D* *+Ec                    | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d      }d|j                  cxk  rd	k  r5n n2t        j                  t        j                  |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      # t         $ r" t#        |j                  |j$                        w xY w)a  
        Sync a specific document for a pipeline.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.sync_pipeline_document(
            document_id="string",
            pipeline_id="string",
        )
        r]   r;   rj   r   /syncr=   rk   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   rP   rQ   rR   r   rT   r
   r   r   r   rU   r   s        r.   sync_pipeline_documentz&PipelinesClient.sync_pipeline_documentT  s2   & ((55==LL  ''4467q9#K=K=N ((446 > 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D4 4+Ec           	      X   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  ry	 |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |      # t        $ r" t        |j                  |j                         w xY w)a  
        Parameters:
            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.force_delete_pipeline(
            pipeline_id="string",
        )
        r]   r;   rj   /force-deleter=   rk   rB   rC   NrD   rE   r   rm   s       r.   force_delete_pipelinez%PipelinesClient.force_delete_pipelinez  s    ((55==LL  ''4467q9=N{m[h;i ((446 > 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   C> >+D)c           	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      # t        $ r" t!        |j                  |j"                  
      w xY w)a[  
        Get a playground session for a user and pipeline.

        Parameters:
            - pipeline_id: str.
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.get_playground_session(
            pipeline_id="string",
        )
        r:   r;   rj   /playground-sessionr=   rk   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   rm   s       r.   get_playground_sessionz&PipelinesClient.get_playground_session  s*     ((55==LL  ''4467q9=N{m[n;o ((446 > 
	 )''-#-(():INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Sr   r3   r7   alphar   dense_similarity_cutoffdense_similarity_top_kenable_rerankingfiles_top_krerank_top_nretrieval_moderetrieve_image_nodesretrieve_page_figure_nodesretrieve_page_screenshot_nodessearch_filterssearch_filters_inference_schemasparse_similarity_top_kr   r   r   r   r   queryr   r   r   r   r   r   r   r   c          	      L   d|
i}|t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |	t         ur|	|d<   |t         ur||d<   |t         ur||d	<   |t         ur||d
<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd| d      t        ||d      t        |      | j                  j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      # t$        $ r" t'        |j                  |j(                        w xY w)a@  
        Get retrieval results for a managed pipeline and a query

        Parameters:
            - pipeline_id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - alpha: typing.Optional[float].

            - class_name: typing.Optional[str].

            - dense_similarity_cutoff: typing.Optional[float].

            - dense_similarity_top_k: typing.Optional[int].

            - enable_reranking: typing.Optional[bool].

            - files_top_k: typing.Optional[int].

            - query: str. The query to retrieve against.

            - rerank_top_n: typing.Optional[int].

            - retrieval_mode: typing.Optional[RetrievalMode]. The retrieval mode for the query.

            - retrieve_image_nodes: typing.Optional[bool]. Whether to retrieve image nodes.

            - retrieve_page_figure_nodes: typing.Optional[bool]. Whether to retrieve page figure nodes.

            - retrieve_page_screenshot_nodes: typing.Optional[bool]. Whether to retrieve page screenshot nodes.

            - search_filters: typing.Optional[MetadataFilters].

            - search_filters_inference_schema: typing.Optional[typing.Dict[str, typing.Optional[RetrievalParamsSearchFiltersInferenceSchemaValue]]].

            - sparse_similarity_top_k: typing.Optional[int].
        ---
        from llama_cloud import FilterCondition, MetadataFilters, RetrievalMode
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.run_search(
            pipeline_id="string",
            query="string",
            retrieval_mode=RetrievalMode.CHUNKS,
            search_filters=MetadataFilters(
                condition=FilterCondition.AND,
                filters=[],
            ),
        )
        r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r]   r;   rj   	/retrieverZ   r=   r^   rB   rC   rD   rE   r   r+   rI   rJ   rK   rL   rM   rN   r	   r   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r-   rg   r3   r7   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rW   rX   s                         r.   
run_searchzPipelinesClient.run_search  sM   ` 3:51A %HWT!%/H\""$.2IH./!-1GH-.4'+;H'(d"&1H]#t#'3H^$%)7H%&t+/CH+,%T15OH12)59WH56%)7H%&*$6:YH67"$.2IH./((55==LL  D$8$8$E$E$G#H!JN_`k_lluLvw(
Wf)gh!(+((446 > 
	 )''-#-(()..:JKK  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   G8 8+H#full_detailsr   c          	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        d|i      | j                   j                         d      }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      # t         $ r" t#        |j                  |j$                        w xY w)a~  
        Get the status of a pipeline by ID.

        Parameters:
            - pipeline_id: str.

            - full_details: typing.Optional[bool].
        ---
        from llama_cloud.client import LlamaCloud

        client = LlamaCloud(
            token="YOUR_TOKEN",
        )
        client.pipelines.get_pipeline_status(
            pipeline_id="string",
        )
        r:   r;   rj   r   r   r=   r>   rB   rC   rD   rE   r+   rI   rJ   rK   rL   rM   rN   r	   rO   rF   rP   rQ   r   rT   r
   r   r   r   rU   r-   rg   r   rW   rX   s        r.   get_pipeline_statusz#PipelinesClient.get_pipeline_status;  s4   ( ((55==LL  D$8$8$E$E$G#H!JN_`k_llsLtu(.,)GH((446 > 
	 )''-#-(()GIYZZ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D3 3+Ec           	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      # t        $ r" t!        |j                  |j"                  
      w xY w)
        Run ingestion for the pipeline by incrementally updating the data-sink with upstream changes from data-sources & files.

        Parameters:
            - pipeline_id: str.
        r]   r;   rj   r   r=   rk   rB   rC   rD   rE   rl   rm   s       r.   sync_pipelinezPipelinesClient.sync_pipeline`  r   r   c           	         | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d      }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      # t        $ r" t!        |j                  |j"                  
      w xY w)=
        Parameters:
            - pipeline_id: str.
        r]   r;   rj   /sync/cancelr=   rk   rB   rC   rD   rE   rl   rm   s       r.   cancel_pipeline_syncz$PipelinesClient.cancel_pipeline_syncw  s)   
 ((55==LL  ''4467q9=N{m[g;h ((446 > 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Sr   )?__name__
__module____qualname__r   r/   rR   Optionalstrr   rS   r   rY   r   ra   rf   rn   r   r   r"   r   r   r   r   r#   r   r   r   r   r   r   r   intboolr    r   r   r   r   r   r   r!   r   r   r   r   r   r   r   r   r   r   r   r   floatr   r   Dictr$   r   r   r   r   r    r1   r.   r&   r&   8   sa   .*; . ,0-1.27;048O OOC(8O ooc*	8O
 s+8O |48O  -8O 
X	8Oz ,004	!O OOC(!O  -	!O
  !O 
!OL ,004	"O OOC("O  -	"O
  "O 
"OHO O O6 6:-1KO:>HL48CG%)NRBF'+KOWOWO ??>2	WO
 ooc*WO !//*GHWO $*??3#7WO !'0D EWO $__S1WO  )?@WO ooc"WO &,__5J%KWO $__->?WO $WO !//*GHWO  
!WOrO3 O4 OH ,0*.?CHOHO OOC(	HO
 ooh'HO //&++l";<HO 
HOTO O O6 &*&*(,48@D FOFO ooc"	FO
 s#FO %FO #OOD1FO )/(=FO  &_ 
FO 
]	#FOP&O&O,2KK8K,L&O	]	#&OP&O&O,2KK8K,L&O	]	#&OR GKqu*O*O/5s/C*OY_YhYhimYn*O	*O` &*&*(,48@D FOFO ooc"	FO
 s#FO %FO #OOD1FO )/(=FO  &q 
FO 
-FOP#O #O3 #O= #OJ'OC 'Oc 'Od 'OR$O $O3 $OSYS^S^_gSh $OL$O $O# $ORp $OL$O# $OC $OFJJ $OLO O O@ O#  O:K  OL ,004(,+/:>7;26,0-19=6:<@@D;? 8<-}O}O OOC(	}O
  -}O u%}O OOC(}O "(!7}O !' 4}O !//$/}O __S)}O }O ooc*}O 6}O %ood3}O  %+OOD$9!}O" )/(=#}O$ 8%}O& *0KKV__-]^^_*
'}O, "(!5-}O. 
/}O@ JN#O#O171F#O	'#OJO O O.O O Or1   r&   c            '       	   e Zd ZdefdZdddddddej                  e   dej                  e   dej                  e   dej                  e   d	ej                  e   d
ej                  e
   fdZddddej                  e   d	ej                  e   ded
e
fdZddddej                  e   d	ej                  e   ded
e
fdZded
e
fdZeeeeeeeeeeeeddedej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   dej                  e   d
e
fdZded
dfd Zeeed!ded"ej                  e   d#ej                  e   d$ej                  ej                  e      d
ej8                  f
d%Zded
e
fd&Zddddddd'ded(ej                  e   d)ej                  e   d*ej                  e   d+ej                  e    d,ej                  e    d-ej                  e!   d
ej                  e"   fd.Z#dedej                  e$   d
ej                  e"   fd/Z%dedej                  e$   d
ej                  e"   fd0Z&ddd1ded2ej                  e   d3ej                  e    d
dfd4Z'ddddddd'ded(ej                  e   d)ej                  e   d*ej                  e   d+ej                  e    d,ej                  e    d-ej                  e(   d
e)fd5Z*d6eded
e"fd7Z+d6eded
dfd8Z,d6eded
ej                  e-   fd9Z.d6eded
e/fd:Z0d6eded
ej8                  fd;Z1ded
dfd<Z2ded
e3fd=Z4ddeeeeeeeeeeeeeed>dedej                  e   d	ej                  e   d?ej                  e5   d"ej                  e   d@ej                  e5   dAej                  e   dBej                  e    dCej                  e   dDedEej                  e   dFej                  e6   dGej                  e    dHej                  e    dIej                  e    dJej                  e7   dKej                  ejp                  eej                  e9   f      dLej                  e   d
e:f&dMZ;ddNdedOej                  e    d
e/fdPZ<ded
e
fdQZ=ded
e
fdRZ>y)SAsyncPipelinesClientr'   c                    || _         y r)   r*   r,   s     r.   r/   zAsyncPipelinesClient.__init__  r0   r1   Nr2   r3   r4   r5   r6   r7   r8   c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        |||||d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      7 # t$        $ r" t'        |j                  |j(                        w xY ww)a  
        Search for pipelines by various parameters.

        Parameters:
            - project_id: typing.Optional[str].

            - project_name: typing.Optional[str].

            - pipeline_name: typing.Optional[str].

            - pipeline_type: typing.Optional[PipelineType].

            - organization_id: typing.Optional[str].
        ---
        from llama_cloud import PipelineType
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.search_pipelines(
            pipeline_type=PipelineType.PLAYGROUND,
        )
        r:   r;   r<   r2   r=   r>   NrB   rC   rD   rE   rH   rV   s           r.   rY   z%AsyncPipelinesClient.search_pipelines  sP    B ..;;CCLL  D$8$8$E$E$G#H!JL^_(",$0%2%2'6 ((446 D 
 
	 )''-#-((X)>	@PQQ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN/
*  	Sy'<'<9>>RR	Ss+   BE>EBE>'E 7E>+E;;E>rZ   rJ   c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      t        |      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)r\   r]   r;   r<   rZ   r=   r^   NrB   rC   rD   rE   r_   r`   s         r.   ra   z$AsyncPipelinesClient.create_pipeline  s>    " ..;;CCLL  D$8$8$E$E$G#H!JL^_(
Wf)gh!'*((446 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	S+   BE4EBE4E -E4+E11E4c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd      t        ||d      t        |      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)rd   re   r;   r<   rZ   r=   r^   NrB   rC   rD   rE   r_   r`   s         r.   rf   z$AsyncPipelinesClient.upsert_pipeline  s>    $ ..;;CCLL  D$8$8$E$E$G#H!JL^_(
Wf)gh!'*((446 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Sr  rg   c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |
      7 # t        $ r" t!        |j                  |j"                  
      w xY ww)ri   r:   r;   rj   r=   rk   NrB   rC   rD   rE   rl   rm   s       r.   rn   z!AsyncPipelinesClient.get_pipeline  s1     ..;;CCLL  D$8$8$E$E$G#H!JN_`k_lLmn((446	 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BE D0BE 	D2 E 2+EE ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   c                  K   i }|t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |	t         ur|	|d<   |
t         ur|
|d	<   |t         ur||d
<   |t         ur||d<   |t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd|       t        |      | j                  j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)r}   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   re   r;   rj   r=   r~   NrB   rC   rD   rE   r   r   s                    r.   r   z-AsyncPipelinesClient.update_existing_pipeline+  s    ^ 24D $-H[!t#'3H^$4'+;H'($D04MH01!-1GH-.d*.AH*+$&*9H&'t#HV&d26QH23d*.AH*+!'HX4'+;H'(..;;CCLL  D$8$8$E$E$G#H!JN_`k_lLmn!(+((446 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   D)H+G,BH1G H+HHc                 r  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd|       | j                   j                         d       d{   }d|j                  cxk  rdk  ry |j                  d	k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |
      7 # t        $ r" t        |j                  |j                   
      w xY ww)aK  
        Delete a pipeline by ID.

        Parameters:
            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.delete_pipeline(
            pipeline_id="string",
        )
        r   r;   rj   r=   rk   NrB   rC   rD   rE   r   rm   s       r.   r   z$AsyncPipelinesClient.delete_pipeline  s      ..;;CCLL  D$8$8$E$E$G#H!JN_`k_lLmn((446	 D 
 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BD7DAD7 D	 0D7	+D44D7r   r   r   r   c          	      @  K   i }|t         ur||d<   |t         ur||d<   |t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd| d      t        |      | j                  j                         d	       d
{   }d|j                  cxk  rdk  r5n n2t        j                  t        j                  |j                               S |j                  dk(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      7 # t$        $ r" t'        |j                  |j(                        w xY ww)a  
        Make a retrieval query + chat completion for a managed pipeline.

        Parameters:
            - pipeline_id: str.

            - class_name: typing.Optional[str].

            - data: typing.Optional[ChatData].

            - messages: typing.Optional[typing.List[InputMessage]].
        ---
        from llama_cloud import (
            ChatData,
            FilterCondition,
            LlmParameters,
            MetadataFilters,
            PresetRetrievalParams,
            RetrievalMode,
            SupportedLlmModelNames,
        )
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.chat(
            pipeline_id="string",
            data=ChatData(
                llm_parameters=LlmParameters(
                    model_name=SupportedLlmModelNames.GPT_4_O,
                ),
                retrieval_parameters=PresetRetrievalParams(
                    retrieval_mode=RetrievalMode.CHUNKS,
                    search_filters=MetadataFilters(
                        condition=FilterCondition.AND,
                        filters=[],
                    ),
                ),
            ),
        )
        r   r   r   r]   r;   rj   r   r=   r~   NrB   rC   rD   rE   r   r   s           r.   r   zAsyncPipelinesClient.chat  s|    d 24T!%/H\"t#HV4#+HZ ..;;CCLL  D$8$8$E$E$G#H!JN_`k_llqLrs!(+((446 D 
 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   B5F7E.8BFE0 F0+FFc           	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)r   r]   r;   rj   r   r=   rk   NrB   rC   rD   rE   rl   rm   s       r.   r   z"AsyncPipelinesClient.copy_pipeline  4     ..;;CCLL  D$8$8$E$E$G#H!JN_`k_llqLrs((446	 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	S+   BE!D1BE!
D3 E!3+EE!r   r   r   r   r   r   r   c                
  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||||||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  t        j                  t           |j                               S |j                  dk(  r1t!        t        j                  t"        |j                                     	 |j                         }	t'        |j                  |	      7 # t$        $ r" t'        |j                  |j(                        w xY ww)a  
        Return a list of documents for a pipeline.

        Parameters:
            - pipeline_id: str.

            - skip: typing.Optional[int].

            - limit: typing.Optional[int].

            - file_id: typing.Optional[str].

            - only_direct_upload: typing.Optional[bool].

            - only_api_data_source_documents: typing.Optional[bool].

            - status_refresh_policy: typing.Optional[ListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy].
        ---
        from llama_cloud import (
            ListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy,
        )
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.list_pipeline_documents(
            pipeline_id="string",
            status_refresh_policy=ListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsGetRequestStatusRefreshPolicy.CACHED,
        )
        r:   r;   rj   r   r   r=   r>   NrB   rC   rD   rE   r   r   s
             r.   r   z,AsyncPipelinesClient.list_pipeline_documents  sb    X ..;;CCLL  ''4467q9=N{m[e;f ) "&*<6T-B	 ((446! D 
 
	$ )''-#-((])CY^^EUVV  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN5
0  	Sy'<'<9>>RR	Ss+   BFEBF,E <F+F  Fc          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |      | j                   j                         d       d{   }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      7 # t$        $ r" t'        |j                  |j(                        w xY ww)a  
        Batch create documents for a pipeline.

        Parameters:
            - pipeline_id: str.

            - request: typing.List[CloudDocumentCreate].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.create_batch_pipeline_documents(
            pipeline_id="string",
            request=[],
        )
        r]   r;   rj   r   r=   r~   NrB   rC   rD   rE   r   r   s        r.   r   z4AsyncPipelinesClient.create_batch_pipeline_documentsM  sH    * ..;;CCLL  ''4467q9=N{m[e;f "'*((446 D 
 
	 )''-#-((])CY^^EUVV  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	S+   BE<EBE<%E 5E<+E99E<c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        |      | j                   j                         d       d{   }d|j                  cxk  rd	k  r<n n9t        j                  t        j                  t           |j                               S |j                  d
k(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      7 # t$        $ r" t'        |j                  |j(                        w xY ww)a  
        Batch create or update a document for a pipeline.

        Parameters:
            - pipeline_id: str.

            - request: typing.List[CloudDocumentCreate].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.upsert_batch_pipeline_documents(
            pipeline_id="string",
            request=[],
        )
        re   r;   rj   r   r=   r~   NrB   rC   rD   rE   r   r   s        r.   r   z4AsyncPipelinesClient.upsert_batch_pipeline_documentsu  sH    * ..;;CCLL  ''4467q9=N{m[e;f "'*((446 D 
 
	 )''-#-((])CY^^EUVV  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Sr  r   r   r   c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  ry |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)a  
        Force sync all documents in a pipeline by batching document ingestion jobs.

        - Iterates all document refs for the pipeline
        - Enqueues document ingestion jobs in batches of `batch_size`

        Parameters:
            - pipeline_id: str.

            - batch_size: typing.Optional[int].

            - only_failed: typing.Optional[bool]. Only sync retriable documents (failed/cancelled/not-started/stalled-in-progress)
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.force_sync_all_pipeline_documents(
            pipeline_id="string",
        )
        r]   r;   rj   r   r   r=   r>   NrB   rC   rD   rE   r   r   s         r.   r   z6AsyncPipelinesClient.force_sync_all_pipeline_documents  s3    2 ..;;CCLL  ''4467q9=N{m[t;u )
S^)_`((446 D 
 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BEDAE.D >E+EEc                  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        ||||||d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }	t#        |j                  |	      7 # t         $ r" t#        |j                  |j$                        w xY ww)aA  
        Return a list of documents for a pipeline.

        Parameters:
            - pipeline_id: str.

            - skip: typing.Optional[int].

            - limit: typing.Optional[int].

            - file_id: typing.Optional[str].

            - only_direct_upload: typing.Optional[bool].

            - only_api_data_source_documents: typing.Optional[bool].

            - status_refresh_policy: typing.Optional[PaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy].
        ---
        from llama_cloud import (
            PaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy,
        )
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.paginated_list_pipeline_documents(
            pipeline_id="string",
            status_refresh_policy=PaginatedListPipelineDocumentsApiV1PipelinesPipelineIdDocumentsPaginatedGetRequestStatusRefreshPolicy.CACHED,
        )
        r:   r;   rj   r   r   r=   r>   NrB   rC   rD   rE   r   r   s
             r.   r   z6AsyncPipelinesClient.paginated_list_pipeline_documents  sZ    X ..;;CCLL  ''4467q9=N{m[o;p ) "&*<6T-B	 ((446! D 
 
	$ )''-#-(()LinnN^__  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN5
0  	Sy'<'<9>>RR	Ss+   BE2EBE2E +E2+E//E2r   c           
        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)a  
        Return a single document for a pipeline.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.get_pipeline_document(
            document_id="string",
            pipeline_id="string",
        )
        r:   r;   rj   r   r=   rk   NrB   rC   rD   rE   r   r   s        r.   r   z*AsyncPipelinesClient.get_pipeline_document  s=    & ..;;CCLL  ''4467q9=N{m[fgrfs;t ((446 D 
 
	 )''-#-((	8HII  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   BE#D3BE#D5 E#5+E  E#c           
      x  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d|       | j                   j                         d       d{   }d|j                  cxk  rd	k  ry |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |      7 # t        $ r" t        |j                  |j                         w xY ww)aO  
        Delete a document from a pipeline.
        Initiates an async job that will:

        1. Delete vectors from the vector store
        2. Delete the document from MongoDB after vectors are successfully deleted

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.delete_pipeline_document(
            document_id="string",
            pipeline_id="string",
        )
        r   r;   rj   r   r=   rk   NrB   rC   rD   rE   r   r   s        r.   r   z-AsyncPipelinesClient.delete_pipeline_document6  s+    . ..;;CCLL  ''4467q9=N{m[fgrfs;t ((446 D 
 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   BD:D
AD:#D 3D:+D77D:c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r<n n9t        j                  t        j                  t           |j                               S |j                  dk(  r1t        t        j                  t         |j                                     	 |j                         }t%        |j                  |      7 # t"        $ r" t%        |j                  |j&                        w xY ww)a  
        Return a list of chunks for a pipeline document.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.list_pipeline_document_chunks(
            document_id="string",
            pipeline_id="string",
        )
        r:   r;   rj   r   r   r=   rk   NrB   rC   rD   rE   r   r   s        r.   r   z2AsyncPipelinesClient.list_pipeline_document_chunks_  sE    & ..;;CCLL  ''4467q9#K=K=P ((446 D 
 
	 )''-#-((X)>	@PQQ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE5EBE5E .E5+E22E5c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)a  
        Return a single document for a pipeline.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.get_pipeline_document_status(
            document_id="string",
            pipeline_id="string",
        )
        r:   r;   rj   r   r   r=   rk   NrB   rC   rD   rE   r   r   s        r.   r   z1AsyncPipelinesClient.get_pipeline_document_status  s=    & ..;;CCLL  ''4467q9#K=K=P ((446 D 
 
	 )''-#-(()GIYZZ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE$D4BE$D6 E$6+E!!E$c                   K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d| d      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r5n n2t        j                  t        j                  |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      7 # t         $ r" t#        |j                  |j$                        w xY ww)a  
        Sync a specific document for a pipeline.

        Parameters:
            - document_id: str.

            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.sync_pipeline_document(
            document_id="string",
            pipeline_id="string",
        )
        r]   r;   rj   r   r   r=   rk   NrB   rC   rD   rE   r   r   s        r.   r   z+AsyncPipelinesClient.sync_pipeline_document  s@    & ..;;CCLL  ''4467q9#K=K=N ((446 D 
 
	 )''-#-((Y^^5EFF  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN#
  	Sy'<'<9>>RR	Ss+   BE.D>BE.E  'E. +E++E.c           	      t  K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  ry |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t        |j                  |      7 # t        $ r" t        |j                  |j                         w xY ww)a/  
        Parameters:
            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.force_delete_pipeline(
            pipeline_id="string",
        )
        r]   r;   rj   r   r=   rk   NrB   rC   rD   rE   r   rm   s       r.   r   z*AsyncPipelinesClient.force_delete_pipeline  s%     ..;;CCLL  ''4467q9=N{m[h;i ((446 D 
 
	 )''-#- .  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   BD8DAD8!D
 1D8
+D55D8c           	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)ak  
        Get a playground session for a user and pipeline.

        Parameters:
            - pipeline_id: str.
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.get_playground_session(
            pipeline_id="string",
        )
        r:   r;   rj   r   r=   rk   NrB   rC   rD   rE   r   rm   s       r.   r   z+AsyncPipelinesClient.get_playground_session  s8      ..;;CCLL  ''4467q9=N{m[n;o ((446 D 
 
	 )''-#-(():INN<LMM  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Sr
  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   c          	      h  K   d|
i}|t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |	t         ur|	|d<   |t         ur||d<   |t         ur||d	<   |t         ur||d
<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   |t         ur||d<   | j                  j                  j                  dt        j
                  j                  | j                  j                          dd| d      t        ||d      t        |      | j                  j                         d       d{   }d|j                  cxk  rdk  r+n n(t        j                  t        |j                               S |j                  dk(  r1t!        t        j                  t"        |j                                     	 |j                         }t'        |j                  |      7 # t$        $ r" t'        |j                  |j(                        w xY ww)aP  
        Get retrieval results for a managed pipeline and a query

        Parameters:
            - pipeline_id: str.

            - project_id: typing.Optional[str].

            - organization_id: typing.Optional[str].

            - alpha: typing.Optional[float].

            - class_name: typing.Optional[str].

            - dense_similarity_cutoff: typing.Optional[float].

            - dense_similarity_top_k: typing.Optional[int].

            - enable_reranking: typing.Optional[bool].

            - files_top_k: typing.Optional[int].

            - query: str. The query to retrieve against.

            - rerank_top_n: typing.Optional[int].

            - retrieval_mode: typing.Optional[RetrievalMode]. The retrieval mode for the query.

            - retrieve_image_nodes: typing.Optional[bool]. Whether to retrieve image nodes.

            - retrieve_page_figure_nodes: typing.Optional[bool]. Whether to retrieve page figure nodes.

            - retrieve_page_screenshot_nodes: typing.Optional[bool]. Whether to retrieve page screenshot nodes.

            - search_filters: typing.Optional[MetadataFilters].

            - search_filters_inference_schema: typing.Optional[typing.Dict[str, typing.Optional[RetrievalParamsSearchFiltersInferenceSchemaValue]]].

            - sparse_similarity_top_k: typing.Optional[int].
        ---
        from llama_cloud import FilterCondition, MetadataFilters, RetrievalMode
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.run_search(
            pipeline_id="string",
            query="string",
            retrieval_mode=RetrievalMode.CHUNKS,
            search_filters=MetadataFilters(
                condition=FilterCondition.AND,
                filters=[],
            ),
        )
        r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r]   r;   rj   r   rZ   r=   r^   NrB   rC   rD   rE   r   r   s                         r.   r   zAsyncPipelinesClient.run_search  s[    ` 3:51A %HWT!%/H\""$.2IH./!-1GH-.4'+;H'(d"&1H]#t#'3H^$%)7H%&t+/CH+,%T15OH12)59WH56%)7H%&*$6:YH67"$.2IH./..;;CCLL  D$8$8$E$E$G#H!JN_`k_lluLvw(
Wf)gh!(+((446 D 
 
	 )''-#-(()..:JKK  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   EH2HBH2H +H2+H//H2r   r   c          	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      t        d|i      | j                   j                         d       d{   }d	|j                  cxk  rd
k  r+n n(t        j                  t        |j                               S |j                  dk(  r1t        t        j                  t        |j                                     	 |j                         }t#        |j                  |      7 # t         $ r" t#        |j                  |j$                        w xY ww)a  
        Get the status of a pipeline by ID.

        Parameters:
            - pipeline_id: str.

            - full_details: typing.Optional[bool].
        ---
        from llama_cloud.client import AsyncLlamaCloud

        client = AsyncLlamaCloud(
            token="YOUR_TOKEN",
        )
        await client.pipelines.get_pipeline_status(
            pipeline_id="string",
        )
        r:   r;   rj   r   r   r=   r>   NrB   rC   rD   rE   r   r   s        r.   r   z(AsyncPipelinesClient.get_pipeline_status  sB    ( ..;;CCLL  D$8$8$E$E$G#H!JN_`k_llsLtu(.,)GH((446 D 
 
	 )''-#-(()GIYZZ  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BE-D=BE-D? &E-?+E**E-c           	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)r   r]   r;   rj   r   r=   rk   NrB   rC   rD   rE   rl   rm   s       r.   r   z"AsyncPipelinesClient.sync_pipeline  r	  r
  c           	        K   | j                   j                  j                  dt        j                  j                  | j                   j                          dd| d      | j                   j                         d       d{   }d|j                  cxk  rd	k  r+n n(t        j                  t        |j                               S |j                  d
k(  r1t        t        j                  t        |j                                     	 |j                         }t!        |j                  |      7 # t        $ r" t!        |j                  |j"                        w xY ww)r   r]   r;   rj   r   r=   rk   NrB   rC   rD   rE   rl   rm   s       r.   r   z)AsyncPipelinesClient.cancel_pipeline_sync  s7    
 ..;;CCLL  ''4467q9=N{m[g;h ((446 D 
 
	 )''-#-((9>>3CDD  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Sr
  )?r   r   r   r   r/   rR   r   r   r   rS   r   rY   r   ra   rf   rn   r   r   r"   r   r   r   r   r#   r   r   r   r   r   r   r   r   r   r    r   r   r   r   r   r   r!   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.   r   r     sh   .*< . ,0-1.27;048O OOC(8O ooc*	8O
 s+8O |48O  -8O 
X	8Oz ,004	!O OOC(!O  -	!O
  !O 
!OL ,004	"O OOC("O  -	"O
  "O 
"OHOc Oh O6 6:-1KO:>HL48CG%)NRBF'+KOWOWO ??>2	WO
 ooc*WO !//*GHWO $*??3#7WO !'0D EWO $__S1WO  )?@WO ooc"WO &,__5J%KWO $__->?WO $WO !//*GHWO  
!WOrO O OH ,0*.?CHOHO OOC(	HO
 ooh'HO //&++l";<HO 
HOTOs Ox O6 &*&*(,48@D FOFO ooc"	FO
 s#FO %FO #OOD1FO )/(=FO  &_ 
FO 
]	#FOP&O&O,2KK8K,L&O	]	#&OP&O&O,2KK8K,L&O	]	#&OR GKqu*O*O/5s/C*OY_YhYhimYn*O	*O` &*&*(,48@D FOFO ooc"	FO
 s#FO %FO #OOD1FO )/(=FO  &q 
FO 
-FOP#Os #O #OQ^ #OJ'O# 'OC 'OTX 'OR$Os $OQT $OY_YdYdemYn $OL$Oc $OPS $OXv $OL$O $O# $ORXR\R\ $OLOs Ot O@ O  O@Q  OL ,004(,+/:>7;26,0-19=6:<@@D;? 8<-}O}O OOC(	}O
  -}O u%}O OOC(}O "(!7}O !' 4}O !//$/}O __S)}O }O ooc*}O 6}O %ood3}O  %+OOD$9!}O" )/(=#}O$ 8%}O& *0KKV__-]^^_*
'}O, "(!5-}O. 
/}O@ JN#O#O171F#O	'#OJOs Ox O.Oc Oh Or1   r   )MrR   urllib.parserK   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.jsonable_encoderr   core.remove_none_from_dictr	   !errors.unprocessable_entity_errorr
   types.chat_datar   types.cloud_documentr   types.cloud_document_creater   types.data_sink_creater   types.http_validation_errorr   types.input_messager   types.llama_parse_parametersr   'types.managed_ingestion_status_responser   types.metadata_filtersr   -types.paginated_list_cloud_documents_responser   types.pipeliner   types.pipeline_creater   types.pipeline_metadata_configr   types.pipeline_typer   types.playground_sessionr   types.preset_retrieval_paramsr   types.retrieval_moder   types.retrieve_resultsr   types.sparse_model_configr   types.text_noder   gtypes.list_pipeline_documents_api_v_1_pipelines_pipeline_id_documents_get_request_status_refresh_policyr    {types.paginated_list_pipeline_documents_api_v_1_pipelines_pipeline_id_documents_paginated_get_request_status_refresh_policyr!   &types.pipeline_update_embedding_configr"   &types.pipeline_update_transform_configr#   <types.retrieval_params_search_filters_inference_schema_valuer$   rP   __version__
startswithImportErrorpydantic.v1v1castr   r   r&   r   r   r1   r.   <module>rB     s      ( & H 5 ? I ' 1 > 4 > / @ U 5 ` & 3 D / 9 B 1 5 : ' R Q&&t,"
 v{{6::s#TO TOn"TO TO}"  s   'D 	D+*D+