Home / Function/ push() — langchain Function Reference

push() — langchain Function Reference

Architecture documentation for the push() function in hub.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  d38006a4_921c_fa6e_3114_2b4729224f76["push()"]
  ccf0b3ef_cfe3_66ba_e6be_6cff0b1467eb["hub.py"]
  d38006a4_921c_fa6e_3114_2b4729224f76 -->|defined in| ccf0b3ef_cfe3_66ba_e6be_6cff0b1467eb
  6075ed9d_f9d4_8afc_d040_b5028a8611ad["_get_client()"]
  d38006a4_921c_fa6e_3114_2b4729224f76 -->|calls| 6075ed9d_f9d4_8afc_d040_b5028a8611ad
  style d38006a4_921c_fa6e_3114_2b4729224f76 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/hub.py lines 55–108

def push(
    repo_full_name: str,
    object: Any,  # noqa: A002
    *,
    api_url: str | None = None,
    api_key: str | None = None,
    parent_commit_hash: str | None = None,
    new_repo_is_public: bool = False,
    new_repo_description: str | None = None,
    readme: str | None = None,
    tags: Sequence[str] | None = None,
) -> str:
    """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.
    """
    client = _get_client(api_key=api_key, api_url=api_url)

    # Then it's langsmith
    if hasattr(client, "push_prompt"):
        return client.push_prompt(
            repo_full_name,
            object=object,
            parent_commit_hash=parent_commit_hash,
            is_public=new_repo_is_public,
            description=new_repo_description,
            readme=readme,
            tags=tags,
        )

    # Then it's langchainhub
    manifest_json = dumps(object)
    return client.push(
        repo_full_name,
        manifest_json,
        parent_commit_hash=parent_commit_hash,
        new_repo_is_public=new_repo_is_public,
        new_repo_description=new_repo_description,
    )

Domain

Subdomains

Frequently Asked Questions

What does push() do?
push() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/hub.py.
Where is push() defined?
push() is defined in libs/langchain/langchain_classic/hub.py at line 55.
What does push() call?
push() calls 1 function(s): _get_client.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free