Home / Function/ test_pairwise_string_result_output_parser_parse() — langchain Function Reference

test_pairwise_string_result_output_parser_parse() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  b76fc501_5298_334b_ee1c_f0d9025c85b5["test_pairwise_string_result_output_parser_parse()"]
  4517f9a2_997d_f5a5_81ee_8a1c0c7e427d["test_eval_chain.py"]
  b76fc501_5298_334b_ee1c_f0d9025c85b5 -->|defined in| 4517f9a2_997d_f5a5_81ee_8a1c0c7e427d
  style b76fc501_5298_334b_ee1c_f0d9025c85b5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/evaluation/scoring/test_eval_chain.py lines 15–38

def test_pairwise_string_result_output_parser_parse() -> None:
    output_parser = ScoreStringResultOutputParser()
    text = """This answer is really good.
Rating: [[10]]"""
    got = output_parser.parse(text)
    want = {
        "reasoning": text,
        "score": 10,
    }
    assert got.get("reasoning") == want["reasoning"]
    assert got.get("score") == want["score"]

    text = """This answer is really good.
Rating: 10"""
    with pytest.raises(
        ValueError, match="Output must contain a double bracketed string"
    ):
        output_parser.parse(text)

    text = """This answer is really good.
Rating: [[0]]"""
    # Rating is not in range [1, 10]
    with pytest.raises(ValueError, match="with the verdict between 1 and 10"):
        output_parser.parse(text)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free