Relax string input mapper check (#6544)

for run evaluator. It could be that an evalutor doesn't need the output
master
Zander Chase 10 months ago committed by GitHub
parent ace442b992
commit 7a4ff424fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -42,14 +42,12 @@ class StringRunEvaluatorInputMapper(RunEvaluatorInputMapper, BaseModel):
answer_map: Optional[Dict[str, str]] = None
"""Map from example outputs to the evaluation inputs."""
def map(self, run: Run, example: Optional[Example] = None) -> Dict[str, str]:
def map(self, run: Run, example: Optional[Example] = None) -> Dict[str, Any]:
"""Maps the Run and Optional[Example] to a dictionary"""
if run.outputs is None:
if run.outputs is None and self.prediction_map:
raise ValueError(f"Run {run.id} has no outputs.")
data = {
value: run.outputs.get(key) for key, value in self.prediction_map.items()
}
outputs = run.outputs or {}
data = {value: outputs.get(key) for key, value in self.prediction_map.items()}
data.update(
{value: run.inputs.get(key) for key, value in self.input_map.items()}
)

Loading…
Cancel
Save