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
  e8fc2157_5457_e275_2219_a88c3412bb53["__init__()"]
  8b500caa_9954_b0fb_3155_01b166f2ddb7["SelfAskWithSearchChain"]
  e8fc2157_5457_e275_2219_a88c3412bb53 -->|defined in| 8b500caa_9954_b0fb_3155_01b166f2ddb7
  style e8fc2157_5457_e275_2219_a88c3412bb53 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/self_ask_with_search/base.py lines 80–94

    def __init__(
        self,
        llm: BaseLanguageModel,
        search_chain: GoogleSerperAPIWrapper | SearchApiAPIWrapper | SerpAPIWrapper,
        **kwargs: Any,
    ):
        """Initialize only with an LLM and a search chain."""
        search_tool = Tool(
            name="Intermediate Answer",
            func=search_chain.run,
            coroutine=search_chain.arun,
            description="Search",
        )
        agent = SelfAskWithSearchAgent.from_llm_and_tools(llm, [search_tool])
        super().__init__(agent=agent, tools=[search_tool], **kwargs)

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free