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
  89c07674_b5ab_1fbb_15ad_86f455409e1b["test_pairwise_string_result_output_parser_parse()"]
  e30f56c6_ff3c_d725_a203_cd9aad50f2cf["test_eval_chain.py"]
  89c07674_b5ab_1fbb_15ad_86f455409e1b -->|defined in| e30f56c6_ff3c_d725_a203_cd9aad50f2cf
  style 89c07674_b5ab_1fbb_15ad_86f455409e1b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/evaluation/comparison/test_eval_chain.py lines 30–66

def test_pairwise_string_result_output_parser_parse() -> None:
    output_parser = PairwiseStringResultOutputParser()
    text = """I like pie better than cake.
[[A]]"""
    got = output_parser.parse(text)
    want = {
        "reasoning": text,
        "value": "A",
        "score": 1,
    }
    assert got.get("reasoning") == want["reasoning"]
    assert got.get("value") == want["value"]
    assert got.get("score") == want["score"]

    text = """I like cake better than pie.
[[B]]"""
    got = output_parser.parse(text)
    want = {
        "reasoning": text,
        "value": "B",
        "score": 0,
    }
    assert got.get("reasoning") == want["reasoning"]
    assert got.get("value") == want["value"]
    assert got.get("score") == want["score"]

    text = """I like cake and pie.
[[C]]"""
    got = output_parser.parse(text)
    want = {
        "reasoning": text,
        "value": None,
        "score": 0.5,
    }
    assert got.get("reasoning") == want["reasoning"]
    assert got.get("value") == want["value"]
    assert got.get("score") == want["score"]

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/comparison/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/comparison/test_eval_chain.py at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free