a
    •˜ëj¿  ã                   @  s¶   d 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 e	ddd	d
�ddddddddœdddddddddddœ
dd„ƒZe	ddd	d
�ddddœddddddœdd„ƒZdS )zGInterface with the `LangChain Hub <https://smith.langchain.com/hub>`__.é    )Úannotations)ÚSequence)ÚAnyÚOptional)Ú
deprecated)ÚClientz0.3.30z@langchain.hub.push is deprecated. Use the LangSmith SDK instead.T)ZsinceÚmessageÚpendingNZlatestF)Úapi_urlÚapi_keyÚparent_commit_hashÚnew_repo_is_publicÚnew_repo_descriptionÚreadmeÚtagsÚstrr   zOptional[str]ÚboolzOptional[Sequence[str]])
Úrepo_full_nameÚobjectr
   r   r   r   r   r   r   Úreturnc          
   	   C  s$   t ||d�}	|	j| ||||||d�S )ag  Push an object to the hub and returns the URL it can be viewed at in a browser.

    :param repo_full_name: The full name of the prompt to push to in the format of
        `owner/prompt_name` or `prompt_name`.
    :param object: The LangChain to serialize and push to the hub.
    :param 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.
    :param api_key: The API key to use to authenticate with the LangChain Hub API.
    :param parent_commit_hash: The commit hash of the parent commit to push to. Defaults
        to the latest commit automatically.
    :param new_repo_is_public: Whether the prompt should be public. Defaults to
        False (Private by default).
    :param new_repo_description: The description of the prompt. Defaults to an empty
        string.
    ©r   )r   r   Z	is_publicÚdescriptionr   r   )ÚLangSmithClientZpush_prompt)
r   r   r
   r   r   r   r   r   r   Úclient© r   úL/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/langchain/hub.pyÚpush   s     ùr   z@langchain.hub.pull is deprecated. Use the LangSmith SDK instead.)Úinclude_modelr
   r   zOptional[bool])Úowner_repo_commitr   r
   r   r   c                C  s   t ||d�}|j| |d�S )uP  Pull an object from the hub and returns it as a LangChain object.

    .. danger::

        Hub manifests are untrusted input. Treat every prompt pulled from the
        hub as untrusted, regardless of the owner â€” public prompts authored by
        other users are obviously external content, but prompts from your own
        account or your organization's account are also unsafe if that account,
        a teammate's account, or the upstream prompt has been compromised.

        ``pull()`` deserializes the manifest via ``load()``, so the
        ``langchain_core.load.load`` threat model applies â€” a manifest can
        intentionally configure a model with a custom base URL, headers, model
        name, or other constructor arguments. These are supported features, but
        they also mean the prompt contents are executable configuration rather
        than plain text: a compromised prompt can redirect API traffic, inject
        headers, or trigger arbitrary code paths in the classes it instantiates.

        Prefer the LangSmith SDK directly. If you must use ``pull()``, pin the
        commit hash and audit the manifest before deserializing.

    :param 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.
    :param 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.
    :param api_key: The API key to use to authenticate with the LangChain Hub API.
    r   )r   )r   Zpull_prompt)r   r   r
   r   r   r   r   r   Úpull8   s    (r   )Ú__doc__Ú
__future__r   Úcollections.abcr   Útypingr   r   Zlangchain_core._api.deprecationr   Z	langsmithr   r   r   r   r   r   r   r   Ú<module>   s6   ý	ö&'ýû