Home / File/ hub.py — langchain Source File

hub.py — langchain Source File

Architecture documentation for hub.py, a python file in the langchain codebase. 4 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  ea920560_5c8b_3c74_656c_10dc1fac11e8["hub.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  ea920560_5c8b_3c74_656c_10dc1fac11e8 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  c764ccae_0d75_abec_7c23_6d5d1949a7ba["langchain_core.runnables.base"]
  ea920560_5c8b_3c74_656c_10dc1fac11e8 --> c764ccae_0d75_abec_7c23_6d5d1949a7ba
  81c04601_d095_a27d_4af1_55e771bb2b6b["langchain_core.runnables.utils"]
  ea920560_5c8b_3c74_656c_10dc1fac11e8 --> 81c04601_d095_a27d_4af1_55e771bb2b6b
  f09cee10_2ce5_8d58_02a3_0aad2fc8ea6e["langchain_classic.hub"]
  ea920560_5c8b_3c74_656c_10dc1fac11e8 --> f09cee10_2ce5_8d58_02a3_0aad2fc8ea6e
  style ea920560_5c8b_3c74_656c_10dc1fac11e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Any

from langchain_core.runnables.base import RunnableBindingBase
from langchain_core.runnables.utils import Input, Output


class HubRunnable(RunnableBindingBase[Input, Output]):  # type: ignore[no-redef]
    """An instance of a runnable stored in the LangChain Hub."""

    owner_repo_commit: str

    def __init__(
        self,
        owner_repo_commit: str,
        *,
        api_url: str | None = None,
        api_key: str | None = None,
        **kwargs: Any,
    ) -> None:
        """Initialize the `HubRunnable`.

        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.
            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.
            **kwargs: Additional keyword arguments to pass to the parent class.
        """
        from langchain_classic.hub import pull

        pulled = pull(owner_repo_commit, api_url=api_url, api_key=api_key)
        super_kwargs = {
            "kwargs": {},
            "config": {},
            **kwargs,
            "bound": pulled,
            "owner_repo_commit": owner_repo_commit,
        }
        super().__init__(**super_kwargs)

Subdomains

Classes

Dependencies

  • langchain_classic.hub
  • langchain_core.runnables.base
  • langchain_core.runnables.utils
  • typing

Frequently Asked Questions

What does hub.py do?
hub.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What does hub.py depend on?
hub.py imports 4 module(s): langchain_classic.hub, langchain_core.runnables.base, langchain_core.runnables.utils, typing.
Where is hub.py in the architecture?
hub.py is located at libs/langchain/langchain_classic/runnables/hub.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain/langchain_classic/runnables).

Analyze Your Own Codebase

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

Try Supermodel Free