Home / Function/ test_old_api_works() — langchain Function Reference

test_old_api_works() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e30e6275_b812_8710_3bb1_a5ba922a23e8["test_old_api_works()"]
  1ff39fbd_e89b_6287_757b_009d26497b03["test_eval_chain.py"]
  e30e6275_b812_8710_3bb1_a5ba922a23e8 -->|defined in| 1ff39fbd_e89b_6287_757b_009d26497b03
  style e30e6275_b812_8710_3bb1_a5ba922a23e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/evaluation/agents/test_eval_chain.py lines 172–198

def test_old_api_works(intermediate_steps: list[tuple[AgentAction, str]]) -> None:
    llm = _FakeTrajectoryChatModel(
        queries={
            "a": "Trajectory good\nScore: 5",
            "b": "Trajectory not good\nScore: 1",
        },
        sequential_responses=True,
    )
    chain = TrajectoryEvalChain.from_llm(llm=llm)
    res = chain(
        {
            "question": "What is your favorite food?",
            "agent_trajectory": intermediate_steps,
            "answer": "I like pie.",
        },
    )
    assert res["score"] == 1.0

    res = chain(
        {
            "question": "What is your favorite food?",
            "agent_trajectory": intermediate_steps,
            "answer": "I like pie.",
            "reference": "Paris",
        },
    )
    assert res["score"] == 0.0

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free