test_base.py — langchain Source File
Architecture documentation for test_base.py, a python file in the langchain codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 314180f5_296c_7151_eb89_3dae0840b960["test_base.py"] 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 314180f5_296c_7151_eb89_3dae0840b960 --> 120e2591_3e15_b895_72b6_cb26195e40a6 119305ac_1914_632e_73da_7975750314ee["langchain_classic.evaluation"] 314180f5_296c_7151_eb89_3dae0840b960 --> 119305ac_1914_632e_73da_7975750314ee style 314180f5_296c_7151_eb89_3dae0840b960 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import pytest
from langchain_classic.evaluation import ExactMatchStringEvaluator
@pytest.fixture
def exact_match_string_evaluator() -> ExactMatchStringEvaluator:
"""Create an ExactMatchStringEvaluator with default configuration."""
return ExactMatchStringEvaluator()
@pytest.fixture
def exact_match_string_evaluator_ignore_case() -> ExactMatchStringEvaluator:
"""Create an ExactMatchStringEvaluator with ignore_case set to True."""
return ExactMatchStringEvaluator(ignore_case=True)
def test_default_exact_matching(
exact_match_string_evaluator: ExactMatchStringEvaluator,
) -> None:
prediction = "Mindy is the CTO"
reference = "Mindy is the CTO"
result = exact_match_string_evaluator.evaluate_strings(
prediction=prediction,
reference=reference,
)
assert result["score"] == 1.0
reference = "Mindy is the CEO"
result = exact_match_string_evaluator.evaluate_strings(
prediction=prediction,
reference=reference,
)
assert result["score"] == 0.0
def test_exact_matching_with_ignore_case(
exact_match_string_evaluator_ignore_case: ExactMatchStringEvaluator,
) -> None:
prediction = "Mindy is the CTO"
reference = "mindy is the cto"
result = exact_match_string_evaluator_ignore_case.evaluate_strings(
prediction=prediction,
reference=reference,
)
assert result["score"] == 1.0
reference = "mindy is the CEO"
result = exact_match_string_evaluator_ignore_case.evaluate_strings(
prediction=prediction,
reference=reference,
)
assert result["score"] == 0.0
Domain
Subdomains
Functions
Dependencies
- langchain_classic.evaluation
- pytest
Source
Frequently Asked Questions
What does test_base.py do?
test_base.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in test_base.py?
test_base.py defines 4 function(s): exact_match_string_evaluator, exact_match_string_evaluator_ignore_case, test_default_exact_matching, test_exact_matching_with_ignore_case.
What does test_base.py depend on?
test_base.py imports 2 module(s): langchain_classic.evaluation, pytest.
Where is test_base.py in the architecture?
test_base.py is located at libs/langchain/tests/unit_tests/evaluation/exact_match/test_base.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain/tests/unit_tests/evaluation/exact_match).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free