mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
Relax string input mapper check (#6544)
for run evaluator. It could be that an evalutor doesn't need the output
This commit is contained in:
parent
ace442b992
commit
7a4ff424fc
@ -42,14 +42,12 @@ class StringRunEvaluatorInputMapper(RunEvaluatorInputMapper, BaseModel):
|
|||||||
answer_map: Optional[Dict[str, str]] = None
|
answer_map: Optional[Dict[str, str]] = None
|
||||||
"""Map from example outputs to the evaluation inputs."""
|
"""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"""
|
"""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.")
|
raise ValueError(f"Run {run.id} has no outputs.")
|
||||||
|
outputs = run.outputs or {}
|
||||||
data = {
|
data = {value: outputs.get(key) for key, value in self.prediction_map.items()}
|
||||||
value: run.outputs.get(key) for key, value in self.prediction_map.items()
|
|
||||||
}
|
|
||||||
data.update(
|
data.update(
|
||||||
{value: run.inputs.get(key) for key, value in self.input_map.items()}
|
{value: run.inputs.get(key) for key, value in self.input_map.items()}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user