Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  172f1b3a_c31a_38f5_2816_547635d8bc60["__init__()"]
  fe85a857_8f1a_341e_f9df_4f1606d784d0["ReActChain"]
  172f1b3a_c31a_38f5_2816_547635d8bc60 -->|defined in| fe85a857_8f1a_341e_f9df_4f1606d784d0
  style 172f1b3a_c31a_38f5_2816_547635d8bc60 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/react/base.py lines 173–189

    def __init__(self, llm: BaseLanguageModel, docstore: Docstore, **kwargs: Any):
        """Initialize with the LLM and a docstore."""
        docstore_explorer = DocstoreExplorer(docstore)
        tools = [
            Tool(
                name="Search",
                func=docstore_explorer.search,
                description="Search for a term in the docstore.",
            ),
            Tool(
                name="Lookup",
                func=docstore_explorer.lookup,
                description="Lookup a term in the docstore.",
            ),
        ]
        agent = ReActDocstoreAgent.from_llm_and_tools(llm, tools)
        super().__init__(agent=agent, tools=tools, **kwargs)

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/react/base.py.
Where is __init__() defined?
__init__() is defined in libs/langchain/langchain_classic/agents/react/base.py at line 173.

Analyze Your Own Codebase

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

Try Supermodel Free