Home / Function/ test_context_eval_chain() — langchain Function Reference

test_context_eval_chain() — langchain Function Reference

Architecture documentation for the test_context_eval_chain() function in test_eval_chain.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  419c5e64_049b_b3c9_57b2_86b5e194fe3a["test_context_eval_chain()"]
  919cda35_c0f5_cbb5_866a_0591c5815209["test_eval_chain.py"]
  419c5e64_049b_b3c9_57b2_86b5e194fe3a -->|defined in| 919cda35_c0f5_cbb5_866a_0591c5815209
  style 419c5e64_049b_b3c9_57b2_86b5e194fe3a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/evaluation/qa/test_eval_chain.py lines 42–54

def test_context_eval_chain(chain_cls: type[ContextQAEvalChain]) -> None:
    """Test a simple eval chain."""
    example = {
        "query": "What's my name",
        "context": "The name of this person is John Doe",
    }
    prediction = {"result": "John Doe"}
    fake_qa_eval_chain = chain_cls.from_llm(FakeLLM())

    outputs = fake_qa_eval_chain.evaluate([example, example], [prediction, prediction])
    assert outputs[0] == outputs[1]
    assert "text" in outputs[0]
    assert outputs[0]["text"] == "foo"

Domain

Subdomains

Frequently Asked Questions

What does test_context_eval_chain() do?
test_context_eval_chain() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/evaluation/qa/test_eval_chain.py.
Where is test_context_eval_chain() defined?
test_context_eval_chain() is defined in libs/langchain/tests/unit_tests/evaluation/qa/test_eval_chain.py at line 42.

Analyze Your Own Codebase

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

Try Supermodel Free