Home / Function/ fake_llm_math_chain() — langchain Function Reference

fake_llm_math_chain() — langchain Function Reference

Architecture documentation for the fake_llm_math_chain() function in test_llm_math.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  05c20a3b_7652_8fa9_4796_acb2029d3659["fake_llm_math_chain()"]
  4e98a726_3502_d5b4_fa54_cc66e117b849["test_llm_math.py"]
  05c20a3b_7652_8fa9_4796_acb2029d3659 -->|defined in| 4e98a726_3502_d5b4_fa54_cc66e117b849
  style 05c20a3b_7652_8fa9_4796_acb2029d3659 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_llm_math.py lines 11–20

def fake_llm_math_chain() -> LLMMathChain:
    """Fake LLM Math chain for testing."""
    complex_question = _PROMPT_TEMPLATE.format(question="What is the square root of 2?")
    queries = {
        _PROMPT_TEMPLATE.format(question="What is 1 plus 1?"): "Answer: 2",
        complex_question: "```text\n2**.5\n```",
        _PROMPT_TEMPLATE.format(question="foo"): "foo",
    }
    fake_llm = FakeLLM(queries=queries)
    return LLMMathChain.from_llm(fake_llm, input_key="q", output_key="a")

Domain

Subdomains

Frequently Asked Questions

What does fake_llm_math_chain() do?
fake_llm_math_chain() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/chains/test_llm_math.py.
Where is fake_llm_math_chain() defined?
fake_llm_math_chain() is defined in libs/langchain/tests/unit_tests/chains/test_llm_math.py at line 11.

Analyze Your Own Codebase

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

Try Supermodel Free