_EvalArgsMixin Class — langchain Architecture
Architecture documentation for the _EvalArgsMixin class in schema.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD c3049278_87a9_b830_293b_a3dcf7ed9dd3["_EvalArgsMixin"] b8a2957b_df2e_04bc_f892_0752a91e1a55["schema.py"] c3049278_87a9_b830_293b_a3dcf7ed9dd3 -->|defined in| b8a2957b_df2e_04bc_f892_0752a91e1a55 afc2dc22_364c_dd4c_13c6_97c1af2dfdb9["requires_reference()"] c3049278_87a9_b830_293b_a3dcf7ed9dd3 -->|method| afc2dc22_364c_dd4c_13c6_97c1af2dfdb9 bc93661e_2039_3abb_5981_1dd8b67f05f1["requires_input()"] c3049278_87a9_b830_293b_a3dcf7ed9dd3 -->|method| bc93661e_2039_3abb_5981_1dd8b67f05f1 619d9748_9c65_2592_2f6b_587c32b002e9["_skip_input_warning()"] c3049278_87a9_b830_293b_a3dcf7ed9dd3 -->|method| 619d9748_9c65_2592_2f6b_587c32b002e9 5faf3f0f_a629_9bde_ac73_6097b1125157["_skip_reference_warning()"] c3049278_87a9_b830_293b_a3dcf7ed9dd3 -->|method| 5faf3f0f_a629_9bde_ac73_6097b1125157 7026853a_ec84_d1d0_4656_2bb45a043e17["_check_evaluation_args()"] c3049278_87a9_b830_293b_a3dcf7ed9dd3 -->|method| 7026853a_ec84_d1d0_4656_2bb45a043e17
Relationship Graph
Source Code
libs/langchain/langchain_classic/evaluation/schema.py lines 84–133
class _EvalArgsMixin:
"""Mixin for checking evaluation arguments."""
@property
def requires_reference(self) -> bool:
"""Whether this evaluator requires a reference label."""
return False
@property
def requires_input(self) -> bool:
"""Whether this evaluator requires an input string."""
return False
@property
def _skip_input_warning(self) -> str:
"""Warning to show when input is ignored."""
return f"Ignoring input in {self.__class__.__name__}, as it is not expected."
@property
def _skip_reference_warning(self) -> str:
"""Warning to show when reference is ignored."""
return (
f"Ignoring reference in {self.__class__.__name__}, as it is not expected."
)
def _check_evaluation_args(
self,
reference: str | None = None,
input_: str | None = None,
) -> None:
"""Check if the evaluation arguments are valid.
Args:
reference: The reference label.
input_: The input string.
Raises:
ValueError: If the evaluator requires an input string but none is provided,
or if the evaluator requires a reference label but none is provided.
"""
if self.requires_input and input_ is None:
msg = f"{self.__class__.__name__} requires an input string."
raise ValueError(msg)
if input_ is not None and not self.requires_input:
warn(self._skip_input_warning, stacklevel=3)
if self.requires_reference and reference is None:
msg = f"{self.__class__.__name__} requires a reference string."
raise ValueError(msg)
if reference is not None and not self.requires_reference:
warn(self._skip_reference_warning, stacklevel=3)
Source
Frequently Asked Questions
What is the _EvalArgsMixin class?
_EvalArgsMixin is a class in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/schema.py.
Where is _EvalArgsMixin defined?
_EvalArgsMixin is defined in libs/langchain/langchain_classic/evaluation/schema.py at line 84.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free