_aevaluate_string_pairs() — langchain Function Reference
Architecture documentation for the _aevaluate_string_pairs() function in eval_chain.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a98e0fa5_2b25_b62a_6940_98a36013ab00["_aevaluate_string_pairs()"] 6997d03c_6524_f97b_7017_b2f56540bc07["PairwiseStringEvalChain"] a98e0fa5_2b25_b62a_6940_98a36013ab00 -->|defined in| 6997d03c_6524_f97b_7017_b2f56540bc07 ae00f73a_3274_a24c_aed1_e45be85f0fdd["_prepare_input()"] a98e0fa5_2b25_b62a_6940_98a36013ab00 -->|calls| ae00f73a_3274_a24c_aed1_e45be85f0fdd 8d13c038_c9d1_0607_fe88_3a2eaf8195b9["_prepare_output()"] a98e0fa5_2b25_b62a_6940_98a36013ab00 -->|calls| 8d13c038_c9d1_0607_fe88_3a2eaf8195b9 style a98e0fa5_2b25_b62a_6940_98a36013ab00 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/evaluation/comparison/eval_chain.py lines 365–408
async def _aevaluate_string_pairs(
self,
*,
prediction: str,
prediction_b: str,
reference: str | None = None,
input: str | None = None,
callbacks: Callbacks = None,
tags: list[str] | None = None,
metadata: dict[str, Any] | None = None,
include_run_info: bool = False,
**kwargs: Any,
) -> dict:
"""Asynchronously evaluate whether output A is preferred to output B.
Args:
prediction: The output string from the first model.
prediction_b: The output string from the second model.
input: The input or task string.
callbacks: The callbacks to use.
tags: The tags to apply.
metadata: The metadata to use.
include_run_info: Whether to include run info in the output.
reference: The reference string, if any.
**kwargs: Additional keyword arguments.
Returns:
`dict` containing:
- reasoning: The reasoning for the preference.
- value: The preference value, which is either 'A', 'B', or None
for no preference.
- score: The preference score, which is 1 for 'A', 0 for 'B',
and 0.5 for None.
"""
input_ = self._prepare_input(prediction, prediction_b, input, reference)
result = await self.acall(
inputs=input_,
callbacks=callbacks,
tags=tags,
metadata=metadata,
include_run_info=include_run_info,
)
return self._prepare_output(result)
Domain
Subdomains
Source
Frequently Asked Questions
What does _aevaluate_string_pairs() do?
_aevaluate_string_pairs() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/comparison/eval_chain.py.
Where is _aevaluate_string_pairs() defined?
_aevaluate_string_pairs() is defined in libs/langchain/langchain_classic/evaluation/comparison/eval_chain.py at line 365.
What does _aevaluate_string_pairs() call?
_aevaluate_string_pairs() calls 2 function(s): _prepare_input, _prepare_output.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free