Skip to content
Open
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
18 changes: 16 additions & 2 deletions openagent_eval/datasets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,26 @@ def _validate_path(self, path: Path) -> None:
path: Path to validate.

Raises:
DatasetNotFoundError: If the path does not exist.
DatasetNotFoundError: If the path does not exist
with a helpful message showing the current working directory.
"""
import os

if not path.exists():
from openagent_eval.exceptions import DatasetNotFoundError

raise DatasetNotFoundError(dataset_path=str(path))
cwd = os.getcwd()
raise DatasetNotFoundError(
dataset_path=str(path),
details={
"tip": (
f"Dataset file not found at '{path}'. "
f"Checked in: {cwd}. "
f"Use an absolute path or verify the path "
f"exists relative to your current directory."
),
},
)

if not path.is_file():
from openagent_eval.exceptions import InvalidDatasetError
Expand Down
21 changes: 21 additions & 0 deletions openagent_eval/datasets/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,28 @@ def _get_loader(config: DatasetConfig) -> BaseDatasetLoader:

Raises:
InvalidDatasetError: If format cannot be determined or is unsupported.
DatasetNotFoundError: If the dataset path does not exist.
"""
# Early path validation — fail fast with a helpful message.
path = Path(config.path)
if not path.exists():
from openagent_eval.exceptions import DatasetNotFoundError

import os

cwd = os.getcwd()
raise DatasetNotFoundError(
dataset_path=config.path,
details={
"tip": (
f"Dataset file not found at '{config.path}'. "
f"Checked in: {cwd}. "
f"Use an absolute path or verify the path "
f"exists relative to your current directory."
),
},
)

# Try explicit format first
if config.format is not None:
format_key = config.format.lower().strip()
Expand Down
Loading