o
    °i                  	   @  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Ze	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)sincemessagependingNlatestF)api_urlapi_keyparent_commit_hashnew_repo_is_publicnew_repo_descriptionreadmetagsrepo_full_namestrobjectr   r   Optional[str]r   r   r   boolr   r   r   Optional[Sequence[str]]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   	is_publicdescriptionr   r   )LangSmithClientpush_prompt)
r   r   r   r   r   r   r   r   r   client r    8/usr/local/lib/python3.10/dist-packages/langchain/hub.pypush   s    r"   z@langchain.hub.pull is deprecated. Use the LangSmith SDK instead.)include_modelr   r   owner_repo_commitr#   Optional[bool]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   pull_prompt)r$   r#   r   r   r   r    r    r!   pull8   s   (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   )__doc__
__future__r   collections.abcr   typingr   r   langchain_core._api.deprecationr   	langsmithr   r   r"   r'   r    r    r    r!   <module>   s8    	'