test_string_run_evaluator.py — langchain Source File
Architecture documentation for test_string_run_evaluator.py, a python file in the langchain codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 61477195_e70f_8894_1afe_a0636ee6b540["test_string_run_evaluator.py"] 525a7d6f_f455_56e3_854a_c8a7da4a1417["unittest.mock"] 61477195_e70f_8894_1afe_a0636ee6b540 --> 525a7d6f_f455_56e3_854a_c8a7da4a1417 119305ac_1914_632e_73da_7975750314ee["langchain_classic.evaluation"] 61477195_e70f_8894_1afe_a0636ee6b540 --> 119305ac_1914_632e_73da_7975750314ee 60d15c19_5fcc_a14b_3dbb_1b8d90f33b45["langchain_classic.smith.evaluation.string_run_evaluator"] 61477195_e70f_8894_1afe_a0636ee6b540 --> 60d15c19_5fcc_a14b_3dbb_1b8d90f33b45 83eb92bf_de13_9379_1489_072ede884ee2["tests.unit_tests.llms"] 61477195_e70f_8894_1afe_a0636ee6b540 --> 83eb92bf_de13_9379_1489_072ede884ee2 style 61477195_e70f_8894_1afe_a0636ee6b540 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Tests for the string run evaluator."""
from unittest.mock import MagicMock
from langchain_classic.evaluation import criteria
from langchain_classic.smith.evaluation.string_run_evaluator import (
ChainStringRunMapper,
StringRunEvaluatorChain,
)
from tests.unit_tests.llms import fake_llm
def test_evaluate_run() -> None:
run_mapper = ChainStringRunMapper()
string_evaluator = criteria.CriteriaEvalChain.from_llm(fake_llm.FakeLLM())
evaluator = StringRunEvaluatorChain(
run_mapper=run_mapper,
example_mapper=None,
name="test_evaluator",
string_evaluator=string_evaluator,
)
run = MagicMock()
example = MagicMock()
res = evaluator.evaluate_run(run, example)
assert str(res.comment).startswith("Error evaluating run ")
assert res.key == string_evaluator.evaluation_name
Domain
Subdomains
Functions
Dependencies
- langchain_classic.evaluation
- langchain_classic.smith.evaluation.string_run_evaluator
- tests.unit_tests.llms
- unittest.mock
Source
Frequently Asked Questions
What does test_string_run_evaluator.py do?
test_string_run_evaluator.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_string_run_evaluator.py?
test_string_run_evaluator.py defines 1 function(s): test_evaluate_run.
What does test_string_run_evaluator.py depend on?
test_string_run_evaluator.py imports 4 module(s): langchain_classic.evaluation, langchain_classic.smith.evaluation.string_run_evaluator, tests.unit_tests.llms, unittest.mock.
Where is test_string_run_evaluator.py in the architecture?
test_string_run_evaluator.py is located at libs/langchain/tests/unit_tests/smith/evaluation/test_string_run_evaluator.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain/tests/unit_tests/smith/evaluation).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free