
    KKi                        S r SSKJr  SSK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S	 jjrSSSS
SSSS.                   SS jjrSSSS.         SS jjrg)zDInterface with the [LangChain Hub](https://smith.langchain.com/hub).    )annotationsN)Sequence)AnyLiteral)dumps)loads)BasePromptTemplatec                     SSK Jn  U" XS9n[        US5      (       a  [        US5      (       a  U$ SSKJn  U" XS9$ ! [         a0     SSKJn  U" XS9s $ ! [         a  nSn[	        U5      UeSnAff = ff = f)a  Get a client for interacting with the LangChain Hub.

Attempts to use LangSmith client if available, otherwise falls back to
the legacy `langchainhub` client.

Args:
    api_key: API key to authenticate with the LangChain Hub API.
    api_url: URL of the LangChain Hub API.

Returns:
    Client instance for interacting with the hub.

Raises:
    ImportError: If neither `langsmith` nor `langchainhub` can be imported.
r   )Client)api_keypush_promptpull_promptzdCould not import langsmith or langchainhub (deprecated),please install with `pip install langsmith`.N)	langsmithr   hasattrlangchainhubImportError)r   api_urlLangSmithClient	ls_clientLangChainHubClientemsgs          W/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langchain_classic/hub.py_get_clientr      s    &*7#G=	9m,,M1R1R=!';; 
*		*A%g?? 	*?  c")	*
*s1   /> > 
A8	AA8
A4!A//A44A8F)r   r   parent_commit_hashnew_repo_is_publicnew_repo_descriptionreadmetagsc          
         [        X2S9n	[        U	S5      (       a  U	R                  U UUUUUUS9$ [        U5      n
U	R	                  U U
UUUS9$ )a  Push an object to the hub and returns the URL it can be viewed at in a browser.

Args:
    repo_full_name: The full name of the prompt to push to in the format of
        `owner/prompt_name` or `prompt_name`.
    object: The LangChain object to serialize and push to the hub.
    api_url: The URL of the LangChain Hub API. Defaults to the hosted API service
        if you have an API key set, or a localhost instance if not.
    api_key: The API key to use to authenticate with the LangChain Hub API.
    parent_commit_hash: The commit hash of the parent commit to push to. Defaults
        to the latest commit automatically.
    new_repo_is_public: Whether the prompt should be public.
    new_repo_description: The description of the prompt.
    readme: README content for the repository.
    tags: Tags to associate with the prompt.

Returns:
    URL where the pushed object can be viewed in a browser.
r   r   r   )objectr   	is_publicdescriptionr   r   )r   r   r   )r   r   r   r   push)repo_full_namer"   r   r   r   r   r   r   r   clientmanifest_jsons              r   r%   r%   7   sz    > :F v}%%!!1(, " 
 	
 &MM;;--1       )include_modelr   r   c                  [        X2S9n[        US5      (       a  UR                  XS9$ [        US5      (       a  UR                  U 5      nU(       a  SOSn[	        [
        R                  " US   5      US9n[        U[        5      (       aJ  UR                  c  0 Ul	        US	   UR                  S
'   US   UR                  S'   US   UR                  S'   U$ UR                  U 5      n[	        U5      $ )aq  Pull an object from the hub and returns it as a LangChain object.

Args:
    owner_repo_commit: The full name of the prompt to pull from in the format of
        `owner/prompt_name:commit_hash` or `owner/prompt_name`
        or just `prompt_name` if it's your own prompt.
    include_model: Whether to include the model configuration in the pulled prompt.
    api_url: The URL of the LangChain Hub API. Defaults to the hosted API service
        if you have an API key set, or a localhost instance if not.
    api_key: The API key to use to authenticate with the LangChain Hub API.

Returns:
    The pulled LangChain object.
r!   r   )r*   	pull_repoallcoremanifest)allowed_objectsownerlc_hub_ownerrepolc_hub_repocommit_hashlc_hub_commit_hash)r   r   r   r,   r   jsonr   
isinstancer	   metadatapull)	owner_repo_commitr*   r   r   r'   res_dictr0   objresps	            r   r:   r:   o   s    * :F v}%%!!"3!QQ v{####$56;H%fDJJx
34oVc-..||#!+3G+<CLL(*26*:CLL'19-1HCLL-.
 -.D;r)   )NN)r   
str | Noner   r?   returnr   )r&   strr"   r   r   r?   r   r?   r   r?   r   boolr   r?   r   r?   r   zSequence[str] | Noner@   rA   )
r;   rA   r*   zbool | Noner   r?   r   r?   r@   r   )__doc__
__future__r   r7   collections.abcr   typingr   r   langchain_core.load.dumpr   langchain_core.load.loadr   langchain_core.promptsr	   r   r%   r:    r)   r   <module>rK      s   J "  $  * * 5 &*&*&* 	&*Z %)$'+!%555 	5
 5 #5 5 %5 5 5 	5v "&++ + 	+
 + 	+r)   