Home / File/ base.py — langchain Source File

base.py — langchain Source File

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

Entity Profile

Dependency Diagram

graph LR
  8439c834_66c2_081d_097c_a1945000c8b7["base.py"]
  f3365e3c_fb7a_bb9a_bc79_059b06cb7024["warnings"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> f3365e3c_fb7a_bb9a_bc79_059b06cb7024
  feec1ec4_6917_867b_d228_b134d0ff8099["typing"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> feec1ec4_6917_867b_d228_b134d0ff8099
  2485b66a_3839_d0b6_ad9c_a4ff40457dc6["langchain_core._api"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> 2485b66a_3839_d0b6_ad9c_a4ff40457dc6
  17a62cb3_fefd_6320_b757_b53bb4a1c661["langchain_core.callbacks"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> 17a62cb3_fefd_6320_b757_b53bb4a1c661
  e929cf21_6ab8_6ff3_3765_0d35a099a053["langchain_core.language_models"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> e929cf21_6ab8_6ff3_3765_0d35a099a053
  628cbc5d_711f_ac0c_2f53_db992d48d7da["langchain_core.output_parsers"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> 628cbc5d_711f_ac0c_2f53_db992d48d7da
  31eab4ab_7281_1e6c_b17d_12e6ad9de07a["langchain_core.runnables"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> 31eab4ab_7281_1e6c_b17d_12e6ad9de07a
  dd5e7909_a646_84f1_497b_cae69735550e["pydantic"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> dd5e7909_a646_84f1_497b_cae69735550e
  9a0fc770_8c3f_14bc_3c7d_37852927778e["langchain_classic.chains.base"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> 9a0fc770_8c3f_14bc_3c7d_37852927778e
  2ae20f7f_90b4_04eb_b042_fb6a36125b98["langchain_classic.chains.natbot.prompt"]
  8439c834_66c2_081d_097c_a1945000c8b7 --> 2ae20f7f_90b4_04eb_b042_fb6a36125b98
  style 8439c834_66c2_081d_097c_a1945000c8b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Implement an LLM driven browser."""

from __future__ import annotations

import warnings
from typing import Any

from langchain_core._api import deprecated
from langchain_core.callbacks import CallbackManagerForChainRun
from langchain_core.language_models import BaseLanguageModel
from langchain_core.output_parsers import StrOutputParser
from langchain_core.runnables import Runnable
from pydantic import ConfigDict, model_validator

from langchain_classic.chains.base import Chain
from langchain_classic.chains.natbot.prompt import PROMPT


@deprecated(
    since="0.2.13",
    message=(
        "Importing NatBotChain from langchain is deprecated and will be removed in "
        "langchain 1.0. Please import from langchain_community instead: "
        "from langchain_community.chains.natbot import NatBotChain. "
        "You may need to pip install -U langchain-community."
    ),
    removal="1.0",
)
class NatBotChain(Chain):
    """Implement an LLM driven browser.

    **Security Note**: This toolkit provides code to control a web-browser.

        The web-browser can be used to navigate to:

        - Any URL (including any internal network URLs)
        - And local files

        Exercise care if exposing this chain to end-users. Control who is able to
        access and use this chain, and isolate the network access of the server
        that hosts this chain.

        See https://docs.langchain.com/oss/python/security-policy for more information.

    Example:
        ```python
        from langchain_classic.chains import NatBotChain

        natbot = NatBotChain.from_default("Buy me a new hat.")
        ```
    """

    llm_chain: Runnable
    objective: str
    """Objective that NatBot is tasked with completing."""
    llm: BaseLanguageModel | None = None
    """[Deprecated] LLM wrapper to use."""
    input_url_key: str = "url"
    input_browser_content_key: str = "browser_content"
    previous_command: str = ""
// ... (99 more lines)

Subdomains

Classes

Dependencies

  • langchain_classic.chains.base
  • langchain_classic.chains.natbot.prompt
  • langchain_core._api
  • langchain_core.callbacks
  • langchain_core.language_models
  • langchain_core.output_parsers
  • langchain_core.runnables
  • pydantic
  • typing
  • warnings

Frequently Asked Questions

What does base.py do?
base.py is a source file in the langchain codebase, written in python. It belongs to the AgentOrchestration domain, ClassicChains subdomain.
What does base.py depend on?
base.py imports 10 module(s): langchain_classic.chains.base, langchain_classic.chains.natbot.prompt, langchain_core._api, langchain_core.callbacks, langchain_core.language_models, langchain_core.output_parsers, langchain_core.runnables, pydantic, and 2 more.
Where is base.py in the architecture?
base.py is located at libs/langchain/langchain_classic/chains/natbot/base.py (domain: AgentOrchestration, subdomain: ClassicChains, directory: libs/langchain/langchain_classic/chains/natbot).

Analyze Your Own Codebase

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

Try Supermodel Free