Home / Function/ _load_graph_cypher_chain() — langchain Function Reference

_load_graph_cypher_chain() — langchain Function Reference

Architecture documentation for the _load_graph_cypher_chain() function in loading.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  59f3bf87_d328_d893_0824_1102da1eb840["_load_graph_cypher_chain()"]
  61dd5a0b_3bf7_b973_6dac_edfd465b21fb["loading.py"]
  59f3bf87_d328_d893_0824_1102da1eb840 -->|defined in| 61dd5a0b_3bf7_b973_6dac_edfd465b21fb
  7c915b91_f326_1908_9969_d0cb1f4f7e34["load_chain_from_config()"]
  59f3bf87_d328_d893_0824_1102da1eb840 -->|calls| 7c915b91_f326_1908_9969_d0cb1f4f7e34
  style 59f3bf87_d328_d893_0824_1102da1eb840 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/chains/loading.py lines 555–591

def _load_graph_cypher_chain(config: dict, **kwargs: Any) -> GraphCypherQAChain:
    if "graph" in kwargs:
        graph = kwargs.pop("graph")
    else:
        msg = "`graph` must be present."
        raise ValueError(msg)
    if "cypher_generation_chain" in config:
        cypher_generation_chain_config = config.pop("cypher_generation_chain")
        cypher_generation_chain = load_chain_from_config(
            cypher_generation_chain_config,
            **kwargs,
        )
    else:
        msg = "`cypher_generation_chain` must be present."
        raise ValueError(msg)
    if "qa_chain" in config:
        qa_chain_config = config.pop("qa_chain")
        qa_chain = load_chain_from_config(qa_chain_config, **kwargs)
    else:
        msg = "`qa_chain` must be present."
        raise ValueError(msg)

    try:
        from langchain_community.chains.graph_qa.cypher import GraphCypherQAChain
    except ImportError as e:
        msg = (
            "To use this GraphCypherQAChain functionality you must install the "
            "langchain_community package. "
            "You can install it with `pip install langchain_community`"
        )
        raise ImportError(msg) from e
    return GraphCypherQAChain(
        graph=graph,
        cypher_generation_chain=cypher_generation_chain,
        qa_chain=qa_chain,
        **config,
    )

Subdomains

Frequently Asked Questions

What does _load_graph_cypher_chain() do?
_load_graph_cypher_chain() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/chains/loading.py.
Where is _load_graph_cypher_chain() defined?
_load_graph_cypher_chain() is defined in libs/langchain/langchain_classic/chains/loading.py at line 555.
What does _load_graph_cypher_chain() call?
_load_graph_cypher_chain() calls 1 function(s): load_chain_from_config.

Analyze Your Own Codebase

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

Try Supermodel Free