
    i+\                        S SK r S SKrS SKJr  SSKJr  SSKJrJ	r	  SSK
Jr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr   S SKr\R:                  R=                  S5      (       a  \eS SK J!r  \ RD                  " \ RF                  S5      r$ " S S5      r% " S S5      r&g! \ a    S SKr N>f = f)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)jsonable_encoder)remove_none_from_dict)UnprocessableEntityError)ChatApp)ChatAppResponse)HttpValidationError)InputMessage)LlmParameters)PresetCompositeRetrievalParamsz1..c                   J   \ rS rSrS\4S jrSSS.S\R                  \   S\R                  \   S\R                  \
   4S	 jjrSSS.S\R                  \   S\R                  \   S
\S\S\S\S\4S jjrS\S\4S jrSS\\\S.S\S\R                  \   S\R                  \   S
\R                  \   S\R                  \   S\R                  \   S\4S jjrS\S\R&                  4S jr\S.S\S\R                  \R                  \      S\R&                  4S jjrSrg)ChatAppsClient   client_wrapperc                    Xl         g N_client_wrapperselfr   s     `/home/james-whalen/.local/lib/python3.13/site-packages/llama_cloud/resources/chat_apps/client.py__init__ChatAppsClient.__init__        -    N
project_idorganization_idr!   r"   returnc          	         U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3S5      [        XS.5      U R                   R                  5       SS9nSUR                  s=::  a  S:  a=  O  O:[        R                  " [        R                  [           UR                  5       5      $ UR                  S	:X  a2  [!        [        R                  " ["        UR                  5       5      5      e UR                  5       n['        UR                  US
9e! [$         a    ['        UR                  UR(                  S
9ef = f)z
Parameters:
    - project_id: typing.Optional[str].

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

client = LlamaCloud(
    token="YOUR_TOKEN",
)
client.chat_apps.get_chat_apps_api_v_1_apps_get()
GET/api/v1/appsr    <   paramsheaderstimeout   ,    status_codebodyr   httpx_clientrequesturllibparseurljoinget_base_urlr	   get_headersr1   pydanticparse_obj_astypingListr   jsonr
   r   r   r   textr   r!   r"   	_response_response_jsons        r   get_chat_apps_api_v_1_apps_get-ChatAppsClient.get_chat_apps_api_v_1_apps_get#   s-     ((55==LL  D$8$8$E$E$G#H!JMZ(
)gh((446 > 
	 )''-#-((_)Ey~~GWXX  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D? ?)E(nameretriever_id
llm_configretrieval_configc                   U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3S5      [        XS.5      [        UUUUS.5      U R                   R                  5       SS9nSUR                  s=::  a  S	:  a,  O  O)[        R                  " [        UR                  5       5      $ UR                  S
:X  a2  [        [        R                  " [         UR                  5       5      5      e UR                  5       n[%        UR                  US9e! ["         a    [%        UR                  UR&                  S9ef = f)aH  
Create a new chat app.

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

    - organization_id: typing.Optional[str].

    - name: str. Name of the chat app

    - retriever_id: str. ID of the retriever to use for the chat app

    - llm_config: LlmParameters. Configuration for the LLM model to use for the chat app

    - retrieval_config: PresetCompositeRetrievalParams. Configuration for the retrieval model to use for the chat app
---
from llama_cloud import (
    CompositeRetrievalMode,
    LlmParameters,
    PresetCompositeRetrievalParams,
    ReRankConfig,
    ReRankerType,
    SupportedLlmModelNames,
)
from llama_cloud.client import LlamaCloud

client = LlamaCloud(
    token="YOUR_TOKEN",
)
client.chat_apps.create_chat_app_api_v_1_apps_post(
    name="string",
    retriever_id="string",
    llm_config=LlmParameters(
        model_name=SupportedLlmModelNames.GPT_4_O,
    ),
    retrieval_config=PresetCompositeRetrievalParams(
        mode=CompositeRetrievalMode.ROUTING,
        rerank_config=ReRankConfig(
            type=ReRankerType.SYSTEM_DEFAULT,
        ),
    ),
)
POSTr&   r'   r    rF   rG   rH   rI   r(   r*   r?   r+   r,   r-   r.   r/   r0   r   r4   r5   r6   r7   r8   r9   r	   r   r:   r1   r;   r<   r   r?   r
   r   r   r   r@   	r   r!   r"   rF   rG   rH   rI   rB   rC   s	            r   !create_chat_app_api_v_1_apps_post0ChatAppsClient.create_chat_app_api_v_1_apps_postD   s@   j ((55==LL  D$8$8$E$E$G#H!JMZ(
)gh! $0",(8	 ((446 > 
	 )''-#-(()..2BCC  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D= =)E&idc                    U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3SU 35      U R                   R                  5       SS9nSUR                  s=::  a  S:  a,  O  O)[        R                  " [        UR                  5       5      $ UR                  S:X  a2  [        [        R                  " [        UR                  5       5      5      e UR                  5       n[!        UR                  US	9e! [         a    [!        UR                  UR"                  S	9ef = f)
z
Get a chat app by ID.

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

client = LlamaCloud(
    token="YOUR_TOKEN",
)
client.chat_apps.get_chat_app(
    id="string",
)
r%   r&   api/v1/apps/r(   r+   r,   r-   r.   r/   r0   r   r4   r5   r6   r7   r8   r9   r:   r1   r;   r<   r   r?   r
   r   r   r   r@   r   rR   rB   rC   s       r   get_chat_appChatAppsClient.get_chat_app   s"     ((55==LL  D$8$8$E$E$G#H!Jl[]Z^L_`((446	 > 
	 )''-#-(()..2BCC  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   D% %)Er!   r"   rF   rH   rI   c          	          0 nU[         La  XGS'   U[         La  XWS'   U[         La  XgS'   U R                  R                  R                  S[        R
                  R                  U R                  R                  5        S3SU 35      [        X#S.5      [        U5      U R                  R                  5       SS	9nS
UR                  s=::  a  S:  a,  O  O)[        R                  " [        UR                  5       5      $ UR                  S:X  a2  [!        [        R                  " ["        UR                  5       5      5      e UR                  5       n	['        UR                  U	S9e! [$         a    ['        UR                  UR(                  S9ef = f)a  
Update a chat app.

Parameters:
    - id: str.

    - project_id: typing.Optional[str].

    - organization_id: typing.Optional[str].

    - name: typing.Optional[str].

    - llm_config: typing.Optional[LlmParameters].

    - retrieval_config: typing.Optional[PresetCompositeRetrievalParams].
---
from llama_cloud import (
    CompositeRetrievalMode,
    LlmParameters,
    PresetCompositeRetrievalParams,
    ReRankConfig,
    ReRankerType,
    SupportedLlmModelNames,
)
from llama_cloud.client import LlamaCloud

client = LlamaCloud(
    token="YOUR_TOKEN",
)
client.chat_apps.update_chat_app(
    id="string",
    llm_config=LlmParameters(
        model_name=SupportedLlmModelNames.GPT_4_O,
    ),
    retrieval_config=PresetCompositeRetrievalParams(
        mode=CompositeRetrievalMode.ROUTING,
        rerank_config=ReRankConfig(
            type=ReRankerType.SYSTEM_DEFAULT,
        ),
    ),
)
rF   rH   rI   PUTr&   rT   r    r(   rM   r-   r.   r/   r0   OMITr   r4   r5   r6   r7   r8   r9   r	   r   r:   r1   r;   r<   r   r?   r
   r   r   r   r@   
r   rR   r!   r"   rF   rH   rI   _requestrB   rC   s
             r   update_chat_appChatAppsClient.update_chat_app   sl   h 24t#VT!%/\"4'+;'(((55==LL  D$8$8$E$E$G#H!Jl[]Z^L_`(
)gh!(+((446 > 
	 )''-#-(()..2BCC  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss    E$ $)Fc                    U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3SU 35      U R                   R                  5       SS9nSUR                  s=::  a  S:  a6  O  O3[        R                  " [        R                  UR                  5       5      $ UR                  S:X  a2  [        [        R                  " [        UR                  5       5      5      e UR                  5       n[#        UR                  US	9e! [          a    [#        UR                  UR$                  S	9ef = f)
z
Parameters:
    - id: str.
---
from llama_cloud.client import LlamaCloud

client = LlamaCloud(
    token="YOUR_TOKEN",
)
client.chat_apps.delete_chat_app(
    id="string",
)
DELETEr&   rT   r(   rU   r-   r.   r/   r0   r   r4   r5   r6   r7   r8   r9   r:   r1   r;   r<   r=   Anyr?   r
   r   r   r   r@   rW   s       r   delete_chat_appChatAppsClient.delete_chat_app   s&    ((55==LL  D$8$8$E$E$G#H!Jl[]Z^L_`((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   D/ /)Emessagesrj   c          	         0 nU[         La  X#S'   U R                  R                  R                  S[        R
                  R                  U R                  R                  5        S3SU S35      [        U5      U R                  R                  5       SS9nSUR                  s=::  a  S	:  a6  O  O3[        R                  " [        R                  UR                  5       5      $ UR                  S
:X  a2  [!        [        R                  " ["        UR                  5       5      5      e UR                  5       n['        UR                  US9e! [$         a    ['        UR                  UR(                  S9ef = f)a  
Chat with a chat app.

Parameters:
    - id: str.

    - messages: typing.Optional[typing.List[InputMessage]].
---
from llama_cloud.client import LlamaCloud

client = LlamaCloud(
    token="YOUR_TOKEN",
)
client.chat_apps.chat_with_chat_app(
    id="string",
)
rj   rK   r&   rT   /chatr(   r?   r+   r,   r-   r.   r/   r0   r^   r   r4   r5   r6   r7   r8   r9   r   r:   r1   r;   r<   r=   rf   r?   r
   r   r   r   r@   r   rR   rj   r`   rB   rC   s         r   chat_with_chat_app!ChatAppsClient.chat_with_chat_app  sF   $ 244#+Z ((55==LL  D$8$8$E$E$G#H!Jl[]Z^^cLde!(+((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	 	)E2r   )__name__
__module____qualname____firstlineno__r   r   r=   Optionalstrr>   r   rD   r   r   r   rP   rX   r^   ra   rf   rg   r   rp   __static_attributes__ r   r   r   r      s   .*; . 59bfO#__S1OKQ??[^K_O	_	%OH ,004	LO OOC(LO  -	LO
 LO LO "LO 9LO 
LO\Os Ow OH ,004%)59LPKOKO OOC(	KO
  -KO ooc"KO OOM2KO !//*HIKO 
KOZO# O&** O< ei $OS $Ovv{{S_G`7a $Omsmwmw $O $Or   r   c                   J   \ rS rSrS\4S jrSSS.S\R                  \   S\R                  \   S\R                  \
   4S	 jjrSSS.S\R                  \   S\R                  \   S
\S\S\S\S\4S jjrS\S\4S jrSS\\\S.S\S\R                  \   S\R                  \   S
\R                  \   S\R                  \   S\R                  \   S\4S jjrS\S\R&                  4S jr\S.S\S\R                  \R                  \      S\R&                  4S jjrSrg)AsyncChatAppsClientiD  r   c                    Xl         g r   r   r   s     r   r   AsyncChatAppsClient.__init__E  r   r   Nr    r!   r"   r#   c          	        #    U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3S5      [        XS.5      U R                   R                  5       SS9I Sh  vN nSUR                  s=::  a  S	:  a=  O  O:[        R                  " [        R                  [           UR                  5       5      $ UR                  S
:X  a2  [!        [        R                  " ["        UR                  5       5      5      e UR                  5       n['        UR                  US9e N! [$         a    ['        UR                  UR(                  S9ef = f7f)a  
Parameters:
    - project_id: typing.Optional[str].

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

client = AsyncLlamaCloud(
    token="YOUR_TOKEN",
)
await client.chat_apps.get_chat_apps_api_v_1_apps_get()
r%   r&   r'   r    r(   r)   Nr-   r.   r/   r0   r3   rA   s        r   rD   2AsyncChatAppsClient.get_chat_apps_api_v_1_apps_getH  s:      ..;;CCLL  D$8$8$E$E$G#H!JMZ(
)gh((446 D 
 
	 )''-#-((_)Ey~~GWXX  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   BE7	E	
BE7%E 5E7)E44E7rF   rG   rH   rI   c                  #    U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3S5      [        XS.5      [        UUUUS.5      U R                   R                  5       SS9I Sh  vN nS	UR                  s=::  a  S
:  a,  O  O)[        R                  " [        UR                  5       5      $ UR                  S:X  a2  [        [        R                  " [         UR                  5       5      5      e UR                  5       n[%        UR                  US9e N! ["         a    [%        UR                  UR&                  S9ef = f7f)aX  
Create a new chat app.

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

    - organization_id: typing.Optional[str].

    - name: str. Name of the chat app

    - retriever_id: str. ID of the retriever to use for the chat app

    - llm_config: LlmParameters. Configuration for the LLM model to use for the chat app

    - retrieval_config: PresetCompositeRetrievalParams. Configuration for the retrieval model to use for the chat app
---
from llama_cloud import (
    CompositeRetrievalMode,
    LlmParameters,
    PresetCompositeRetrievalParams,
    ReRankConfig,
    ReRankerType,
    SupportedLlmModelNames,
)
from llama_cloud.client import AsyncLlamaCloud

client = AsyncLlamaCloud(
    token="YOUR_TOKEN",
)
await client.chat_apps.create_chat_app_api_v_1_apps_post(
    name="string",
    retriever_id="string",
    llm_config=LlmParameters(
        model_name=SupportedLlmModelNames.GPT_4_O,
    ),
    retrieval_config=PresetCompositeRetrievalParams(
        mode=CompositeRetrievalMode.ROUTING,
        rerank_config=ReRankConfig(
            type=ReRankerType.SYSTEM_DEFAULT,
        ),
    ),
)
rK   r&   r'   r    rL   r(   rM   Nr-   r.   r/   r0   rN   rO   s	            r   rP   5AsyncChatAppsClient.create_chat_app_api_v_1_apps_posti  sM    j ..;;CCLL  D$8$8$E$E$G#H!JMZ(
)gh! $0",(8	 ((446 D 
 
	 )''-#-(()..2BCC  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	 3E5	)E22E5rR   c                   #    U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3SU 35      U R                   R                  5       SS9I Sh  vN nSUR                  s=::  a  S:  a,  O  O)[        R                  " [        UR                  5       5      $ UR                  S	:X  a2  [        [        R                  " [        UR                  5       5      5      e UR                  5       n[!        UR                  US
9e N! [         a    [!        UR                  UR"                  S
9ef = f7f)z
Get a chat app by ID.

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

client = AsyncLlamaCloud(
    token="YOUR_TOKEN",
)
await client.chat_apps.get_chat_app(
    id="string",
)
r%   r&   rT   r(   rU   Nr-   r.   r/   r0   rV   rW   s       r   rX    AsyncChatAppsClient.get_chat_app  s/      ..;;CCLL  D$8$8$E$E$G#H!Jl[]Z^L_`((446	 D 
 
	 )''-#-(()..2BCC  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN
  	Sy'<'<9>>RR	Ss+   A>E D/B	ED1 E1)EErZ   c          	      <  #    0 nU[         La  XGS'   U[         La  XWS'   U[         La  XgS'   U R                  R                  R                  S[        R
                  R                  U R                  R                  5        S3SU 35      [        X#S.5      [        U5      U R                  R                  5       SS	9I S
h  vN nSUR                  s=::  a  S:  a,  O  O)[        R                  " [        UR                  5       5      $ UR                  S:X  a2  [!        [        R                  " ["        UR                  5       5      5      e UR                  5       n	['        UR                  U	S9e N! [$         a    ['        UR                  UR(                  S9ef = f7f)a  
Update a chat app.

Parameters:
    - id: str.

    - project_id: typing.Optional[str].

    - organization_id: typing.Optional[str].

    - name: typing.Optional[str].

    - llm_config: typing.Optional[LlmParameters].

    - retrieval_config: typing.Optional[PresetCompositeRetrievalParams].
---
from llama_cloud import (
    CompositeRetrievalMode,
    LlmParameters,
    PresetCompositeRetrievalParams,
    ReRankConfig,
    ReRankerType,
    SupportedLlmModelNames,
)
from llama_cloud.client import AsyncLlamaCloud

client = AsyncLlamaCloud(
    token="YOUR_TOKEN",
)
await client.chat_apps.update_chat_app(
    id="string",
    llm_config=LlmParameters(
        model_name=SupportedLlmModelNames.GPT_4_O,
    ),
    retrieval_config=PresetCompositeRetrievalParams(
        mode=CompositeRetrievalMode.ROUTING,
        rerank_config=ReRankConfig(
            type=ReRankerType.SYSTEM_DEFAULT,
        ),
    ),
)
rF   rH   rI   r\   r&   rT   r    r(   rM   Nr-   r.   r/   r0   r]   r_   s
             r   ra   #AsyncChatAppsClient.update_chat_app  sy    h 24t#VT!%/\"4'+;'(..;;CCLL  D$8$8$E$E$G#H!Jl[]Z^L_`(
)gh!(+((446 D 
 
	 )''-#-(()..2BCC  C'*8+@+@ATV_VdVdVf+ghh	S&^^-N 9#8#8~NN!
  	Sy'<'<9>>RR	Ss+   B=F?E. B	F
E0 F0)FFc                   #    U R                   R                  R                  S[        R                  R                  U R                   R                  5        S3SU 35      U R                   R                  5       SS9I Sh  vN nSUR                  s=::  a  S:  a6  O  O3[        R                  " [        R                  UR                  5       5      $ UR                  S	:X  a2  [        [        R                  " [        UR                  5       5      5      e UR                  5       n[#        UR                  US
9e N! [          a    [#        UR                  UR$                  S
9ef = f7f)z
Parameters:
    - id: str.
---
from llama_cloud.client import AsyncLlamaCloud

client = AsyncLlamaCloud(
    token="YOUR_TOKEN",
)
await client.chat_apps.delete_chat_app(
    id="string",
)
rd   r&   rT   r(   rU   Nr-   r.   r/   r0   re   rW   s       r   rg   #AsyncChatAppsClient.delete_chat_app$  s3     ..;;CCLL  D$8$8$E$E$G#H!Jl[]Z^L_`((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+   A>E' D9BE'D; %E';)E$$E'ri   rj   c          	        #    0 nU[         La  X#S'   U R                  R                  R                  S[        R
                  R                  U R                  R                  5        S3SU S35      [        U5      U R                  R                  5       SS9I Sh  vN nS	UR                  s=::  a  S
:  a6  O  O3[        R                  " [        R                  UR                  5       5      $ UR                  S:X  a2  [!        [        R                  " ["        UR                  5       5      5      e UR                  5       n['        UR                  US9e N! [$         a    ['        UR                  UR(                  S9ef = f7f)a  
Chat with a chat app.

Parameters:
    - id: str.

    - messages: typing.Optional[typing.List[InputMessage]].
---
from llama_cloud.client import AsyncLlamaCloud

client = AsyncLlamaCloud(
    token="YOUR_TOKEN",
)
await client.chat_apps.chat_with_chat_app(
    id="string",
)
rj   rK   r&   rT   rl   r(   rm   Nr-   r.   r/   r0   rn   ro   s         r   rp   &AsyncChatAppsClient.chat_with_chat_appB  sS    ( 244#+Z ..;;CCLL  D$8$8$E$E$G#H!Jl[]Z^^cLde!(+((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FEBF/E ?F)E>>Fr   )rr   rs   rt   ru   r   r   r=   rv   rw   r>   r   rD   r   r   r   rP   rX   r^   ra   rf   rg   r   rp   rx   ry   r   r   r{   r{   D  s   .*< . 59bfO#__S1OKQ??[^K_O	_	%OH ,004	LO OOC(LO  -	LO
 LO LO "LO 9LO 
LO\OS OW OH ,004%)59LPKOKO OOC(	KO
  -KO ooc"KO OOM2KO !//*HIKO 
KOZO O

 O> RV&O&O$*OOFKK4M$N&O	&O &Or   r{   )'r=   urllib.parser6   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.jsonable_encoderr   core.remove_none_from_dictr	   !errors.unprocessable_entity_errorr
   types.chat_appr   types.chat_app_responser   types.http_validation_errorr   types.input_messager   types.llm_parametersr   'types.preset_composite_retrieval_paramsr   r;   __version__
startswithImportErrorpydantic.v1v1castrf   r^   r   r{   ry   r   r   <module>r      s      ( & H 5 ? I % 6 > / 1 U&&t,,"
 {{6::s#bO bOJ	dO dOY	  s   ,B2 2
B?>B?