gen_ai_hub.evaluations.models.dataset_config module¶
- class gen_ai_hub.evaluations.models.dataset_config.Dataset(source: str | Path | ArtifactSource)¶
Bases:
objectDataset object for the evaluations flow.
The Dataset class accepts various source types for evaluation datasets including local file paths (as strings or Path objects) or AI Core artifacts.
- Parameters:
source (Union[str, Path, ArtifactSource]) – Source of the dataset - can be a file path string, Path object, or ArtifactSource
Examples:
Using a Path object:
>>> Dataset(Path("data/sample.json"))
Using a string path:
>>> Dataset("data/sample.json")
Using an ArtifactSource with artifact dictionary:
>>> Dataset( ... ArtifactSource( ... artifact={ ... "id": "xyfz-rtyu-2456-ojns-yu6s", ... "name": "dataset-artifact", ... "url": "ai://default/eval_dataset" ... }, ... path="rootfolder/data.csv", ... file_type="csv" ... ) ... )
Using an ArtifactSource with artifact ID:
>>> Dataset( ... ArtifactSource( ... artifact="xyfz-rtyu-2456-ojns-yu6s", ... path="rootfolder/data.csv", ... file_type="csv" ... ) ... )
- __init__(source: str | Path | ArtifactSource)¶
Initialize a Dataset instance.
- Parameters:
source (Union[str, Path, ArtifactSource]) – Source of the dataset - can be a file path string, Path object, or ArtifactSource
- property file_type: str | None¶
Infer the file type from the source.
For ArtifactSource, returns the explicitly set file_type. For file paths, infers the type from the file extension.
- Returns:
File type (e.g., “json”, “jsonl”, “csv”) or None if cannot be determined
- Return type:
Optional[str]