Home / File/ test_map_rerank_prompt.py — langchain Source File

test_map_rerank_prompt.py — langchain Source File

Architecture documentation for test_map_rerank_prompt.py, a python file in the langchain codebase. 2 imports, 0 dependents.

File python LangChainCore MessageInterface 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  1703884b_a682_dd3a_8df3_c6ce4086e7d0["test_map_rerank_prompt.py"]
  f69d6389_263d_68a4_7fbf_f14c0602a9ba["pytest"]
  1703884b_a682_dd3a_8df3_c6ce4086e7d0 --> f69d6389_263d_68a4_7fbf_f14c0602a9ba
  f37d9eef_55c2_1ebb_3555_67d9e3b37338["langchain_classic.chains.question_answering.map_rerank_prompt"]
  1703884b_a682_dd3a_8df3_c6ce4086e7d0 --> f37d9eef_55c2_1ebb_3555_67d9e3b37338
  style 1703884b_a682_dd3a_8df3_c6ce4086e7d0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Test map_rerank parser."""

import pytest

from langchain_classic.chains.question_answering.map_rerank_prompt import output_parser

GOOD_SCORE = "foo bar answer.\nScore: 80"
SCORE_WITH_EXPLANATION = (
    "foo bar answer.\n"
    "Score: 80 (fully answers the question, "
    "but could provide more detail on the specific error message)"
)


@pytest.mark.parametrize("answer", [GOOD_SCORE, SCORE_WITH_EXPLANATION])
def test_parse_scores(answer: str) -> None:
    result = output_parser.parse(answer)

    assert result["answer"] == "foo bar answer."

    score = int(result["score"])
    assert score == 80

Domain

Subdomains

Dependencies

  • langchain_classic.chains.question_answering.map_rerank_prompt
  • pytest

Frequently Asked Questions

What does test_map_rerank_prompt.py do?
test_map_rerank_prompt.py is a source file in the langchain codebase, written in python. It belongs to the LangChainCore domain, MessageInterface subdomain.
What functions are defined in test_map_rerank_prompt.py?
test_map_rerank_prompt.py defines 1 function(s): test_parse_scores.
What does test_map_rerank_prompt.py depend on?
test_map_rerank_prompt.py imports 2 module(s): langchain_classic.chains.question_answering.map_rerank_prompt, pytest.
Where is test_map_rerank_prompt.py in the architecture?
test_map_rerank_prompt.py is located at libs/langchain/tests/unit_tests/chains/question_answering/test_map_rerank_prompt.py (domain: LangChainCore, subdomain: MessageInterface, directory: libs/langchain/tests/unit_tests/chains/question_answering).

Analyze Your Own Codebase

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

Try Supermodel Free