Home / Function/ test_trajectory_output_parser_parse() — langchain Function Reference

test_trajectory_output_parser_parse() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/evaluation/agents/test_eval_chain.py lines 63–115

def test_trajectory_output_parser_parse() -> None:
    trajectory_output_parser = TrajectoryOutputParser()
    text = """Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.

Score: 2"""
    got = trajectory_output_parser.parse(text)
    want = TrajectoryEval(
        score=0.25,
        reasoning="""Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.""",
    )

    assert got["score"] == want["score"]
    assert got["reasoning"] == want["reasoning"]

    with pytest.raises(OutputParserException):
        trajectory_output_parser.parse(
            """Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.""",
        )

    with pytest.raises(OutputParserException):
        trajectory_output_parser.parse(
            """Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.

Score: 9""",
        )

    with pytest.raises(OutputParserException):
        trajectory_output_parser.parse(
            """Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.

Score: 10""",
        )

    with pytest.raises(OutputParserException):
        trajectory_output_parser.parse(
            """Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.

Score: 0.1""",
        )

    with pytest.raises(OutputParserException):
        trajectory_output_parser.parse(
            """Judgment: Given the good reasoning in the final answer
but otherwise poor performance, we give the model a score of 2.

Score: One""",
        )

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free