from phoenix.evals import create_evaluator
@create_evaluator(
name="exact-match", source="heuristic", direction="maximize"
)
def exact_match(input: str, output: str) -> bool:
return input == output
exact_match.evaluate({"input": "hello world", "output": "hello world"})
# [
# Score(
# name='exact-match',
# score=1,
# label=None,
# explanation=None,
# metadata={},
# source='heuristic',
# direction='maximize'
# )
# ]
@create_evaluator(
name="contains-link", source="heuristic", direction="maximize"
)
async def contains_link(output: str) -> Score:
link = "https://arize-phoenix.readthedocs.io/projects/evals"
return link in output