Home / Class/ MRKLChain Class — langchain Architecture

MRKLChain Class — langchain Architecture

Architecture documentation for the MRKLChain class in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  386907ca_eb5f_e178_93a0_c93a44e5c99a["MRKLChain"]
  ec1d7866_e6a8_7cbe_b150_f82463cf2c7f["AgentExecutor"]
  386907ca_eb5f_e178_93a0_c93a44e5c99a -->|extends| ec1d7866_e6a8_7cbe_b150_f82463cf2c7f
  a40b54b2_e125_6f7e_8695_d0b2586d45b2["base.py"]
  386907ca_eb5f_e178_93a0_c93a44e5c99a -->|defined in| a40b54b2_e125_6f7e_8695_d0b2586d45b2
  1d68784a_e4db_462b_0804_2492b616d802["from_chains()"]
  386907ca_eb5f_e178_93a0_c93a44e5c99a -->|method| 1d68784a_e4db_462b_0804_2492b616d802

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/mrkl/base.py lines 184–216

class MRKLChain(AgentExecutor):
    """Chain that implements the MRKL system."""

    @classmethod
    def from_chains(
        cls,
        llm: BaseLanguageModel,
        chains: list[ChainConfig],
        **kwargs: Any,
    ) -> AgentExecutor:
        """User-friendly way to initialize the MRKL chain.

        This is intended to be an easy way to get up and running with the
        MRKL chain.

        Args:
            llm: The LLM to use as the agent LLM.
            chains: The chains the MRKL system has access to.
            **kwargs: parameters to be passed to initialization.

        Returns:
            An initialized MRKL chain.
        """
        tools = [
            Tool(
                name=c.action_name,
                func=c.action,
                description=c.action_description,
            )
            for c in chains
        ]
        agent = ZeroShotAgent.from_llm_and_tools(llm, tools)
        return cls(agent=agent, tools=tools, **kwargs)

Extends

Frequently Asked Questions

What is the MRKLChain class?
MRKLChain is a class in the langchain codebase, defined in libs/langchain/langchain_classic/agents/mrkl/base.py.
Where is MRKLChain defined?
MRKLChain is defined in libs/langchain/langchain_classic/agents/mrkl/base.py at line 184.
What does MRKLChain extend?
MRKLChain extends AgentExecutor.

Analyze Your Own Codebase

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

Try Supermodel Free