Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/modelplane/evaluator/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import functools
import json
import os
import traceback
from concurrent.futures import ThreadPoolExecutor
from dataclasses import dataclass
from itertools import product
Expand Down Expand Up @@ -50,9 +51,10 @@ class FailedDAGOutput(_DAGOutput):

class NodeExecutionError(Exception):
def __init__(self, node_name: str, original_error: Exception):
formatted = traceback.format_exception(original_error)
self.node_name = node_name
self.original_error = original_error
super().__init__(f"Error while executing node '{node_name}': {original_error}")
super().__init__(f"Error executing node '{node_name}': {''.join(formatted)}")


class ComposerColumnNames:
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/evaluator/test_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@ def test_safety_dag_with_bad_node(sample_ctx, threshold_arbiter):

dag_annotator = SafetyDAGAnnotator("safety_annotator", dag)
with pytest.raises(
NodeExecutionError, match="Error while executing node 'failing_node': I'm afraid I can't do that, Dave."
NodeExecutionError, match=r"Error executing node 'failing_node'"
) as e:
dag_annotator.process(
prompt=TextPrompt(text=sample_ctx.prompt),
response=SUTResponse(text=sample_ctx.response),
)
assert type(e.value.original_error) == type(dag_output.error)
assert "Traceback" in str(e.value)
Loading